This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
link script PROVIDE bugfix
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Wed, 3 Aug 2005 14:41:11 +0930
- Subject: link script PROVIDE bugfix
A bugfix for expressions like "PROVIDE(sym=ADDR(sec))", and renaming of
a link script shell var. I renamed because ${LARGE_SECTIONS} intervenes
between .bss end syms and _end. Some caution is needed if using to
define .bss syms.
* ldlang.c (exp_init_os): Handle etree_provide.
* emulparams/armelf.sh (OTHER_END_SYMBOLS): Rename from..
(OTHER_BSS_END_SYMBOLS): ..this.
* emulparams/armelf_linux.sh: Likewise.
* emulparams/armnto.sh: Likewise.
* emulparams/criself.sh: Likewise.
* emulparams/crislinux.sh: Likewise.
* emulparams/elf32frv.sh: Likewise.
* emulparams/elf32mcore.sh: Likewise.
* emulparams/elf32ppc.sh: Likewise.
* emulparams/elf32ppclinux.sh: Likewise.
* emulparams/hppa64linux.sh: Likewise.
* scripttempl/armbpabi.sc: Substitute $OTHER_END_SYMBOLS, not
$OTHER_BSS_END_SYMBOLS.
* scripttempl/elf32sh-symbian.sc: Likewise.
* scripttempl/elf_chaos.sc: Likewise.
* scripttempl/iq2000.sc: Likewise.
* scripttempl/xstormy16.sc: Likewise.
* scripttempl/elf.sc: Likewise. Delete __bss_start comment.
* scripttempl/elfxtensa.sc: Likewise.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.193
diff -u -p -r1.193 ldlang.c
--- ld/ldlang.c 28 Jul 2005 20:08:15 -0000 1.193
+++ ld/ldlang.c 3 Aug 2005 03:58:14 -0000
@@ -1616,6 +1616,7 @@ exp_init_os (etree_type *exp)
switch (exp->type.node_class)
{
case etree_assign:
+ case etree_provide:
exp_init_os (exp->assign.src);
break;
Index: ld/emulparams/armelf.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/armelf.sh,v
retrieving revision 1.14
diff -u -p -r1.14 armelf.sh
--- ld/emulparams/armelf.sh 27 Oct 2004 06:57:43 -0000 1.14
+++ ld/emulparams/armelf.sh 3 Aug 2005 03:58:14 -0000
@@ -8,7 +8,7 @@ TEMPLATE_NAME=elf32
EXTRA_EM_FILE=armelf
OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
OTHER_BSS_SYMBOLS='__bss_start__ = .;'
-OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+OTHER_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
OTHER_READONLY_SECTIONS="
.ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) }
Index: ld/emulparams/armelf_linux.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/armelf_linux.sh,v
retrieving revision 1.13
diff -u -p -r1.13 armelf_linux.sh
--- ld/emulparams/armelf_linux.sh 17 May 2005 15:16:55 -0000 1.13
+++ ld/emulparams/armelf_linux.sh 3 Aug 2005 03:58:14 -0000
@@ -13,7 +13,7 @@ GENERATE_PIE_SCRIPT=yes
DATA_START_SYMBOLS='__data_start = . ;';
OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
OTHER_BSS_SYMBOLS='__bss_start__ = .;'
-OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+OTHER_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
TEXT_START_ADDR=0x00008000
Index: ld/emulparams/armnto.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/armnto.sh,v
retrieving revision 1.2
diff -u -p -r1.2 armnto.sh
--- ld/emulparams/armnto.sh 9 Oct 2003 14:06:07 -0000 1.2
+++ ld/emulparams/armnto.sh 3 Aug 2005 03:58:14 -0000
@@ -8,7 +8,7 @@ TEMPLATE_NAME=elf32
EXTRA_EM_FILE=armelf
OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7)'
OTHER_BSS_SYMBOLS='__bss_start__ = .;'
-OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+OTHER_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
DATA_START_SYMBOLS='__data_start = . ;';
Index: ld/emulparams/criself.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/criself.sh,v
retrieving revision 1.7
diff -u -p -r1.7 criself.sh
--- ld/emulparams/criself.sh 4 Nov 2004 15:01:40 -0000 1.7
+++ ld/emulparams/criself.sh 3 Aug 2005 03:58:14 -0000
@@ -42,7 +42,7 @@ OTHER_SDATA_SECTIONS="${RELOCATING+PROVI
# address, we can't get to it with OTHER_BSS_SYMBOLS, neither can we
# use ADDR(.bss) there. Instead, we use the symbol support for the
# end symbol.
-OTHER_BSS_END_SYMBOLS='
+OTHER_END_SYMBOLS='
PROVIDE (__Ebss = .);
PROVIDE (__end = .);
__Sbss = ADDR (.bss);
Index: ld/emulparams/crislinux.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/crislinux.sh,v
retrieving revision 1.7
diff -u -p -r1.7 crislinux.sh
--- ld/emulparams/crislinux.sh 4 Dec 2001 18:28:31 -0000 1.7
+++ ld/emulparams/crislinux.sh 3 Aug 2005 03:58:14 -0000
@@ -28,7 +28,7 @@ DATA_START_SYMBOLS='PROVIDE (__Sdata = .
# Smuggle an "OTHER_DATA_END_SYMBOLS" here.
OTHER_SDATA_SECTIONS="${RELOCATING+PROVIDE (__Edata = .);}"
OTHER_BSS_SYMBOLS='PROVIDE (__Sbss = .);'
-OTHER_BSS_END_SYMBOLS='PROVIDE (__Ebss = .);'
+OTHER_END_SYMBOLS='PROVIDE (__Ebss = .);'
# Also add the other symbols provided for rsim/xsim and elinux.
OTHER_END_SYMBOLS='
Index: ld/emulparams/elf32frv.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32frv.sh,v
retrieving revision 1.3
diff -u -p -r1.3 elf32frv.sh
--- ld/emulparams/elf32frv.sh 6 Jan 2004 19:19:52 -0000 1.3
+++ ld/emulparams/elf32frv.sh 3 Aug 2005 03:58:15 -0000
@@ -7,7 +7,7 @@ MAXPAGESIZE=256
ENTRY=_start
EMBEDDED=yes
OTHER_EXCLUDE_FILES='*frvend.o'
-OTHER_BSS_END_SYMBOLS='__end = .;'
+OTHER_END_SYMBOLS='__end = .;'
DATA_START_SYMBOLS='__data_start = . ;'
STACK_ADDR=0x200000
NOP=0x80000000
Index: ld/emulparams/elf32mcore.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32mcore.sh,v
retrieving revision 1.12
diff -u -p -r1.12 elf32mcore.sh
--- ld/emulparams/elf32mcore.sh 28 Jun 2003 05:28:54 -0000 1.12
+++ ld/emulparams/elf32mcore.sh 3 Aug 2005 03:58:15 -0000
@@ -22,7 +22,7 @@ EMBEDDED=yes
NOP=0x0e0e0e0e
OTHER_BSS_SYMBOLS="__bss_start__ = . ;"
-OTHER_BSS_END_SYMBOLS="__bss_end__ = . ;"
+OTHER_END_SYMBOLS="__bss_end__ = . ;"
# This sets the stack to the top of the simulator memory (2^19 bytes).
STACK_ADDR=0x80000
Index: ld/emulparams/elf32ppc.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32ppc.sh,v
retrieving revision 1.16
diff -u -p -r1.16 elf32ppc.sh
--- ld/emulparams/elf32ppc.sh 5 Jul 2005 13:25:56 -0000 1.16
+++ ld/emulparams/elf32ppc.sh 3 Aug 2005 03:58:15 -0000
@@ -23,7 +23,7 @@ PLT=".plt ${RELOCATING-0} : SPE
GOTPLT="${PLT}"
OTHER_TEXT_SECTIONS="*(.glink)"
EXECUTABLE_SYMBOLS='PROVIDE (__stack = 0); PROVIDE (___stack = 0);'
-OTHER_BSS_END_SYMBOLS='__end = .;'
+OTHER_END_SYMBOLS="__end = .;"
OTHER_RELRO_SECTIONS="
.fixup ${RELOCATING-0} : { *(.fixup) }
.got1 ${RELOCATING-0} : { *(.got1) }
Index: ld/emulparams/elf32ppclinux.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32ppclinux.sh,v
retrieving revision 1.7
diff -u -p -r1.7 elf32ppclinux.sh
--- ld/emulparams/elf32ppclinux.sh 16 Mar 2005 02:41:26 -0000 1.7
+++ ld/emulparams/elf32ppclinux.sh 3 Aug 2005 03:58:15 -0000
@@ -1,7 +1,7 @@
. ${srcdir}/emulparams/elf32ppc.sh
TEXT_START_ADDR=0x10000000
unset EXECUTABLE_SYMBOLS
-unset OTHER_BSS_END_SYMBOLS
+unset OTHER_END_SYMBOLS
test -z "${RELOCATING}" || OTHER_SECTIONS="/DISCARD/ : { *(.fixup) }"
OTHER_RELRO_SECTIONS="
.got1 ${RELOCATING-0} : { *(.got1) }
Index: ld/emulparams/hppa64linux.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/hppa64linux.sh,v
retrieving revision 1.4
diff -u -p -r1.4 hppa64linux.sh
--- ld/emulparams/hppa64linux.sh 5 Jul 2004 20:00:12 -0000 1.4
+++ ld/emulparams/hppa64linux.sh 3 Aug 2005 03:58:15 -0000
@@ -34,8 +34,8 @@ OTHER_BSS_SECTIONS="
.hbss ${RELOCATING-0} : { *(.hbss) }
.tbss ${RELOCATING-0} : { *(.tbss) }
"
-#OTHER_BSS_END_SYMBOLS='PROVIDE (__TLS_SIZE = SIZEOF (.tbss));'
-OTHER_BSS_END_SYMBOLS='
+#OTHER_END_SYMBOLS='PROVIDE (__TLS_SIZE = SIZEOF (.tbss));'
+OTHER_END_SYMBOLS='
PROVIDE (__TLS_SIZE = 0);
PROVIDE (__TLS_INIT_SIZE = 0);
PROVIDE (__TLS_INIT_START = 0);
Index: ld/scripttempl/armbpabi.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/armbpabi.sc,v
retrieving revision 1.7
diff -u -p -r1.7 armbpabi.sc
--- ld/scripttempl/armbpabi.sc 18 Mar 2005 16:55:44 -0000 1.7
+++ ld/scripttempl/armbpabi.sc 3 Aug 2005 03:58:20 -0000
@@ -296,7 +296,7 @@ cat <<EOF
${OTHER_BSS_SECTIONS}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+_end = .;}
- ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+ ${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+PROVIDE (end = .);}
${RELOCATING+${DATA_SEGMENT_END}}
Index: ld/scripttempl/elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.61
diff -u -p -r1.61 elf.sc
--- ld/scripttempl/elf.sc 25 Jul 2005 15:41:08 -0000 1.61
+++ ld/scripttempl/elf.sc 3 Aug 2005 03:58:21 -0000
@@ -415,8 +435,6 @@ cat <<EOF
${SDATA}
${OTHER_SDATA_SECTIONS}
${RELOCATING+${DATA_END_SYMBOLS-_edata = .; PROVIDE (edata = .);}}
- /* __bss_start is used by _bfd_elf_provide_section_bound_symbols in
- elflink.c. */
${RELOCATING+__bss_start = .;}
${RELOCATING+${OTHER_BSS_SYMBOLS}}
${SBSS}
@@ -435,9 +453,9 @@ cat <<EOF
}
${LBSS}
${OTHER_BSS_SECTIONS}
- ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
${LARGE_SECTIONS}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+_end = .;}
${RELOCATING+PROVIDE (end = .);}
${RELOCATING+${DATA_SEGMENT_END}}
Index: ld/scripttempl/elf32sh-symbian.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf32sh-symbian.sc,v
retrieving revision 1.1
diff -u -p -r1.1 elf32sh-symbian.sc
--- ld/scripttempl/elf32sh-symbian.sc 6 Jul 2004 16:58:37 -0000 1.1
+++ ld/scripttempl/elf32sh-symbian.sc 3 Aug 2005 03:58:21 -0000
@@ -260,7 +260,7 @@ SECTIONS
${OTHER_BSS_SECTIONS}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+_end = .;}
- ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+ ${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+PROVIDE (end = .);}
${RELOCATING+${DATA_SEGMENT_END}}
Index: ld/scripttempl/elf_chaos.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf_chaos.sc,v
retrieving revision 1.2
diff -u -p -r1.2 elf_chaos.sc
--- ld/scripttempl/elf_chaos.sc 14 Apr 2003 13:03:17 -0000 1.2
+++ ld/scripttempl/elf_chaos.sc 3 Aug 2005 03:58:21 -0000
@@ -301,7 +301,7 @@ cat <<EOF
${OTHER_BSS_SECTIONS}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+_end = .;}
- ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+ ${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+PROVIDE (end = .);}
/* Stabs debugging sections. */
Index: ld/scripttempl/elfxtensa.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elfxtensa.sc,v
retrieving revision 1.4
diff -u -p -r1.4 elfxtensa.sc
--- ld/scripttempl/elfxtensa.sc 12 May 2005 00:31:22 -0000 1.4
+++ ld/scripttempl/elfxtensa.sc 3 Aug 2005 03:58:21 -0000
@@ -390,8 +390,6 @@ cat <<EOF
${SDATA}
${OTHER_SDATA_SECTIONS}
${RELOCATING+${DATA_END_SYMBOLS-_edata = .; PROVIDE (edata = .);}}
- /* __bss_start is used by _bfd_elf_provide_section_bound_symbols in
- elflink.c. */
${RELOCATING+__bss_start = .;}
${RELOCATING+${OTHER_BSS_SYMBOLS}}
${SBSS}
@@ -409,7 +407,7 @@ cat <<EOF
${OTHER_BSS_SECTIONS}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+_end = .;}
- ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+ ${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+PROVIDE (end = .);}
${RELOCATING+${DATA_SEGMENT_END}}
Index: ld/scripttempl/iq2000.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/iq2000.sc,v
retrieving revision 1.2
diff -u -p -r1.2 iq2000.sc
--- ld/scripttempl/iq2000.sc 14 Apr 2003 13:03:17 -0000 1.2
+++ ld/scripttempl/iq2000.sc 3 Aug 2005 03:58:21 -0000
@@ -391,7 +391,7 @@ cat <<EOF
${RELOCATING+${OTHER_BSS_SECTIONS}}
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+_end = .;}
- ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+ ${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+PROVIDE (end = .);}
/* Stabs debugging sections. */
Index: ld/scripttempl/xstormy16.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/xstormy16.sc,v
retrieving revision 1.6
diff -u -p -r1.6 xstormy16.sc
--- ld/scripttempl/xstormy16.sc 29 Sep 2004 16:46:00 -0000 1.6
+++ ld/scripttempl/xstormy16.sc 3 Aug 2005 03:58:21 -0000
@@ -148,7 +148,7 @@ SECTIONS
${RELOCATING+. = ALIGN(${ALIGNMENT});}
${RELOCATING+_end = .;}
${RELOCATING+__stack = .;}
- ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+ ${RELOCATING+${OTHER_END_SYMBOLS}}
${RELOCATING+PROVIDE (end = .);}
/* Read-only sections in ROM. */
--
Alan Modra
IBM OzLabs - Linux Technology Centre