As discussed at <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65711>.
Patch is for both 4.8 and 4.9 (possibly 5.1 too, I haven’t checked.)
Tested on armhf-linux-gnu (armv7.)
gcc/
2015-04-23 Ludovic Courtès <[email protected]>
PR 65711
* config/arm/linux-elf.h (LINUX_TARGET_LINK_SPEC): Move
'-dynamic-linker' within %{!shared: ...}.
--- gcc-4.8.4/gcc/config/arm/linux-elf.h 2015-04-08 20:31:20.376900478 +0200
+++ gcc-4.8.4/gcc/config/arm/linux-elf.h 2015-04-08 20:31:36.437014437 +0200
@@ -65,7 +65,7 @@
%{symbolic:-Bsymbolic} \
%{!static: \
%{rdynamic:-export-dynamic} \
- -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
+ %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
-X \
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC