>> For the crtend files we could add a linker option that makes them >> known as endcaps, and the linker could make sure they get laid out >> last: >> >> ld ... -lc -lgcc ... --endcap crtend.o crtn.o >> >> That puts the special knowledge about those files back in the gcc driver. > > Hmm, yes. It doesn't work to just pass-through crtn.o, because ... > >> Executing on host: /home/davek/gcc/obj-gold2/gcc/xgcc >> -B/home/davek/gcc/obj-gold2/gcc/ c_lto_20100722-1_0.o -O0 -flto >> -flto-partition=none -fuse-linker-plugin -o gcc-dg-lto-20100722-1-01 >> (timeout = 300) >> gold: /home/davek/gcc/obj-gold2/gcc/crtbegin.o:(.text+0x13): error: >> undefined reference to '__DTOR_END__' >> collect2: ld returned 1 exit status >> compiler exited with status 1 >> output is: >> gold: /home/davek/gcc/obj-gold2/gcc/crtbegin.o:(.text+0x13): error: >> undefined reference to '__DTOR_END__' >> collect2: ld returned 1 exit status >> > > ... it's needed by the first pass of symbol resolution.
Yeah, that's why I originally suggested having the plugin claim it, so that the plugin could define the symbols when they need to be defined. -cary