aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/elf32-arm.c5
-rw-r--r--bfd/elflink.c3
-rw-r--r--bfd/elfnn-aarch64.c5
-rw-r--r--ld/testsuite/ld-elf/linux-x86.exp15
-rw-r--r--ld/testsuite/ld-elf/pr29797.c21
5 files changed, 47 insertions, 2 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index ec18a8a..c7d73171 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -18110,6 +18110,11 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
bfd_size_type size;
bfd *input_bfd;
+ if (info->strip == strip_all
+ && !info->emitrelocations
+ && !bfd_link_relocatable (info))
+ return true;
+
htab = elf32_arm_hash_table (info);
if (htab == NULL)
return false;
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 20cee4c..81b3412 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12877,8 +12877,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
/* If backend needs to output some local symbols not present in the hash
table, do it now. */
- if (bed->elf_backend_output_arch_local_syms
- && (info->strip != strip_all || emit_relocs))
+ if (bed->elf_backend_output_arch_local_syms)
{
if (! ((*bed->elf_backend_output_arch_local_syms)
(abfd, info, &flinfo, elf_link_output_symstrtab)))
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 7b93672..a9fefbd 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -8476,6 +8476,11 @@ elfNN_aarch64_output_arch_local_syms (bfd *output_bfd,
output_arch_syminfo osi;
struct elf_aarch64_link_hash_table *htab;
+ if (info->strip == strip_all
+ && !info->emitrelocations
+ && !bfd_link_relocatable (info))
+ return true;
+
htab = elf_aarch64_hash_table (info);
osi.finfo = finfo;
diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp
index 0637905..7822bd2 100644
--- a/ld/testsuite/ld-elf/linux-x86.exp
+++ b/ld/testsuite/ld-elf/linux-x86.exp
@@ -203,6 +203,21 @@ run_ld_link_exec_tests [list \
] \
]
+# Run-time tests which require working ifunc attribute support.
+if { [check_ifunc_attribute_available] } {
+ run_ld_link_exec_tests [list \
+ [list \
+ "Run pr29797" \
+ "-s" \
+ "" \
+ { pr29797.c } \
+ "pr29797" \
+ "pass.out" \
+ "-O0" \
+ ] \
+ ]
+}
+
# Old gcc silently ignores __attribute__ ((aligned())) with too big alignment.
proc compiler_honours_aligned { } {
global CC_FOR_TARGET READELF srcdir subdir
diff --git a/ld/testsuite/ld-elf/pr29797.c b/ld/testsuite/ld-elf/pr29797.c
new file mode 100644
index 0000000..9e3113f
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr29797.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+static int foo (int x) __attribute__ ((ifunc ("resolve_foo")));
+
+static int foo_impl(int x)
+{
+ return x;
+}
+
+static void *resolve_foo (void)
+{
+ return (void *) foo_impl;
+}
+
+int
+main ()
+{
+ foo (0);
+ puts ("PASS");
+ return 0;
+}