[PATCH] RISC-V: Disable shared library support for embedded elf.

Jim Wilson jimw@sifive.com
Fri Jan 5 22:31:00 GMT 2018


Runnning the linker testsuite with a proper cross compiler in place shows over
160 unexpected failures for riscv32-elf and riscv64-elf.  These are all tests
trying to build and use shared libraries, but getting relocation errors on
newlib startfiles, because we don't have shared library support there.  I don't
think we need it, at least not at the moment.  So this just stops setting
GENERATE_SHLIB_SCRIPT and GENERATE_PIE_SCRIPT for embedded elf targets.

This was tested with riscv{32,64}-{elf,linux} targets on check-binutils,
check-gas, and check-ld.  There were no changes to the linux results.  The
elf ld results dropped by over 150 and the other testsuites had no change.

I also tested this by verifying that ld -shared gave the expected result with
all four linkers.

Committed.

Jim

	ld/
	* emulparams/elf32lriscv-defs.sh (GENERATE_SHLIB_SCRIPT): Move inside
	case on $target, and don't set for riscv*-elf targets.
	(GENERATE_PIE_SCRIPT): Likewise.
---
 ld/emulparams/elf32lriscv-defs.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ld/emulparams/elf32lriscv-defs.sh b/ld/emulparams/elf32lriscv-defs.sh
index 29ed6d8542..f373eced89 100644
--- a/ld/emulparams/elf32lriscv-defs.sh
+++ b/ld/emulparams/elf32lriscv-defs.sh
@@ -16,8 +16,15 @@ if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
   esac
 fi
 
-GENERATE_SHLIB_SCRIPT=yes
-GENERATE_PIE_SCRIPT=yes
+# Enable shared library support for everything except an embedded elf target.
+case "$target" in
+  riscv*-elf)
+    ;;
+  *)
+    GENERATE_SHLIB_SCRIPT=yes
+    GENERATE_PIE_SCRIPT=yes
+    ;;
+esac
 
 TEXT_START_ADDR=0x10000
 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
-- 
2.14.1



More information about the Binutils mailing list