ARM crt.. files
Roland McGrath
roland@frob.com
Mon Jun 29 10:13:00 GMT 1998
> SECTIONS
> {
> .init : { *(.init.prologue) }
> .fini : { *(.fini.prologue) }
> /DISCARD/ : { *(.init.epilogue) *(.fini.epilogue) *(.garbage) }
> }
A ha! I was to quick in my skimming of the documentation, and there is no
index entry for DISCARD.
> It is also necesary to strip the future crtn.o (ld -s) because
> the _init and _fini symbols will still be present even though
> their defining section is removed (arguably a bug in ld).
Good point; I hadn't bothered looking at the symbol tables.
> I also recommend the following init-fini.c, where ALIGN_INIT_CODE
> should come from some target header. The align is necessary to
> get the assembler to insert the proper nops. The change to
> i_am_not_a_leaf prevents us from having to remove it from the
> symbol table.
As you can see in the patch I posted, I took another approach. That is, I
do ld -r --verbose and massage the output to produce a linker script that
is a modified version of the default ld -r script; this gets the =FILL on
the .init and .fini sections for the right nop pattern, and then ALIGN in
the linker script can do the right thing.
More information about the Libc-hacker
mailing list