aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-01-14 20:45:53 +1030
committerAlan Modra <amodra@gmail.com>2020-01-15 12:29:21 +1030
commite1c6cf618cbeebbafd34afc5ee921fcbf7061bfa (patch)
tree0b4df69086860715c0142805e45013a0ce383555 /ld
parentff47f4f06d296b672337e2c7363a745cd2725f58 (diff)
downloadgdb-e1c6cf618cbeebbafd34afc5ee921fcbf7061bfa.zip
gdb-e1c6cf618cbeebbafd34afc5ee921fcbf7061bfa.tar.gz
gdb-e1c6cf618cbeebbafd34afc5ee921fcbf7061bfa.tar.bz2
PR25384, PowerPC64 ELFv1 copy relocs against function symbols
Function symbols of course don't normally want .dynbss copies but with some old versions of gcc they are needed to copy the function descriptor. This patch restricts the cases where they are useful to compilers using dot-symbols, and enables the warning regardless of whether a PLT entry is emitted in the executable. PLTs in shared libraries are affected by a .dynbss copy in the executable. bfd/ PR 25384 * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Update comment. (ppc64_elf_adjust_dynamic_symbol): Don't allow .dynbss copies of function symbols unless dot symbols are present. Do warn whenever one is created, regardles of whether a PLT entry is also emitted for the function symbol. ld/ * testsuite/ld-powerpc/ambiguousv1b.d: Adjust expected output. * testsuite/ld-powerpc/funref.s: Align func_tab. * testsuite/ld-powerpc/funref2.s: Likewise. * testsuite/ld-powerpc/funv1.s: Add dot symbols.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/testsuite/ld-powerpc/ambiguousv1b.d5
-rw-r--r--ld/testsuite/ld-powerpc/funref.s1
-rw-r--r--ld/testsuite/ld-powerpc/funref2.s1
-rw-r--r--ld/testsuite/ld-powerpc/funv1.s14
5 files changed, 20 insertions, 8 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ee68a8c..c68d920 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-15 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-powerpc/ambiguousv1b.d: Adjust expected output.
+ * testsuite/ld-powerpc/funref.s: Align func_tab.
+ * testsuite/ld-powerpc/funref2.s: Likewise.
+ * testsuite/ld-powerpc/funv1.s: Add dot symbols.
+
2020-01-14 Lili Cui <lili.cui@intel.com>
* testsuite/ld-i386/align-branch-1.d: Updated for i686-pc-elf.
diff --git a/ld/testsuite/ld-powerpc/ambiguousv1b.d b/ld/testsuite/ld-powerpc/ambiguousv1b.d
index 9be1371..205f7ea 100644
--- a/ld/testsuite/ld-powerpc/ambiguousv1b.d
+++ b/ld/testsuite/ld-powerpc/ambiguousv1b.d
@@ -3,6 +3,7 @@
#as: -a64
#ld: -melf64ppc --emit-stub-syms
#ld_after_inputfiles: tmpdir/funv1.so
+#warning: .*requires lazy plt linking.*
#readelf: -rs --wide
# Check that we do the right thing with funref2.s that doesn't have
# anything to mark it as ELFv1 or ELFv2. Since my_func address is
@@ -15,9 +16,9 @@ Relocation section .* contains 1 entry:
Symbol table '\.dynsym' contains 2 entries:
#...
-.*: 0*[1-9a-f][0-9a-f]* 4 FUNC GLOBAL DEFAULT 1[23] my_func
+.*: 0*[1-9a-f][0-9a-f]* +24 FUNC +GLOBAL DEFAULT +1[23] my_func
#...
Symbol table '\.symtab' contains .* entries:
#...
-.*: 0*[1-9a-f][0-9a-f]* 4 FUNC GLOBAL DEFAULT 1[23] my_func
+.*: 0*[1-9a-f][0-9a-f]* +24 FUNC +GLOBAL DEFAULT +1[23] my_func
#pass
diff --git a/ld/testsuite/ld-powerpc/funref.s b/ld/testsuite/ld-powerpc/funref.s
index 3f7de47..27c1bcf 100644
--- a/ld/testsuite/ld-powerpc/funref.s
+++ b/ld/testsuite/ld-powerpc/funref.s
@@ -1,4 +1,5 @@
.data
.globl func_tab
+ .p2align 3
func_tab:
.dc.a my_func
diff --git a/ld/testsuite/ld-powerpc/funref2.s b/ld/testsuite/ld-powerpc/funref2.s
index a2bf949..14c58f0 100644
--- a/ld/testsuite/ld-powerpc/funref2.s
+++ b/ld/testsuite/ld-powerpc/funref2.s
@@ -1,4 +1,5 @@
.section .rodata,"a",@progbits
.globl func_tab
+ .p2align 3
func_tab:
.dc.a my_func
diff --git a/ld/testsuite/ld-powerpc/funv1.s b/ld/testsuite/ld-powerpc/funv1.s
index e79009d..988ad0d 100644
--- a/ld/testsuite/ld-powerpc/funv1.s
+++ b/ld/testsuite/ld-powerpc/funv1.s
@@ -1,10 +1,12 @@
- .globl my_func
- .type my_func,@function
- .section .opd,"aw",@progbits
+# old style ELFv1, with dot-symbols
+ .globl my_func, .my_func
+ .type .my_func, @function
+ .section .opd, "aw", @progbits
my_func:
- .quad .Lmy_func, .TOC.@tocbase
+ .quad .my_func, .TOC.@tocbase, 0
+ .size my_func, . - my_func
.text
-.Lmy_func:
+.my_func:
blr
- .size my_func,.-.Lmy_func
+ .size .my_func, . - .my_func