This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] RISC-V: Fix accidental embedded -shared regressions.


This fixes some riscv specific tests that are failing for embedded elf targets.
It stops using -shared where it isn't necessary, and adds checks for shared
library support where it is necessary.

This was tested with riscv{32,64}-{elf,linux} check-{binutils,gas,ld}.  There
were no regressions, and 3 fewer failures for the riscv*-elf targets.

Committed.

Jim

	ld/
	* testsuite/ld-riscv-elf/c-lui.d: Don't use -shared.  Check for _start
	instead of .text.
	* testsuite/ld-riscv-elf/c-lui.s: Add _start label.
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Before __global_pointer$
	tests, add call to check_shared_lib_support.
---
 ld/testsuite/ld-riscv-elf/c-lui.d          | 4 ++--
 ld/testsuite/ld-riscv-elf/c-lui.s          | 4 +++-
 ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp | 5 +++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ld/testsuite/ld-riscv-elf/c-lui.d b/ld/testsuite/ld-riscv-elf/c-lui.d
index 7a9671163a..382eca88dc 100644
--- a/ld/testsuite/ld-riscv-elf/c-lui.d
+++ b/ld/testsuite/ld-riscv-elf/c-lui.d
@@ -1,7 +1,7 @@
 #name: lui to c.lui relaxation
 #source: c-lui.s
 #as: -march=rv32ic
-#ld: -shared -melf32lriscv
+#ld: -melf32lriscv
 #objdump: -d -M no-aliases,numeric
 
 .*:     file format .*
@@ -9,7 +9,7 @@
 
 Disassembly of section \.text:
 
-.* <.text>:
+.* <_start>:
 .*:	6085                	c.lui	x1,0x1
 .*:	000000b7          	lui	x1,0x0
 .*:	00001037          	lui	x0,0x1
diff --git a/ld/testsuite/ld-riscv-elf/c-lui.s b/ld/testsuite/ld-riscv-elf/c-lui.s
index 4a23fdb95c..7159047afb 100644
--- a/ld/testsuite/ld-riscv-elf/c-lui.s
+++ b/ld/testsuite/ld-riscv-elf/c-lui.s
@@ -1,4 +1,6 @@
-.text	
+	.text
+	.globl _start
+_start:
 	lui x1, 1
 	lui x1, 0
 	lui x0, 1
diff --git a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
index 5b5d2ea004..2b6a1d78fe 100644
--- a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
+++ b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
@@ -23,6 +23,11 @@ if [istarget "riscv*-*-*"] {
     run_dump_test "c-lui"
     run_dump_test "disas-jalr"
 
+    # The following tests require shared library support.
+    if ![check_shared_lib_support] {
+	return
+    }
+
     set abis { rv32gc ilp32 elf32lriscv rv64gc lp64 elf64lriscv }
     foreach { arch abi emul } $abis {
 	# This checks whether our linker scripts handle __global_pointer$
-- 
2.14.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]