#16755 - dushan42 - Tue Feb 24, 2004 2:51 pm
Hi,
I'm trying (and failing) to get static constructors to work in the latest devkitARM (http://homepage.ntlworld.com/wintermute2002/)
I'm using Jeff's lnkscript and crt0.s (1.28) with '__CPPSupport' uncommented and '__MultiBootInclude' commented out.
I can compile and link if I don't try to link in crtbegin.o/crtend.o - but then none of the constructors for global objects get called.
If I link crtbegin.o and crtend.o, I get the following link error:
Any ideas?
I've got a fairly minimal makefile:
And even more minimal test program (test.cpp):
thanks,
Dushan
I'm trying (and failing) to get static constructors to work in the latest devkitARM (http://homepage.ntlworld.com/wintermute2002/)
I'm using Jeff's lnkscript and crt0.s (1.28) with '__CPPSupport' uncommented and '__MultiBootInclude' commented out.
I can compile and link if I don't try to link in crtbegin.o/crtend.o - but then none of the constructors for global objects get called.
If I link crtbegin.o and crtend.o, I get the following link error:
Code: |
d:/gba/dkarm/bin/arm-agb-elf-g++ -mthumb-interwork -mthumb -O2 -Wall -T lnkscript -nostartfiles crt0.o crtbegin.o crtend.o test.o -o test.elf d:\gba\dkarm\bin\..\lib\gcc-lib\arm-agb-elf\3.3.3\..\..\..\..\arm-agb-elf\bin\ld.exe: section .data [08000330 -> 0800033b] overlaps section .dtors [08000330 -> 08000337] collect2: ld returned 1 exit status d:\gba\dkarm\bin\..\lib\gcc-lib\arm-agb-elf\3.3.3\..\..\..\..\arm-agb-elf\bin\ld.exe: section .data [08000330 -> 0800033b] overlaps section .dtors [08000330 -> 08000337] |
Any ideas?
I've got a fairly minimal makefile:
Code: |
DKARM=d:/gba/dkarm GCC_BIN =$(DKARM)/bin GCC_PREFIX =arm-agb-elf- CXX =$(GCC_BIN)/$(GCC_PREFIX)g++ OBJCOPY =$(GCC_BIN)/$(GCC_PREFIX)objcopy CFLAGS =-mthumb-interwork -mthumb -O2 -Wall LDFLAGS =-T lnkscript -nostartfiles all: $(CXX) $(CFLAGS) -c test.cpp -o test.o $(CXX) -c crt0.s -o crt0.o $(CXX) $(CFLAGS) $(LDFLAGS) crt0.o crtbegin.o crtend.o test.o -o test.elf $(OBJCOPY) -O binary test.elf test.gba |
And even more minimal test program (test.cpp):
Code: |
class Test { public: Test(int value) : mValue(value) {} private: int mValue; }; Test gTest1(1); Test gTest2(2); int gInt = 3; int main() { Test test(4); gTest1 = test; while(true); // Halt } |
thanks,
Dushan