public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED PATCH] respect -Ttext-segment for rodata placement on *-*-nacl* targets
@ 2012-12-11 22:24 Roland McGrath
  0 siblings, 0 replies; only message in thread
From: Roland McGrath @ 2012-12-11 22:24 UTC (permalink / raw)
  To: binutils

For *-*-nacl* targets, the rodata segment's address was always intended to
be a fixed offset from the text segment, not a fixed absolute address.
This makes it use SEGMENT_START("text-segment", ...) in its calculation.

Committed to trunk and 2.23 branch.


Thanks,
Roland


ld/
2012-12-11  Roland McGrath  <mcgrathr@google.com>

	* emulparams/elf_nacl.sh (nacl_rodata_addr): New shell function.
	(RODATA_ADDR, SHLIB_RODATA_ADDR): Use it to base the calculation
	on SEGMENT_START("text-segment", ...) rather than ... alone.
	* Makefile.am (earmelf_nacl.c, earmelfb_nacl.c): Add missing
	dependency on $(srcdir)/emulparams/elf_nacl.sh.
	* Makefile.in: Regenerate.

--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -725,6 +725,7 @@ earmelf_linux_eabi.c:
$(srcdir)/emulparams/armelf_linux_eabi.sh \
 earmelf_nacl.c: $(srcdir)/emulparams/armelf_nacl.sh \
   $(srcdir)/emulparams/armelf_linux_eabi.sh \
   $(srcdir)/emulparams/armelf_linux.sh \
+  $(srcdir)/emulparams/elf_nacl.sh \
   $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armelf_nacl "$(tdir_armelf_nacl)"
@@ -758,6 +759,7 @@ earmelfb_nacl.c: $(srcdir)/emulparams/armelfb_nacl.sh \
   $(srcdir)/emulparams/armelf_nacl.sh \
   $(srcdir)/emulparams/armelf_linux_eabi.sh \
   $(srcdir)/emulparams/armelf_linux.sh \
+  $(srcdir)/emulparams/elf_nacl.sh \
   $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armelfb_nacl "$(tdir_armelfb_nacl)"
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -2198,6 +2198,7 @@ earmelf_linux_eabi.c:
$(srcdir)/emulparams/armelf_linux_eabi.sh \
 earmelf_nacl.c: $(srcdir)/emulparams/armelf_nacl.sh \
   $(srcdir)/emulparams/armelf_linux_eabi.sh \
   $(srcdir)/emulparams/armelf_linux.sh \
+  $(srcdir)/emulparams/elf_nacl.sh \
   $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armelf_nacl "$(tdir_armelf_nacl)"
@@ -2231,6 +2232,7 @@ earmelfb_nacl.c: $(srcdir)/emulparams/armelfb_nacl.sh \
   $(srcdir)/emulparams/armelf_nacl.sh \
   $(srcdir)/emulparams/armelf_linux_eabi.sh \
   $(srcdir)/emulparams/armelf_linux.sh \
+  $(srcdir)/emulparams/elf_nacl.sh \
   $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} armelfb_nacl "$(tdir_armelfb_nacl)"
--- a/ld/emulparams/elf_nacl.sh
+++ b/ld/emulparams/elf_nacl.sh
@@ -2,5 +2,13 @@ ENABLE_INITFINI_ARRAY=yes
 SEPARATE_CODE=yes
 TEXT_START_ADDR=0x20000
 NACL_RODATA_DISTANCE=0x10000000
-RODATA_ADDR="${TEXT_START_ADDR} + ${NACL_RODATA_DISTANCE} + SIZEOF_HEADERS"
-SHLIB_RODATA_ADDR="${NACL_RODATA_DISTANCE} + SIZEOF_HEADERS"
+
+nacl_rodata_addr()
+{
+  nacl_text_addr="SEGMENT_START(\"text-segment\", $1)"
+  nacl_rodata_addr="$nacl_text_addr + ${NACL_RODATA_DISTANCE} + SIZEOF_HEADERS"
+  echo "$nacl_rodata_addr"
+}
+
+RODATA_ADDR=`nacl_rodata_addr "${TEXT_START_ADDR}"`
+SHLIB_RODATA_ADDR=`nacl_rodata_addr 0`

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-11 22:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-11 22:24 [COMMITTED PATCH] respect -Ttext-segment for rodata placement on *-*-nacl* targets Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).