Hello, I would like to use virtual methods in my C++-project. Then I link the project with the following linker script, the shows alot of errors: Linking arm_gcctest.elf ... arm-elf-gcc -mcpu=arm7tdmi -gstabs -finline --verbose -Wl,--start-group main.o menuTask.o ../rtos/CPPstartup.o ../datamodel/arm/libdatamodel.a ../dcIIIcontrol/arm/libdcIIIcontrol.a ../menucontrol/arm/libmenucontrol.a ../debugLog/arm/libdebugLog.a ../common/arm/libcommon.a ../rtos/arm/librtos.a -Wl,--end-group --output arm_gcctest.elf -nostartfiles -Wl,-Map=arm_gcctest.map,--cref -T../rtos/AT91SAM7S256-ROM.ld --verbose all: == Building target all in . == all: == Building target all in datamodel/ == all: == Building target all in dcIIIcontrol/ == all: == Building target all in menucontrol/ == all: == Building target all in debugLog/ == all: == Building target all in common/ == all: == Building target all in rtos/ == all: == Building target all in main/ == Using built-in specs. Target: arm-elf Configured with: ../../gcc-4.0.1/configure --enable-languages=c,c++ --enable-interwork --enable-multilib --with-gcc --with-gnu-ld --with-gnu-as --with-stabs --disable-shared --disable-threads --disable-win32-registry --disable-nls --target=arm-elf --with-newlib --prefix=c:/WinARM -v Thread model: single gcc version 4.0.1 (WinARM) c:/winarm/bin/../lib/gcc/arm-elf/4.0.1/../../../../arm-elf/bin/ld.exe -X -o arm_gcctest.elf -Lc:/winarm/bin/../lib/gcc/arm-elf/4.0.1 -Lc:/winarm/bin/../lib/gcc -Lc:/WinARM/lib/gcc/arm-elf/4.0.1 -Lc:/winarm/bin/../lib/gcc/arm-elf/4.0.1/../../../../arm-elf/lib -Lc:/WinARM/lib/gcc/arm-elf/4.0.1/../../../../arm-elf/lib --start-group main.o menuTask.o ../rtos/CPPstartup.o ../datamodel/arm/libdatamodel.a ../dcIIIcontrol/arm/libdcIIIcontrol.a ../menucontrol/arm/libmenucontrol.a ../debugLog/arm/libdebugLog.a ../common/arm/libcommon.a ../rtos/arm/librtos.a --end-group -Map=arm_gcctest.map --cref -lgcc -lg -lc -lgcc -T../rtos/AT91SAM7S256-ROM.ld c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.t._ZN8BaseMenu4initEv [00000000 -> 00000063] overlaps section startup [00000000 -> 0000004f] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI9StartMenu [00000064 -> 0000006f] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI8BaseMenu [00000070 -> 00000077] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS8BaseMenu [00000078 -> 00000083] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS9StartMenu [00000084 -> 0000008f] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV9StartMenu [00000090 -> 0000009b] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV8BaseMenu [0000009c -> 000000a7] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI8MainMenu [000000a8 -> 000000b3] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS8MainMenu [000000b4 -> 000000bf] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV8MainMenu [000000c0 -> 000000cb] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI18ManualBellRingMenu [000000cc -> 000000d7] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS18ManualBellRingMenu [000000d8 -> 000000ef] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV18ManualBellRingMenu [000000f0 -> 000000fb] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI12TouchOffMenu [000000fc -> 00000107] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS12TouchOffMenu [00000108 -> 00000117] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV12TouchOffMenu [00000118 -> 00000123] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI24ClockBeatAndBellRingMenu [00000124 -> 0000012f] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS24ClockBeatAndBellRingMenu [00000130 -> 0000014b] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV24ClockBeatAndBellRingMenu [0000014c -> 00000157] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI25ImmediateBellRingProgMenu [00000158 -> 00000163] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS25ImmediateBellRingProgMenu [00000164 -> 0000017f] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV25ImmediateBellRingProgMenu [00000180 -> 0000018b] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI13InputBellMenu [0000018c -> 00000197] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS13InputBellMenu [00000198 -> 000001a7] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV13InputBellMenu [000001a8 -> 000001b3] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTI17InputDurationMenu [000001b4 -> 000001bf] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTS17InputDurationMenu [000001c0 -> 000001d3] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: section .gnu.linkonce.r._ZTV17InputDurationMenu [000001d4 -> 000001df] overlaps section prog [00000050 -> 0000e003] c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.t._ZN8BaseMenu4initEv lma 0x0 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section prog lma 0x50 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI9StartMenu lma 0x64 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI8BaseMenu lma 0x70 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS8BaseMenu lma 0x78 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS9StartMenu lma 0x84 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV9StartMenu lma 0x90 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV8BaseMenu lma 0x9c overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI8MainMenu lma 0xa8 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS8MainMenu lma 0xb4 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV8MainMenu lma 0xc0 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI18ManualBellRingMenu lma 0xcc overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS18ManualBellRingMenu lma 0xd8 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV18ManualBellRingMenu lma 0xf0 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI12TouchOffMenu lma 0xfc overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS12TouchOffMenu lma 0x108 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV12TouchOffMenu lma 0x118 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI24ClockBeatAndBellRingMenu lma 0x124 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS24ClockBeatAndBellRingMenu lma 0x130 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV24ClockBeatAndBellRingMenu lma 0x14c overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI25ImmediateBellRingProgMenu lma 0x158 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS25ImmediateBellRingProgMenu lma 0x164 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV25ImmediateBellRingProgMenu lma 0x180 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI13InputBellMenu lma 0x18c overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS13InputBellMenu lma 0x198 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV13InputBellMenu lma 0x1a8 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTI17InputDurationMenu lma 0x1b4 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTS17InputDurationMenu lma 0x1c0 overlaps previous sections c:\winarm\bin\..\lib\gcc\arm-elf\4.0.1\..\..\..\..\arm-elf\bin\ld.exe: arm_gcctest.elf: section .gnu.linkonce.r._ZTV17InputDurationMenu lma 0x1d4 overlaps previous sections ../menucontrol/arm/libmenucontrol.a(StartMenu.o): In function `BaseMenu::init()': BaseMenu.h:48: undefined reference to `vtable for __cxxabiv1::__si_class_type_info' BaseMenu.h:48: undefined reference to `vtable for __cxxabiv1::__class_type_info' ../menucontrol/arm/libmenucontrol.a(MainMenu.o): In function `BaseMenu::init()': BaseMenu.h:48: undefined reference to `vtable for __cxxabiv1::__si_class_type_info' ../menucontrol/arm/libmenucontrol.a(ManualBellRingMenu.o): In function `BaseMenu::init()': BaseMenu.h:48: undefined reference to `vtable for __cxxabiv1::__si_class_type_info' ../menucontrol/arm/libmenucontrol.a(TouchOffMenu.o): In function `BaseMenu::init()': BaseMenu.h:48: undefined reference to `vtable for __cxxabiv1::__si_class_type_info' ../menucontrol/arm/libmenucontrol.a(ClockBeatAndBellRingMenu.o): In function `BaseMenu::init()': BaseMenu.h:48: undefined reference to `vtable for __cxxabiv1::__si_class_type_info' ../menucontrol/arm/libmenucontrol.a(ImmediateBellRingProgMenu.o): In function `BaseMenu::init()': BaseMenu.h:48: undefined reference to `vtable for __cxxabiv1::__si_class_type_info' ../menucontrol/arm/libmenucontrol.a(InputBellMenu.o):BaseMenu.h:48: more undefined references to `vtable for __cxxabiv1::__si_class_type_info' follow make[1]: *** [arm_gcctest.elf] Error 1 make: *** [all] Error 1 ----- linker script -------------- MEMORY { flash : ORIGIN = 0x00000000, LENGTH = 256K ram : ORIGIN = 0x00200000, LENGTH = 64K } _stack_end_ = 0x00200000 + 64K - 4; SECTIONS { . = 0; startup : { *(.startup) /* Ab 0 Vector Table, Modul CPPstartup.s */ } >flash prog : { *(.text) *(.rodata) *(.rodata*) *(.glue_7) *(.glue_7t) } >flash /* .ctors .dtors are used for c++ constructors/destructors */ /* added by Martin Thomas 4/2005 based on Anglia Design example */ .ctors : { PROVIDE(_ctors_start_ = .); KEEP(*(SORT(.ctors.*))) KEEP(*(.ctors)) PROVIDE(_ctors_end_ = .); } >flash .dtors : { PROVIDE(_dtors_start_ = .); KEEP(*(SORT(.dtors.*))) KEEP(*(.dtors)) PROVIDE(_dtors_end_ = .); } >flash . = ALIGN(4); /* mthomas - end */ _end_of_text_ = .; .data : { _data_beg_ = .; _data_beg_src_ = _end_of_text_; *(.data) _data_end_ = .; } >ram AT>flash .bss : { _bss_beg_ = .; *(.bss) } >ram /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. */ . = ALIGN(32 / 8); } . = ALIGN(32 / 8); _end = .; bss_end_ = . ; _bss_end_ = . ; _end_ = . ; PROVIDE (end = .); Thanks Christian
It seems that there are some entries missing in the linker-script for "virtual functions" (...linkonce...). Take a look into the linker-script from the lpc2129-newlib_cpp-example in the WinARM examples-collection. If the information given there does not help: create a minimal example-project with all needed files (source-code, linker-script, makefile) where you see the error-messages, place it somewhere on an internet-server and give the URL. I will take a look into this if I have some time or others may jump in and try to help you. Martin Thomas
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.