+
+ PR ld/16467
+ * elflink.c (_bfd_elf_merge_symbol): When types of the existing
+ regular default symbol definition and the versioned dynamic
+ symbol definition mismatch, skip the default symbol definition
+ if one of them is IFUNC.
+
PR ld/2404
&& newdyn
&& newdef
&& !olddyn
- && (olddef || h->root.type == bfd_link_hash_common)
- && ELF_ST_TYPE (sym->st_info) != h->type
- && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
- && h->type != STT_NOTYPE
- && !(newfunc && oldfunc))
+ && (((olddef || h->root.type == bfd_link_hash_common)
+ && ELF_ST_TYPE (sym->st_info) != h->type
+ && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
+ && h->type != STT_NOTYPE
+ && !(newfunc && oldfunc))
+ || (olddef
+ && ((h->type == STT_GNU_IFUNC)
+ != (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))))
{
*skip = TRUE;
return TRUE;
+
+ PR ld/16467
+ * ld-ifunc/dummy.c: New file.
+ * ld-ifunc/pr16467.out: Likewise.
+ * ld-ifunc/pr16467a.c: Likewise.
+ * ld-ifunc/pr16467a.map: Likewise.
+ * ld-ifunc/pr16467b.c: Likewise.
+ * ld-ifunc/pr16467b.map: Likewise.
+ * ld-ifunc/pr16467c.c: Likewise.
+
+ * ld-ifunc/ifunc.exp (run_cc_link_tests): New.
+ (run_ld_link_exec_tests): Run pr16467.
+
PR ld/2404
--- /dev/null
+/* An empty file. */
remote_file host delete "tmpdir/static_nonifunc_prog"
}
+run_cc_link_tests [list \
+ [list \
+ "Build libpr16467a.so" \
+ "-shared -Wl,--version-script=pr16467a.map" \
+ "-fPIC" \
+ { pr16467a.c } \
+ {} \
+ "libpr16467a.so" \
+ ] \
+ [list \
+ "Build libpr16467b.a" \
+ "" \
+ "-fPIC" \
+ { pr16467b.c } \
+ {} \
+ "libpr16467b.a" \
+ ] \
+ [list \
+ "Build libpr16467b.so" \
+ "-shared tmpdir/pr16467b.o tmpdir/libpr16467a.so \
+ -Wl,--version-script=pr16467b.map" \
+ "-fPIC" \
+ { dummy.c } \
+ {} \
+ "libpr16467b.so" \
+ ] \
+ [list \
+ "Build libpr16467c.a" \
+ "" \
+ "" \
+ { pr16467c.c } \
+ {} \
+ "libpr16467c.a" \
+ ] \
+]
+
run_ld_link_exec_tests [] [list \
[list \
"Common symbol override ifunc test 1a" \
"ifunc-common-1.out" \
"-g" \
] \
+ [list \
+ "Run pr16467" \
+ "tmpdir/pr16467c.o tmpdir/libpr16467b.so tmpdir/libpr16467a.so" \
+ "" \
+ { dummy.c } \
+ "pr16467" \
+ "pr16467.out" \
+ "" \
+ ] \
]
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
--- /dev/null
+const char *
+sd_get_seats(void)
+{
+ return "OK";
+}
--- /dev/null
+LIBSYSTEMD_209 {
+global:
+ sd_get_seats;
+};
--- /dev/null
+void new_sd_get_seats(void);
+__asm__(".symver new_sd_get_seats,sd_get_seats@LIBSYSTEMD_209");
+void (*resolve_sd_get_seats(void)) (void) __asm__ ("sd_get_seats");
+void (*resolve_sd_get_seats(void)) (void) {
+ return new_sd_get_seats;
+}
+__asm__(".type sd_get_seats, %gnu_indirect_function");
--- /dev/null
+LIBSYSTEMD_208 {
+global:
+ sd_get_seats;
+};
--- /dev/null
+#include <stdio.h>
+const char* sd_get_seats(void);
+
+int
+main (int argc, char **argv)
+{
+ printf("%s\n", sd_get_seats());
+ return 0;
+}