This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFA: elf.sc patch
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Sat, 22 Jan 2005 18:15:59 +0000
- Subject: Re: RFA: elf.sc patch
- References: <87hdo2111f.fsf@redhat.com><20041107224825.GH21740@bubble.modra.org><20041108011636.GA21482@nevyn.them.org><20041108025455.GI21740@bubble.modra.org> <87r7mxa0rw.fsf@redhat.com><87sm4td9ru.fsf_-_@redhat.com><20050122133159.GA2793@bubble.modra.org>
Alan Modra <amodra@bigpond.net.au> writes:
> On Sat, Jan 22, 2005 at 10:43:17AM +0000, Richard Sandiford wrote:
>> * scripttempl/elf.sc: Insert ". = .;" before OTHER_GOT_SYMBOLS.
>
> I'd prefer you do this by modifying OTHER_GOT_SYMBOLS in elf32bmip.sh
> and elf32bmipn32-defs.sh, perhaps with a comment. OTHER_GOT_SYMBOLS
> may not always be used to only define symbols, and placing ".=.;" in the
> source close to where you assign a symbol value might clue future
> hackers to guard other random symbol assignments. Also, four other
> scripts use OTHER_GOT_SYMBOLS, so if you change elf.sc you really ought
> to change them too. Patch to emulparams/* preapproved.
OK, thanks, here's what I checked in.
Richard
* emulparams/elf32bmip.sh (OTHER_GOT_SECTIONS): Add ". = .;".
* emulparams/elf32bmipn32-defs.sh (OTHER_GOT_SECTIONS): Likewise.
Index: ld/emulparams/elf32bmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmip.sh,v
retrieving revision 1.6
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.6 elf32bmip.sh
*** ld/emulparams/elf32bmip.sh 21 Apr 2004 20:52:28 -0000 1.6
--- ld/emulparams/elf32bmip.sh 22 Jan 2005 18:08:18 -0000
*************** INITIAL_READONLY_SECTIONS="
*** 16,22 ****
--- 16,27 ----
.reginfo ${RELOCATING-0} : { *(.reginfo) }
"
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
+ # If the output has a GOT section, there must be exactly 0x7ff0 bytes
+ # between .got and _gp. The ". = ." below stops the orphan code from
+ # inserting other sections between the assignment to _gp and the start
+ # of .got.
OTHER_GOT_SYMBOLS='
+ . = .;
_gp = ALIGN(16) + 0x7ff0;
'
OTHER_SDATA_SECTIONS="
Index: ld/emulparams/elf32bmipn32-defs.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmipn32-defs.sh,v
retrieving revision 1.6
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.6 elf32bmipn32-defs.sh
*** ld/emulparams/elf32bmipn32-defs.sh 14 Feb 2004 11:45:25 -0000 1.6
--- ld/emulparams/elf32bmipn32-defs.sh 22 Jan 2005 18:08:18 -0000
*************** MAXPAGESIZE=0x100000
*** 36,42 ****
--- 36,47 ----
ENTRY=__start
# GOT-related settings.
+ # If the output has a GOT section, there must be exactly 0x7ff0 bytes
+ # between .got and _gp. The ". = ." below stops the orphan code from
+ # inserting other sections between the assignment to _gp and the start
+ # of .got.
OTHER_GOT_SYMBOLS='
+ . = .;
_gp = ALIGN(16) + 0x7ff0;
'
OTHER_SDATA_SECTIONS="