public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Disable shared library support for embedded elf.
@ 2018-01-05 22:31 Jim Wilson
  2018-01-06  2:07 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Wilson @ 2018-01-05 22:31 UTC (permalink / raw)
  To: binutils; +Cc: Jim Wilson

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] RISC-V: Disable shared library support for embedded elf.
  2018-01-05 22:31 [PATCH] RISC-V: Disable shared library support for embedded elf Jim Wilson
@ 2018-01-06  2:07 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2018-01-06  2:07 UTC (permalink / raw)
  To: binutils; +Cc: Jim Wilson

On Fri, Jan 5, 2018 at 2:31 PM, Jim Wilson <jimw@sifive.com> wrote:
> 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 goofed here.  I originally wrote a patch for the binutils-2.29
branch and carefully tested it.  I then had to rewrite it as the
check_shared_library_support routine was changed, and no longer has an
explicit list of non-shared targets.  I was a little less careful in
testing the rewrite.  I saw the failures drop by over 150 and assumed
it worked.  But in fact I have 4 regressions for the embedded elf
targets.

There is one riscv specific test using -shared unnecessarily which is
easy to fix.

There are two riscv specific tests using -shared deliberately, I need
to conditionalize them on check_shared_library_support which is easy.

There is one generic elf test for --eh-frame-hdr that is failing.
This is ld-elf/eh-frame-hdr.d, and this is a little more complicated.
The --eh-frame-hdr option only exists if shared libraries are
supported, but the test is being run unconditionally.  I see that it
has an explicit list of xfail targets which is incomplete and
unscalable.  It should be run from shared.exp instead of from elf.exp,
as shared.exp calls check_shared_library_support.  However, elf.exp
has a glob on *.d, which means the test needs to be renamed and then
fit into shared.exp somehow which may require a little rewriting.

Jim

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-06  2:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-05 22:31 [PATCH] RISC-V: Disable shared library support for embedded elf Jim Wilson
2018-01-06  2:07 ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).