gcc 7.1 for the ST series

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
Eero Tamminen
Atari God
Atari God
Posts: 1729
Joined: Sun Jul 31, 2011 1:11 pm

Re: gcc 7.1 for the ST series

Postby Eero Tamminen » Sat Feb 17, 2018 7:33 pm

LuigiThirty wrote:I'm adapting my Pure-C GEM game source over to Mintlib and GEMlib. Having some trouble with crashes though, and being without the Pure-C debugger is a pain. Is it possible to get symbolic debugging going with a TOS application built in GCC?


Hatari v2.1 debugger supports a.out symbols.

(Funny that Thorsten Otto didn't mention it, because he contributed it to Hatari. :-))

User avatar
ggn
Atari God
Atari God
Posts: 1202
Joined: Sat Dec 28, 2002 4:49 pm

Re: gcc 7.1 for the ST series

Postby ggn » Fri May 04, 2018 6:10 am

Looks like gcc 8.1 was released a couple of days ago, so we added that to our build script and tried it out - worked without a hitch! http://brownbot.hopto.org/ is also updated with the latest gcc, so enjoy!

(edit: well I jinxed it - the server went down shortly after I announced this - it'll be back soon hopefully!)
is 73 Falcon patched atari games enough ? ^^

User avatar
shoggoth
Nature
Nature
Posts: 934
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: gcc 7.1 for the ST series

Postby shoggoth » Fri May 04, 2018 9:26 am

I just wet my pants!
Ain't no space like PeP-space.

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 763
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: gcc 7.1 for the ST series

Postby dhedberg » Fri May 04, 2018 11:31 am

Ha! Looks like all your hard work paid off! :-)
Thanks!
Last edited by dhedberg on Fri May 04, 2018 12:19 pm, edited 1 time in total.
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

joska
Hardware Guru
Hardware Guru
Posts: 4097
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: gcc 7.1 for the ST series

Postby joska » Fri May 04, 2018 11:41 am

Out of curiosity - does this run on TOS/MiNT?
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

User avatar
ggn
Atari God
Atari God
Posts: 1202
Joined: Sat Dec 28, 2002 4:49 pm

Re: gcc 7.1 for the ST series

Postby ggn » Fri May 04, 2018 12:45 pm

joska wrote:Out of curiosity - does this run on TOS/MiNT?


To be honest I've never even tried compiling it for MiNT target. The only way I'd attempt something like this would be via aranym or if you use mikro's bootstrapping stuff. IIRC that's building a host cross compiler and then use that to compiling for MiNT. This script will only get you half way through, i.e. building a host cross compiler.
is 73 Falcon patched atari games enough ? ^^

User avatar
ggn
Atari God
Atari God
Posts: 1202
Joined: Sat Dec 28, 2002 4:49 pm

Re: gcc 7.1 for the ST series

Postby ggn » Fri May 04, 2018 6:51 pm

Server's back up, hopefully more stable than ever now! So have a poke if you want :)
is 73 Falcon patched atari games enough ? ^^

Fletch
Atari User
Atari User
Posts: 43
Joined: Fri Sep 12, 2008 1:11 am

Re: gcc 7.1 for the ST series

Postby Fletch » Thu May 10, 2018 4:19 am

I'm trying to figure out how to build https://atari800.github.io/ for the Falcon or TT030. I'm a complete noob, will GCC for Atari help me do that? Do I build on the Atari of use my Mac and create Atari binaries there? Anyone have tips?

Thanks for the help!

-Pete

gurka
Atariator
Atariator
Posts: 28
Joined: Fri Jul 03, 2009 9:17 am
Location: Umeå, Sweden

Re: gcc 7.1 for the ST series

Postby gurka » Tue Jun 19, 2018 8:50 pm

I just tried m68k-atariultrabrown-elf-gcc and brownout, both built with the latest source on bitbucket. My code builds OK with Vincent's m68k-atari-mint-gcc 4.6.4 and does build OK with m68k-atariultrabrown-elf-gcc, but brownout asserts on the following:

Code: Select all

performing section layout...
record: section[.tos_entrypoint] tsi:0 fbeg:0x1c fend:0x24
record: section[.text] elfaddr:0x80000074 esi:1 tsi:1 fbeg:0x24 fend:0x2f6
record: section[.rodata] elfaddr:0x80000346 esi:2 tsi:2 fbeg:0x2f6 fend:0x4f6
record: section[.data] elfaddr:0x80002000 esi:3 tsi:3 fbeg:0x4f6 fend:0x516
record: section[.bss] elfaddr:0x80002020 esi:4 tsi:4 fbeg:0x516 fend:0x1004e
TEXT size: 730
DATA size:544
BSS size:64312
processing relocation entries...
hunting entrypoint symbol...
entrypoint located at eVA:$8000033c (tVA:$0002d0)
emitting program data...
sorting 1 relocations...
note: reloc [toslink] refers to non-existent elf section
correcting relocations after section layout...
tosreloc:[toslink] type:[R_68k_32] val:[0x2d0] elfsec:[-missing-] tossec:[TEXT]
brownout: brownout.cpp:301: std::map<unsigned int, std::pair<unsigned int, int> >::iterator get_section_for_va(elfsectionboundsmap_t&, uint32_t): Assertion `_va >= reference_bound->second.first' failed.
Aborted


Any ideas?

User avatar
ggn
Atari God
Atari God
Posts: 1202
Joined: Sat Dec 28, 2002 4:49 pm

Re: gcc 7.1 for the ST series

Postby ggn » Wed Jun 20, 2018 7:47 am

gurka wrote:Any ideas?


I see the section names start at $80000000.

Code: Select all

record: section[.text] elfaddr:0x80000074 esi:1 tsi:1 fbeg:0x24 fend:0x2f6
record: section[.rodata] elfaddr:0x80000346 esi:2 tsi:2 fbeg:0x2f6 fend:0x4f6
record: section[.data] elfaddr:0x80002000 esi:3 tsi:3 fbeg:0x4f6 fend:0x516
record: section[.bss] elfaddr:0x80002020 esi:4 tsi:4 fbeg:0x516 fend:0x1004e


For reference a project I just tried to build shows:

Code: Select all

record [.tos_entrypoint] tsi:0 fbeg:28 fend:36
record [.text] esi:1 tsi:1 fbeg:36 fend:39340
record [TEXT] esi:3 tsi:2 fbeg:39340 fend:99174
record [.preinit_array] esi:7 tsi:3 fbeg:99174 fend:99178
record [.init_array] esi:8 tsi:4 fbeg:99178 fend:99186
record [.fini_array] esi:10 tsi:5 fbeg:99186 fend:99190
record [.rodata] esi:5 tsi:6 fbeg:99190 fend:110052
record [.data] esi:11 tsi:7 fbeg:110052 fend:110808
record [DATA] esi:13 tsi:8 fbeg:110808 fend:113476
record [.bss] esi:15 tsi:9 fbeg:113476 fend:167272
record [BSS] esi:16 tsi:10 fbeg:167272 fend:221102


Did you link with "-Ttext=0"? If not, try enabling that as I suspect that's the issue.
is 73 Falcon patched atari games enough ? ^^

User avatar
ggn
Atari God
Atari God
Posts: 1202
Joined: Sat Dec 28, 2002 4:49 pm

Re: gcc 7.1 for the ST series

Postby ggn » Wed Jun 20, 2018 7:49 am

Fletch wrote:I'm trying to figure out how to build https://atari800.github.io/ for the Falcon or TT030. I'm a complete noob, will GCC for Atari help me do that? Do I build on the Atari of use my Mac and create Atari binaries there? Anyone have tips?

Thanks for the help!

-Pete


Oh damn, I just noticed that message :oops:.

I would assume that this would not be the task for a beginner, as I suspect the configuration scripts would need tinkering.
is 73 Falcon patched atari games enough ? ^^

gurka
Atariator
Atariator
Posts: 28
Joined: Fri Jul 03, 2009 9:17 am
Location: Umeå, Sweden

Re: gcc 7.1 for the ST series

Postby gurka » Wed Jun 20, 2018 8:49 am

ggn wrote:Did you link with "-Ttext=0"? If not, try enabling that as I suspect that's the issue.


That did the trick. So, why does it default to putting .text at an 0x80000000 offset? Is it just an Linux and/or ELF thing?

Can brownout be update to handle this or should I get used to using -Ttext=0 for everything? :)

User avatar
ggn
Atari God
Atari God
Posts: 1202
Joined: Sat Dec 28, 2002 4:49 pm

Re: gcc 7.1 for the ST series

Postby ggn » Wed Jun 20, 2018 9:29 am

gurka wrote:
ggn wrote:Did you link with "-Ttext=0"? If not, try enabling that as I suspect that's the issue.


That did the trick. So, why does it default to putting .text at an 0x80000000 offset? Is it just an Linux and/or ELF thing?


Pretty much yes - I think this is a default value mandated by the ELF format, if not that then something similar.

gurka wrote:Can brownout be update to handle this or should I get used to using -Ttext=0 for everything? :)


You know, what you experienced is really weird because in the compilers I have built here (both Windows and Linux), this is baked into the compiler. For example:

Code: Select all

~/brown/bin$ ./m68k-atariultrabrown-elf-gcc --verbose
Using built-in specs.
COLLECT_GCC=./m68k-atariultrabrown-elf-gcc
COLLECT_LTO_WRAPPER=/home/ggn/brown/libexec/gcc/m68k-atariultrabrown-elf/8.1.0/lto-wrapper
Target: m68k-atariultrabrown-elf
Configured with: ../gcc-8.1.0/configure --target=m68k-atariultrabrown-elf --disable-nls --enable-languages=c,c++,fortran --enable-lto --prefix=/home/ggn/brown --disable-libssp --enable-softfloat --disable-libstdcxx-pch --disable-clocale --disable-libstdcxx-threads --disable-libstdcxx-filesystem-ts --disable-libquadmath --enable-cxx-flags='-O2 -fomit-frame-pointer -fno-threadsafe-statics -fno-exceptions -fno-rtti -fleading-underscore' 'CFLAGS_FOR_TARGET=-O2 -fomit-frame-pointer -fleading-underscore' 'CXXFLAGS_FOR_TARGET=-O2 -fomit-frame-pointer -fno-threadsafe-statics -fno-exceptions -fno-rtti -fleading-underscore' 'LDFLAGS_FOR_TARGET=--emit-relocs -Ttext=0'
Thread model: single
gcc version 8.1.0 (GCC)


So in my tests here I didn't have to add "-Ttext=0" at all. Can you try that on your built compiler and see if LDFLAGS_FOR_TARGET is the same as the above?
is 73 Falcon patched atari games enough ? ^^

gurka
Atariator
Atariator
Posts: 28
Joined: Fri Jul 03, 2009 9:17 am
Location: Umeå, Sweden

Re: gcc 7.1 for the ST series

Postby gurka » Wed Jun 20, 2018 10:11 am

ggn wrote:Can you try that on your built compiler and see if LDFLAGS_FOR_TARGET is the same as the above?


Code: Select all

$ m68k-atariultrabrown-elf-gcc --verbose
Using built-in specs.
COLLECT_GCC=m68k-atariultrabrown-elf-gcc
COLLECT_LTO_WRAPPER=/opt/brown/bin/../libexec/gcc/m68k-atariultrabrown-elf/8.1.0/lto-wrapper
Target: m68k-atariultrabrown-elf
Configured with: ../gcc-8.1.0/configure --target=m68k-atariultrabrown-elf --disable-nls --enable-languages=c,c++ --enable-lto --prefix=/home/simon/brown --disable-libssp --enable-softfloat --disable-libstdcxx-pch --disable-clocale --disable-libstdcxx-threads --disable-libstdcxx-filesystem-ts --disable-libquadmath --enable-cxx-flags='-O2 -fomit-frame-pointer -fno-threadsafe-statics -fno-exceptions -fno-rtti -fleading-underscore' 'CFLAGS_FOR_TARGET=-O2 -fomit-frame-pointer -fleading-underscore' 'CXXFLAGS_FOR_TARGET=-O2 -fomit-frame-pointer -fno-threadsafe-statics -fno-exceptions -fno-rtti -fleading-underscore' 'LDFLAGS_FOR_TARGET=--emit-relocs -Ttext=0'
Thread model: single
gcc version 8.1.0 (GCC)


Well, -Ttext=0 is there. Another thing is that I have to manually specify -fleading-underscore, otherwise my code doesn't build, but it's already there in CFLAGS_FOR_TARGET.

I noticed that it still says --prefix=/home/simon/brown, which is where I built everything. I later moved everything to /opt/brown as you can see in the paths. Can that be an issue?

That leads me to another thing that I wanted to ask you: the default install path for bigbrownbuild if RUN_MODE=Admin (and machine is not Mac) is /opt/compiler-explorer. I saw the tickets on compiler-explorer's github so I understand why that is, but maybe there could be a RUN_MODE=CE instead for compiler-explorer specific settings, and have RUN_MODE=Admin install to /opt/brown?

Edit: I tried to recompile everything with RUN_MODE=Admin so that all paths would be the same, but it still does not work.

gurka
Atariator
Atariator
Posts: 28
Joined: Fri Jul 03, 2009 9:17 am
Location: Umeå, Sweden

Re: gcc 7.1 for the ST series

Postby gurka » Wed Jun 20, 2018 11:14 am

Maybe I'm just using it wrong :)

With a very simple test.c file:

Code: Select all

simon@dev:~/atari/code/test (master)$ cat test.c
void test()
{
  *(unsigned short*)(0xffff8240) = 0x0700;
}


And compiling it to an object file, I get:

Code: Select all

simon@dev:~/atari/code/test (master)$ m68k-atariultrabrown-elf-gcc -c test.c -o test.o
simon@dev:~/atari/code/test (master)$ m68k-atariultrabrown-elf-objdump -d test.o

test.o:     file format elf32-m68k


Disassembly of section .text:

00000000 <test>:
   0:   4e56 0000       linkw %fp,#0
   4:   307c 8240       moveaw #-32192,%a0
   8:   30bc 0700       movew #1792,%a0@
   c:   4e71            nop
   e:   4e5e            unlk %fp
  10:   4e75            rts


But if I instead compile to an elf, and setting test() as entry, I get:

Code: Select all

simon@dev:~/atari/code/test (master)$ m68k-atariultrabrown-elf-gcc -nostdlib -Wl,-etest test.c -o test.elf
simon@dev:~/atari/code/test (master)$ m68k-atariultrabrown-elf-objdump -d test.elf

test.elf:     file format elf32-m68k


Disassembly of section .text:

80000054 <test>:
80000054:       4e56 0000       linkw %fp,#0
80000058:       307c 8240       moveaw #-32192,%a0
8000005c:       30bc 0700       movew #1792,%a0@
80000060:       4e71            nop
80000062:       4e5e            unlk %fp
80000064:       4e75            rts


Notice how there still is a frame pointer here, even though CFLAGS_FOR_TARGET has -fomit-frame-pointer. But maybe I'm misunderstand how/when X_FOR_TARGET is used by gcc?

User avatar
ggn
Atari God
Atari God
Posts: 1202
Joined: Sat Dec 28, 2002 4:49 pm

Re: gcc 7.1 for the ST series

Postby ggn » Wed Jun 20, 2018 12:43 pm

gurka wrote:Well, -Ttext=0 is there. Another thing is that I have to manually specify -fleading-underscore, otherwise my code doesn't build, but it's already there in CFLAGS_FOR_TARGET.

I noticed that it still says --prefix=/home/simon/brown, which is where I built everything. I later moved everything to /opt/brown as you can see in the paths. Can that be an issue?


Probably not as I move the compiler location around on my machines.

gurka wrote:That leads me to another thing that I wanted to ask you: the default install path for bigbrownbuild if RUN_MODE=Admin (and machine is not Mac) is /opt/compiler-explorer. I saw the tickets on compiler-explorer's github so I understand why that is, but maybe there could be a RUN_MODE=CE instead for compiler-explorer specific settings, and have RUN_MODE=Admin install to /opt/brown?


To be honest I do have the compiler-explorer stuff into its own branch so it's not a real issue. In the main branch we can set up the paths anywhere we like. And when Troed submitted his original patches for OSX the install location was indeed inside /opt. Somewhere along the line I merged the CE and main branches and the paths probably got mixed up.

gurka wrote:Edit: I tried to recompile everything with RUN_MODE=Admin so that all paths would be the same, but it still does not work.


Yup, not sure about gcc configure flags - sometimes they get flat ignored so we just add the flags when building our own projects. Who knows...
is 73 Falcon patched atari games enough ? ^^

ThorstenOtto
Captain Atari
Captain Atari
Posts: 369
Joined: Sun Aug 03, 2014 5:54 pm

Re: gcc 7.1 for the ST series

Postby ThorstenOtto » Wed Jun 20, 2018 4:52 pm

ggn wrote:
gurka wrote:[
So in my tests here I didn't have to add "-Ttext=0" at all. Can you try that on your built compiler and see if LDFLAGS_FOR_TARGET is the same as the above?


LDFLAGS_FOR_TARGET is only used while building the compiler. It is not used when compiling your programs with that compiler, for that you have to mess with the specs file and/or linker script.


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 0 guests

cron