> 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.
I should have remembered that I already dealt with this problem long ago -- gold defers the layout of all real objects that follow the first claimed IR file until after the replacement files have been laid out. With respect to physical layout of the sections, this effectively makes the link order equivalent to putting the replacement files in the place of the first IR file. No "endcap" option is necessary. -cary