This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Reserve a few .dynamic entries (take 2)
On Wed, Jun 06, 2001 at 07:15:40PM +0200, Hans-Peter Nilsson wrote:
> > Date: Wed, 6 Jun 2001 18:13:38 +0200
> > From: Jakub Jelinek <jakub@redhat.com>
>
> > +DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) ${RELOCATING+FILL(0) . += 6 * ${ELFSIZE} / 4; } }"
>
> I think there should be a shell-variable (perhaps default on)
> that a ld emulation can (un)set, and which should be tested when
> adding that padding. And a comment.
Ok, is this better (ie. can I commit it)?
ld emulations which don't want the reserved entries can just set
DYNAMIC_PAD=" "
2001-06-08 Jakub Jelinek <jakub@redhat.com>
* scripttempl/elf.sc (DYNAMIC_PAD): New variable.
(DYNAMIC): Use it to reserve few dynamic entries for post-linking
tools.
--- ld/scripttempl/elf.sc.jj Sat Sep 2 22:43:22 2000
+++ ld/scripttempl/elf.sc Fri Jun 8 20:07:12 2001
@@ -32,6 +32,8 @@
# combination of .init sections.
# FINI_START, FINI_END - statements just before and just after
# combination of .fini sections.
+# DYNAMIC_PAD - script to insert pad at end of .dynamic section.
+# Setting this to " " will result in no .dynamic padding.
#
# When adding sections, do note that the names of some sections are used
# when specifying the start address of the next.
@@ -66,7 +68,14 @@ test -z "${ALIGNMENT}" && ALIGNMENT="${E
test "$LD_FLAG" = "N" && DATA_ADDR=.
INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
PLT=".plt ${RELOCATING-0} : { *(.plt) }"
-DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
+test -z "$DYNAMIC_PAD" && test -n "$RELOCATING" && DYNAMIC_PAD="
+ /* Leave some space in .dynamic section, so that
+ post-linking utilities can add new dynamic tags. */
+ FILL(0) . += 6 * ${ELFSIZE} / 4;"
+DYNAMIC=".dynamic ${RELOCATING-0} :
+ {
+ *(.dynamic) $DYNAMIC_PAD
+ }"
RODATA=".rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} }"
SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2) ${RELOCATING+*(.sbss2.*)} ${RELOCATING+*(.gnu.linkonce.sb2.*)} }"
SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2) ${RELOCATING+*(.sdata2.*)} ${RELOCATING+*(.gnu.linkonce.s2.*)} }"
Jakub