This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: ARM crt.. files
- To: Richard Henderson <rth@cygnus.com>
- Subject: Re: ARM crt.. files
- From: Roland McGrath <roland@frob.com>
- Date: Mon, 29 Jun 1998 13:13:40 -0400
- Cc: Philip Blundell <philb@gnu.org>, libc-hacker@gnu.org
> 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.