[PATCH] s390x: Set .got sh_entsize only if .got size
H.J. Lu
hjl.tools@gmail.com
Sat Nov 21 14:09:20 GMT 2020
More information about the Binutils mailing list
Sat Nov 21 14:09:20 GMT 2020
- Previous message (by thread): [PATCH] ld: Make ARC's tls_ie-01 test more flexible
- Next message (by thread): [PATCH] s390x: Set .got sh_entsize only if .got size > 0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
bfd/
PR ld/26918
* elf64-s390.c (elf_s390_finish_dynamic_sections): Set .got
sh_entsize only if .got size > 0.
ld:
PR ld/26918
* testsuite/ld-s390/pr26918-1.d: New file.
* testsuite/ld-s390/pr26918-1.s: Likewise.
* testsuite/ld-s390/s390.exp: Run all *.d tests.
---
bfd/elf64-s390.c | 2 +-
ld/testsuite/ld-s390/pr26918-1.d | 5 +++++
ld/testsuite/ld-s390/pr26918-1.s | 19 +++++++++++++++++++
ld/testsuite/ld-s390/s390.exp | 7 +++++++
4 files changed, 32 insertions(+), 1 deletion(-)
create mode 100644 ld/testsuite/ld-s390/pr26918-1.d
create mode 100644 ld/testsuite/ld-s390/pr26918-1.s
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 41b19bcd2c..d6a46b1d8c 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3547,7 +3547,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
bfd_put_64 (output_bfd, (bfd_vma) 0,
htab->elf.hgot->root.u.def.section->contents + 16);
}
- if (elf_section_data (htab->elf.splt->output_section) != NULL)
+ if (htab->elf.sgot != NULL && htab->elf.sgot->size > 0)
elf_section_data (htab->elf.sgot->output_section)
->this_hdr.sh_entsize = 8;
}
diff --git a/ld/testsuite/ld-s390/pr26918-1.d b/ld/testsuite/ld-s390/pr26918-1.d
new file mode 100644
index 0000000000..b02c2b6280
--- /dev/null
+++ b/ld/testsuite/ld-s390/pr26918-1.d
@@ -0,0 +1,5 @@
+#as: -m64 -mzarch -march=z900
+#ld: -e start -static
+#readelf: -r --wide
+
+There are no relocations in this file.
diff --git a/ld/testsuite/ld-s390/pr26918-1.s b/ld/testsuite/ld-s390/pr26918-1.s
new file mode 100644
index 0000000000..980bc41564
--- /dev/null
+++ b/ld/testsuite/ld-s390/pr26918-1.s
@@ -0,0 +1,19 @@
+ .machinemode zarch
+ .machine "z900"
+.text
+ .align 8
+.globl start
+ .type start, @function
+start:
+ larl %r1,foo@GOTENT
+ lg %r1,0(%r1)
+ lgf %r2,0(%r1)
+ br %r14
+ .size start, .-start
+.globl foo
+.bss
+ .align 4
+ .type foo, @object
+ .size foo, 4
+foo:
+ .zero 4
diff --git a/ld/testsuite/ld-s390/s390.exp b/ld/testsuite/ld-s390/s390.exp
index 660cf4b8b0..ee3438e8a7 100644
--- a/ld/testsuite/ld-s390/s390.exp
+++ b/ld/testsuite/ld-s390/s390.exp
@@ -95,3 +95,10 @@ if [istarget "s390x-*-*"] {
run_ld_link_tests $s390tests
run_ld_link_tests $s390xtests
}
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
+}
--
2.28.0
- Previous message (by thread): [PATCH] ld: Make ARC's tls_ie-01 test more flexible
- Next message (by thread): [PATCH] s390x: Set .got sh_entsize only if .got size > 0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list