This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

INITIAL_READONLY_SECTIONS in elf.sc


This is a cosmetic change to make INITIAL_READONLY_SECTIONS in elf.sc
really set the first read-only section.  (It can't be initial can it,
if .interp comes first?)  In a target I've yet to commit, I make use
of INITIAL_READONLY_SECTIONS to define a section before .interp.

	* scripttempl/elf.sc (INTERP): Delete.  Move definition to..
	(INITIAL_READONLY_SECTIONS): ..here.
	* emulparams/criself.sh (INITIAL_READONLY_SECTIONS): Include .interp.
	* emulparams/elf32bmip.sh (INITIAL_READONLY_SECTIONS): Ditto.
	* emulparams/elf32bmipn32-defs.sh (INITIAL_READONLY_SECTIONS): Ditto.

Index: ld/scripttempl/elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.76
diff -u -p -r1.76 elf.sc
--- ld/scripttempl/elf.sc	24 Sep 2006 06:23:15 -0000	1.76
+++ ld/scripttempl/elf.sc	17 Oct 2006 13:44:17 -0000
@@ -103,7 +103,9 @@ if test -n "${COMMONPAGESIZE}"; then
   DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
   DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
 fi
-INTERP=".interp       ${RELOCATING-0} : { *(.interp) }"
+if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
+  INITIAL_READONLY_SECTIONS=".interp       ${RELOCATING-0} : { *(.interp) }"
+fi
 if test -z "$PLT"; then
   PLT=".plt          ${RELOCATING-0} : { *(.plt) }"
 fi
@@ -259,7 +261,6 @@ SECTIONS
   ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
   ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
   ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}}
-  ${CREATE_SHLIB-${INTERP}}
   ${INITIAL_READONLY_SECTIONS}
   ${TEXT_DYNAMIC+${DYNAMIC}}
   .hash         ${RELOCATING-0} : { *(.hash) }
Index: ld/emulparams/criself.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/criself.sh,v
retrieving revision 1.9
diff -u -p -r1.9 criself.sh
--- ld/emulparams/criself.sh	5 Aug 2005 04:29:56 -0000	1.9
+++ ld/emulparams/criself.sh	17 Oct 2006 13:44:16 -0000
@@ -13,7 +13,12 @@ ALIGNMENT=32
 TEXT_START_ADDR=0
 
 # Put crt0 for flash/eprom etc. in this section.
-INITIAL_READONLY_SECTIONS='.startup : { KEEP(*(.startup)) }'
+INITIAL_READONLY_SECTIONS=
+if test -z "${CREATE_SHLIB}"; then
+  INITIAL_READONLY_SECTIONS=".interp       ${RELOCATING-0} : { *(.interp) }"
+fi
+INITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS}
+  .startup : { KEEP(*(.startup)) }"
 
 # Setting __Stext to . in TEXT_START_SYMBOLS doesn't get what we want
 # most of the time, which is the start of all read-only sections;
Index: ld/emulparams/elf32bmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmip.sh,v
retrieving revision 1.12
diff -u -p -r1.12 elf32bmip.sh
--- ld/emulparams/elf32bmip.sh	29 Jul 2006 08:48:15 -0000	1.12
+++ ld/emulparams/elf32bmip.sh	17 Oct 2006 13:44:16 -0000
@@ -12,7 +12,11 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE
 NONPAGED_TEXT_START_ADDR=0x0400000
 SHLIB_TEXT_START_ADDR=0x5ffe0000
 TEXT_DYNAMIC=
-INITIAL_READONLY_SECTIONS="
+INITIAL_READONLY_SECTIONS=
+if test -z "${CREATE_SHLIB}"; then
+  INITIAL_READONLY_SECTIONS=".interp       ${RELOCATING-0} : { *(.interp) }"
+fi
+INITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS}
   .reginfo      ${RELOCATING-0} : { *(.reginfo) }
 "
 OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
Index: ld/emulparams/elf32bmipn32-defs.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmipn32-defs.sh,v
retrieving revision 1.11
diff -u -p -r1.11 elf32bmipn32-defs.sh
--- ld/emulparams/elf32bmipn32-defs.sh	16 Oct 2006 21:34:25 -0000	1.11
+++ ld/emulparams/elf32bmipn32-defs.sh	17 Oct 2006 13:44:16 -0000
@@ -57,7 +57,12 @@ TEXT_START_SYMBOLS='_ftext = . ;'
 DATA_START_SYMBOLS='_fdata = . ;'
 OTHER_BSS_SYMBOLS='_fbss = .;'
 
-INITIAL_READONLY_SECTIONS=".reginfo      ${RELOCATING-0} : { *(.reginfo) }"
+INITIAL_READONLY_SECTIONS=
+if test -z "${CREATE_SHLIB}"; then
+  INITIAL_READONLY_SECTIONS=".interp       ${RELOCATING-0} : { *(.interp) }"
+fi
+INITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS}
+  .reginfo      ${RELOCATING-0} : { *(.reginfo) }"
 # Discard any .MIPS.content* or .MIPS.events* sections.  The linker
 # doesn't know how to adjust them.
 OTHER_SECTIONS="/DISCARD/ : { *(.MIPS.content*) *(.MIPS.events*) }"

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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