English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 04 October 2018, 11:34   #941
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 44
Posts: 1,131
Send a message via Yahoo to Samurai_Crow
I think you're supposed to build with custom startup code.

Try typing "make simple.library_r" and look at the -resident command line option.

Last edited by Samurai_Crow; 04 October 2018 at 11:43.
Samurai_Crow is offline  
Old 04 October 2018, 18:32   #942
Hewitson
Registered User
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 36
Posts: 2,624
Quote:
Originally Posted by bebbo View Post
For those interested in my recent versions, I am providing now
Would you be willing to host an OSX macOS version if I built one? I am happy to maintain it.
Hewitson is offline  
Old 04 October 2018, 19:10   #943
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 449
Quote:
Originally Posted by pipper View Post
Does anyone know how to build a .library file with the gcc toolchain? I tried to follow the example at https://github.com/bebbo/amigaos-cro...mple-library.c but had no success. It built _something_ but I don’t think it’s a valid library file
Not pure gcc, but this might be of help
https://github.com/alexalkis/library
alkis is offline  
Old 04 October 2018, 20:47   #944
pipper
Registered User

 
Join Date: Jul 2017
Location: San Jose
Posts: 96
Thanks, alkis! Yeah, this is not really what I’m looking for as you’re using asm to setup the library structure. If everything fails, I can use this approach, though. I was looking for a C only solution if possible. I thought that -ramiga-lib and the macros in <stabs.h> would do the magic.
pipper is offline  
Old 05 October 2018, 10:24   #945
pipper
Registered User

 
Join Date: Jul 2017
Location: San Jose
Posts: 96
I think I got it working

Two issues
1) I was a moron, producing essentially .o file (I had -c left over in the gcc commandline)
2) libnix seems to have a 14 year(!) old bug in libinit.c#L183 :
Code:
in LibInit() :
if (!__UserLibInit(&lib->LibNode,lib->DataSeg)) {
    FreeMem((UBYTE *)lib-lib->LibNode.lib_NegSize,lib->LibNode.lib_NegSize+lib->LibNode.lib_PosSize);
    lib = NULL;
  }
All sources and examples on the internet claim that __UserLibInit() needs to return 0 to indicate success. But libnix interprets it as failure. Returning !=0 from my __UserLibInit eventually got me past the initial hurdle (OpenLibrary claimed it couldn't open my library).
pipper is offline  
Old 05 October 2018, 17:10   #946
asymetrix
Registered User

 
Join Date: Jul 2009
Location: UK
Posts: 93
Quote:
Originally Posted by bebbo View Post
For those interested in my recent versions, I am providing now

Installed on Windows 10, 64bit.

I used ./bin to get direct access to gcc.
Im getting a command line : error .

Code:
<C:\amiga-gcc>.\bin\m68k-amigaos-gcc.exe hello.c hello -Os -noixemul
/amiga-gcc/lib/gcc/m68k-amigaos/6.4.1b/../../../../m68k-amigaos/bin/ld: hello:(.text+0x68): multiple definition of `_exit'; C:/amiga-gcc/m68k-amigaos/libnix/lib/ncrt0.o:C:/amiga-gcc/m68k-amigaos/libnix/lib/ncrt0.o:(.text+0x68): first defined here
/amiga-gcc/lib/gcc/m68k-amigaos/6.4.1b/../../../../m68k-amigaos/bin/ld: hello:(.text+0x68): multiple definition of `exit'
/amiga-gcc/lib/gcc/m68k-amigaos/6.4.1b/../../../../m68k-amigaos/bin/ld: hello:(.text+0xe8): multiple definition of `main'; /Users/angel/AppData/Local/Temp/ccYVojmD.o:(.text+0x1c): first defined here
collect2: error: ld returned 1 exit status

C:\amiga-gcc>
asymetrix is offline  
Old 05 October 2018, 17:20   #947
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 307
Quote:
Originally Posted by asymetrix View Post
Installed on Windows 10, 64bit.

I used ./bin to get direct access to gcc.
Im getting a command line : error .

Code:
<C:\amiga-gcc>.\bin\m68k-amigaos-gcc.exe hello.c hello -Os -noixemul
/amiga-gcc/lib/gcc/m68k-amigaos/6.4.1b/../../../../m68k-amigaos/bin/ld: hello:(.text+0x68): multiple definition of `_exit'; C:/amiga-gcc/m68k-amigaos/libnix/lib/ncrt0.o:C:/amiga-gcc/m68k-amigaos/libnix/lib/ncrt0.o:(.text+0x68): first defined here
/amiga-gcc/lib/gcc/m68k-amigaos/6.4.1b/../../../../m68k-amigaos/bin/ld: hello:(.text+0x68): multiple definition of `exit'
/amiga-gcc/lib/gcc/m68k-amigaos/6.4.1b/../../../../m68k-amigaos/bin/ld: hello:(.text+0xe8): multiple definition of `main'; /Users/angel/AppData/Local/Temp/ccYVojmD.o:(.text+0x1c): first defined here
collect2: error: ld returned 1 exit status

C:\amiga-gcc>
Your problem is a missing '-o' since that commandline tries to create a file named 'a.out' using 'hello.c' plus 'hello' as input files.

(And you should add that bin folder to the path or use the provided cmdline.bat which does this for you.)
bebbo is offline  
Old 06 October 2018, 07:29   #948
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 47
Posts: 1,090
Quote:
Originally Posted by bebbo View Post
For those interested in my recent versions, I am providing now
  • no osx - sorry - well, not really^^
I second Hewitson's initiative to provide a macOS port and have you host it, this would be really nice.

Quote:
Originally Posted by bebbo View Post
I also wrote a script to easily benchmark different compilers. Here is the chart for
[...]
You may provide more benchmarks and compilers (prebuild for linux) and I'll update the chart and maybe also the compiler explorer
Am I correct when interpreting that this means that this produces code more than twice faster than the previous best C compilers?
If so, that is mightily impressive.

I do not recall the exact version of GCC Samuel Devulder and I used when we were fiddling with the Quake sources around 1996-97 (Samuel published them on Aminet at the time) but this makes me very eager to recompile them and measure the difference.
ReadOnlyCat is offline  
Old 06 October 2018, 12:40   #949
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 449
Quote:
Originally Posted by ReadOnlyCat View Post
I do not recall the exact version of GCC Samuel Devulder and I used when we were fiddling with the Quake sources around 1996-97 (Samuel published them on Aminet at the time) but this makes me very eager to recompile them and measure the difference.
My guess would be, little or no difference, since I'd assume the graphics bandwidth would be the bottleneck.
alkis is offline  
Old 06 October 2018, 12:41   #950
asymetrix
Registered User

 
Join Date: Jul 2009
Location: UK
Posts: 93
Quote:
Originally Posted by bebbo View Post
Your problem is a missing '-o' since that commandline tries to create a file named 'a.out' using 'hello.c' plus 'hello' as input files.

(And you should add that bin folder to the path or use the provided cmdline.bat which does this for you.)

Works perfect, thanks bebbo !
asymetrix is offline  
Old 06 October 2018, 15:41   #951
Hewitson
Registered User
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 36
Posts: 2,624
Quote:
Originally Posted by asymetrix View Post
Code:
<C:\amiga-gcc>.\bin\m68k-amigaos-gcc.exe
That's a strange way of doing things. "bin\m68k-amigaos-gcc" is sufficient.
Hewitson is offline  
Old 06 October 2018, 21:05   #952
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 47
Posts: 1,090
Quote:
Originally Posted by alkis View Post
My guess would be, little or no difference, since I'd assume the graphics bandwidth would be the bottleneck.
You are assuming the compiled code was attaining the maximum bandwidth of AGA Chip RAM.

I doubt that was the case since the profiler runs I collected at the time revealed that most of the time was spent in
fmul
functions (*) followed only a bit further down the line by the span drawing functions.
Moreover, even then, there is no guarantee that these drawing functions were also reaching maximum bandwidth.
For both types of tasks, a better optimizing compiler would probably help maximize the throughput and end up having a positive influence on the frame rate, even if probably will be only by a small fraction.

Of course, switching from floating point maths to fixed point in the absence of an FPU would probably the first step to take before optimizing anything else.

(*) my 1200 was equipped with a 68030 but I do not recall if it was also fitted with a 68881/2 FPU at the time, I suspect it was not since the
fmul
functions would have been replaced by the corresponding assembly instructions then.
ReadOnlyCat is offline  
Old 06 October 2018, 21:23   #953
pipper
Registered User

 
Join Date: Jul 2017
Location: San Jose
Posts: 96
@bebbo: do you know if (and how good) the optimizer knows how to optimize for 060? I.e. shift instructions around to make use of dual-issue?
Also do -m68020-60 and -m68060 avoid instructions that were removed from the 060?
Thanks!
pipper is offline  
Old 06 October 2018, 22:55   #954
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 307
Quote:
Originally Posted by pipper View Post
@bebbo: do you know if (and how good) the optimizer knows how to optimize for 060? I.e. shift instructions around to make use of dual-issue?
Also do -m68020-60 and -m68060 avoid instructions that were removed from the 060?
Thanks!
There are insns which are not used if code is generated for 68060. Some mulu/muls and some fpu insns - no idea if it's sufficient^^

And there is no insn reordering for m68k* in gcc6.
bebbo is offline  
Old 09 October 2018, 18:17   #955
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 307
Quote:
Originally Posted by ReadOnlyCat View Post
I second Hewitson's initiative to provide a macOS port and have you host it, this would be really nice.
Linux is ok, Windows needs a crutch and macOS is a PITA.

There you go...

Quote:
Originally Posted by ReadOnlyCat View Post
Am I correct when interpreting that this means that this produces code more than twice faster than the previous best C compilers?
If so, that is mightily impressive.
That's the result for this benchmark, if you benchmark a hello-world the program with the smallest startup overhead will win.

So propose a different benchmark and we'll see.

Last edited by bebbo; 09 October 2018 at 23:30.
bebbo is offline  
Old 11 October 2018, 08:21   #956
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 47
Posts: 1,090
Quote:
Originally Posted by bebbo View Post
Linux is ok, Windows needs a crutch and macOS is a PITA.
There you go...
Thanks!

Quote:
Originally Posted by bebbo View Post
That's the result for this benchmark, if you benchmark a hello-world the program with the smallest startup overhead will win.

So propose a different benchmark and we'll see.
I was thinking of using Wolfenstein 3D as a benchmark since the code runs a relatively varied array of routines and should test memory bandwidth (for texture mapping) as well as geometric fixed points computations and some general purpose code (gameplay loop).
The issue being that as such, the Wolfenstein 3D code cannot be directly ran as a benchmark and would require modification to run tests straight from the command line.
I would love to do that but unfortunately I am and will be time starved for at least one full week.
ReadOnlyCat is offline  
Old 06 November 2018, 21:01   #957
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 449
get https://www.lua.org/ftp/lua-5.3.5.tar.gz
tar xvf the thing.
cd lua-5.3.5/src
make generic CC=m68k-amigaos-gcc CFLAGS="-O3 -fomit-frame-pointer" AR="m68k-amigaos-ar r" RANLIB=m68k-amigaos-ranlib LDFLAGS="-noixemul -s"

BOOM! Lua from upstream. No source changes. No makefile changes.
Thanks bebbo.
alkis is offline  
Old 06 November 2018, 21:44   #958
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,194
But does it pass the test suite? Lua is highly dependent on the standard C library to function correctly.
Leffmann is offline  
Old 07 November 2018, 18:26   #959
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 47
Posts: 449
Frankly I haven't tried to do any tests (besides simple little lua scripts).

I took a quick look at https://www.lua.org/tests/ and there is no 5.3.5. I could try with 5.3.4 when I get some time
alkis is offline  
Old 05 December 2018, 05:16   #960
Hedeon
Sonnet Hacker

 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 835
Hello,

I made a library with this great tool so there are no startup files used. However (/because of that), my code crashes on float conversion stuff like floatunsidf. Looking at the code I see jumps to a library offset (-36 etc) from an uninitialized library pointer. I guess I need to manually open some libraries... But which?

Edit: nvm. It was late. Looked at nm and I see I am missing MathIeeeDoubBasBase, MathIeeeDoubTransBase and MathIeeeSingBasBase

Last edited by Hedeon; 05 December 2018 at 05:39.
Hedeon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 8 24 December 2017 11:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 23:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 04:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 22:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 15:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:46.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.11113 seconds with 15 queries