This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Reserve a few .dynamic entries


Hi!

As .dynamic section is usually located in between sections which may have
relocated relocations against, it is not possible after final link to insert
new .dynamic entries which e.g. prelinking needs to do.

The following patch inserts 6 DT_NULL ElfW(Dyn) entries at the end of
.dynamic (iff .dynamic section is created), so that post-link utilities can
just put the tags they need into those slots and don't have to copy the
whole .dynamic somewhere else (which would require new PT_LOAD segment
usually). It wastes 48 resp. 96 bytes if no prelinking or any other
post-link optimization is done.

Do you agree with this? Can I commit it?

2001-06-06  Jakub Jelinek  <jakub@redhat.com>

	* scripttempl/elf.sc (DYNAMIC): Reserve 6 ElfW(Dyn) entries for
	post-linking tools.

--- ld/scripttempl/elf.sc.jj	Sat Sep  2 22:43:22 2000
+++ ld/scripttempl/elf.sc	Wed Jun  6 17:59:17 2001
@@ -66,7 +66,7 @@ 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) }"
+DYNAMIC=".dynamic     ${RELOCATING-0} : { *(.dynamic) ${RELOCATING+FILL(0) . += 6 * ${ELFSIZE} / 4; } }"
 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]