gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > gcc linker error?

#3718 - tHe_pUnK - Thu Mar 06, 2003 11:01 am

I'm trying to compile some test code using devkitadvance under linux and i get this linker error:
/usr/local/devkitadv/lib/gcc-lib/arm-agb-elf/3.1/../../../../arm-agb-elf/bin/ld: section .data [08000448 -> 0800044f] overlaps section .init [08000434 -> 0800044f]
collect2: ld returned 1 exit status

i'm just calling: arm-agb-elf-gcc -Wall -mthumb-interwork -o test.elf test.c
I'm a newbie GBA dev'r so any help would be greatly appreciated. - tHe_pUnK

#3721 - Torlus - Thu Mar 06, 2003 3:11 pm

hmmm I remember someone (maybe me :)) having this problem at the beginning.

I suggest you get the crt0.S and lnkscript from Jeff Frowheim (grab them on the net), put them in your current project directory, and try something like :

/path/to/devkitadv/bin/arm-agb-elf-as -mthumb-interwork -o crt0.o crt0.S
/path/to/devkitadv/bin/arm-agb-elf-gcc -mthumb-interwork -c test.c

and finally :

/path/to/devkitadv/bin/arm-agb-elf-gcc -o test.elf crt0.o test.o -Wl,-Map test.map -nostartfiles -Tlnkscript

with maybe some -I... and -L... directives according to you environment setup.

the mapfile generated "test.map" is useful to understand where will be located your code and data.

Hope this helps.

#3726 - tHe_pUnK - Thu Mar 06, 2003 6:23 pm

forgot to mention that i've already removed all instances of crt0.o from all the devkitadvance dirs and i have Jeff's crt0 and lnkscript which i asm'd using:

arm-agb-elf-as -mthumb-interwork CRT0.S -o crt0.o

no errors there. i have that in my project dir when i ran the initial gcc command. I tried your method and i get this...
arm-agb-elf-gcc: test.map: No such file or directory

i'm not too sure what test.map is for. I feel i'm getting really close this is all i would need to get started as i've done a couple of dovoto's tutorials in the past when i was using m$ ;p - tHe_pUnK

#3727 - dragor - Thu Mar 06, 2003 6:38 pm

In this section of the like -Wl,-Map test.map Make sure there is no space betweel -Wl, and -Map. That's a common source of errors and may be what's causing your problem with the compiler saying test.map isn't found.
_________________
Sum Ergo Cogito

#3742 - tHe_pUnK - Fri Mar 07, 2003 8:17 am

Ok this is getting frustrating now... After i read your comments i proceeded to try something. i ran across the -nostartfiles ant -Tlnkscript params which i included and also a -lm at the end for the math library used by my headers...it compiled fine with the exception of a couple warnings of extern usage with my gfx files...did an objcopy and voila!! hurrah!

So...

I come home from school, move my lnkscript and crt0.o to the devkitadv dir for future usage retest and my code and now i get a
ld: warning: cannot find entry symbol _start; defaulting to 08000000
at the end of my gcc and after an objcopy i get a blank screen!@#!@@#!#!@

frustrating...some help PLEASE!!! - tHe_pUnK

#3743 - Torlus - Fri Mar 07, 2003 10:06 am

This last message isn't important. 0x8000000 is the default right location if you want to run your code on hardware from a flash cart. If you use a multiboot cable, then you have to set it to 0x2000000.
I think you should explain mre precisely what is working where or not. You seem to test it on two different configurations, and do you test it on hardware or emu ?

#3750 - tHe_pUnK - Fri Mar 07, 2003 5:27 pm

Ok after a few more hours of testing...It seems that i only get that 08000000 error when using the NEW crtls.zip version 1.3 from devrs.com however it seems i have a different crtls version which is also version 1.3 that works. Sorry for not clarifying very much before but i will eventually be testing on hardware. I have the first FALinker with 64M cart that came out from visoly(the big gameboy size one). Currently i test it on emu's: visualboyadvance and boycott advance(linux versions).
ok i just did a diff command on both crt0.s and lnkscript. crt0.s are exactly identical...however it seems i have two different lnkscript's even though they state version 1.3
The one that works has the line:
STARTUP(crt0.o)

after ENTRY(_start) where the one from the crtls.zip doesn't....I take it this line reads crt0.o as it's startup file?? (I'm not too sure i understand how lnkscript and crt0.o work completely) anyhow i'm just going to add that line to my backup copy of lnkscript for future use so I should be able to start coding now...I have one more quick question which probly has more to do with the newer gcc version.
I also get a
master.pal.c:1: warning: `master_Palette' initialized and declared `extern'
as well as the picture.raw.c file...is extern not needed anymore for pictures? Thanks for ALL of your help guys I really appreciate getting answers! - tHe_pUnK