This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Define various symbols conditionally in shared libraries executables
- From: Nick Clifton <nickc at redhat dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, "amodra at gmail dot com" <amodra at gmail dot com>
- Cc: nd <nd at arm dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 12 Jun 2018 12:44:27 +0100
- Subject: Re: Define various symbols conditionally in shared libraries executables
- References: <DB5PR08MB103043B6C25B271BA935B97683780@DB5PR08MB1030.eurprd08.prod.outlook.com>
Hi Wilco,
> ..binutils/ld/ld-new:built in linker script:160: syntax error
>
> There are around 300 of these. Do you have an idea which builtin script this is?
The exact script used depends upon the command line options used to invoke
the linker. In this particular case it appears that the problem is triggered
by the "-shared" option:
% ./ld-new --verbose --shared
GNU ld (GNU Binutils) 2.30.52.20180612
./ld-new:built in linker script:160: syntax error
This translates to:
% cat aarch64elf.xsc
[...]
PROVIDE (_bss_end__ = .); __bss_end__ = .);
Where you can see that there is an extraneous closing parenthesis.
(The extension for the script file can be found in the comments in
the ld/genscripts.sh script in the linker sources. The script files
themselves can be found in the ld/ldscripts/ directory in your build
tree).
The script itself is the ld/scriptempl/elf.sc file in the linker sources
although the line in question is actually the invocation of the
OTHER_BSS_END_SYMBOLS macro which, for the aarch64, is defined in
ld/emulparams/aarch64elf.sh. It appears that the problem is a simple
typo:
OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; __bss_end__ = .${CREATE_SHLIB+)};"
The definition of the __bss_end__ symbol should be conditional upon CREATE_SHLIB
being defined. (As is done for the _bss_end__ symbol).
So I am checking in the obvious patch to fix this.
Cheers
Nick
ld/ChangeLog
2018-06-12 Nick Clifton <nickc@redhat.com>
* emulparams/aarch64elf.sh (OTHER_BSS_END_SYMBOLS): Make the
definition of the __bss_end__ symbol conditional upon CREATE_SHLIB.
diff --git a/ld/emulparams/aarch64elf.sh b/ld/emulparams/aarch64elf.sh
index deea7b4610..4a59342722 100644
--- a/ld/emulparams/aarch64elf.sh
+++ b/ld/emulparams/aarch64elf.sh
@@ -29,7 +29,7 @@ DATA_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__data_start = .${CREATE_SHLIB+)};"
NO_SMALL_DATA=yes
OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__bss_start__ = .${CREATE_SHLIB+)};"
-OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; __bss_end__ = .${CREATE_SHLIB+)};"
+OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; ${CREATE_SHLIB+PROVIDE (}__bss_end__ = .${CREATE_SHLIB+)};"
OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'