2019-04-17 H.J. Lu <hongjiu.lu@intel.com>
+ * elf64-x86-64.c (elf_x86_64_need_pic): Suggest -fPIE when not
+ building shared object.
+ * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Likewise.
+
+2019-04-17 H.J. Lu <hongjiu.lu@intel.com>
+
PR ld/24458
* elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): Also check x86
linker_def.
v = _("protected symbol ");
else
v = _("symbol ");
- pic = _("; recompile with -fPIC");
+ pic = NULL;
break;
}
else
{
name = bfd_elf_sym_name (input_bfd, symtab_hdr, isym, NULL);
- pic = _("; recompile with -fPIC");
+ pic = NULL;
}
if (bfd_link_dll (info))
- object = _("a shared object");
- else if (bfd_link_pie (info))
- object = _("a PIE object");
+ {
+ object = _("a shared object");
+ if (!pic)
+ pic = _("; recompile with -fPIC");
+ }
else
- object = _("a PDE object");
+ {
+ if (bfd_link_pie (info))
+ object = _("a PIE object");
+ else
+ object = _("a PDE object");
+ if (!pic)
+ pic = _("; recompile with -fPIE");
+ }
/* xgettext:c-format */
_bfd_error_handler (_("%pB: relocation %s against %s%s`%s' can "
{
info->callbacks->einfo
(_("%P%X: read-only segment has dynamic IFUNC relocations;"
- " recompile with -fPIC\n"));
+ " recompile with %s\n"),
+ bfd_link_dll (info) ? "-fPIC" : "-fPIE");
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
2019-04-17 H.J. Lu <hongjiu.lu@intel.com>
+ * testsuite/ld-i386/i386.exp: Run pr18801a and pr18801b instead
+ of pr18801.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+ * testsuite/ld-i386/pr18801.d: Removed.
+ * testsuite/ld-x86-64/pr18801.d: Likewise.
+ * testsuite/ld-i386/pr18801a.d: New file.
+ * testsuite/ld-i386/pr18801b.d: Likewise.
+ * testsuite/ld-x86-64/pr18801a.d: Likewise.
+ * testsuite/ld-x86-64/pr18801b.d: Likewise.
+ * testsuite/ld-x86-64/pie2.d: Suggest -fPIE instead of -fPIC.
+ * testsuite/ld-x86-64/pie2.d: Likewise.
+ * testsuite/ld-x86-64/pr19719.d: Likewise.
+ * testsuite/ld-x86-64/pr19807-2a.d: Likewise.
+ * testsuite/ld-x86-64/pr19969.d: Likewise.
+ * testsuite/ld-x86-64/pr21997-1a.err: Likewise.
+ * testsuite/ld-x86-64/pr21997-1b.err: Likewise.
+ * testsuite/ld-x86-64/pr22001-1a.err: Likewise.
+ * testsuite/ld-x86-64/pr22001-1b.err: Likewise.
+ * testsuite/ld-x86-64/pr22791-1.err: Likewise.
+
+2019-04-17 H.J. Lu <hongjiu.lu@intel.com>
+
PR ld/24458
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24458 tests.
* testsuite/ld-x86-64/pr24458.s: New file.
run_dump_test "pr17057"
run_dump_test "pr17935-1"
run_dump_test "pr17935-2"
-run_dump_test "pr18801"
+run_dump_test "pr18801a"
+run_dump_test "pr18801b"
run_dump_test "pr18815"
run_dump_test "pr19939a"
run_dump_test "pr19939b"
+#source: pr18801.s
#as: --32
#ld: -m elf_i386 -pie
-#error: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
+#error: read-only segment has dynamic IFUNC relocations; recompile with -fPIE
--- /dev/null
+#source: pr18801.s
+#as: --32
+#ld: -m elf_i386 -shared
+#error: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
#as: --64
#ld: -pie -melf_x86_64
-#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a PIE object; recompile with -fPIC
+#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a PIE object; recompile with -fPIE
+#source: pr18801.s
#as: --64
#ld: -melf_x86_64 -pie
-#error: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
+#error: read-only segment has dynamic IFUNC relocations; recompile with -fPIE
--- /dev/null
+#source: pr18801.s
+#as: --64
+#ld: -melf_x86_64 -shared
+#error: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
#as: --64
#ld: -pie -melf_x86_64
-#error: .*relocation R_X86_64_32 against undefined symbol `foo' can not be used when making a PIE object; recompile with -fPIC
+#error: .*relocation R_X86_64_32 against undefined symbol `foo' can not be used when making a PIE object; recompile with -fPIE
#source: pr19807-2.s
#as: --64
#ld: -pie -melf_x86_64
-#error: .*relocation R_X86_64_32 against `.data' can not be used when making a PIE object; recompile with -fPIC
+#error: .*relocation R_X86_64_32 against `.data' can not be used when making a PIE object; recompile with -fPIE
#source: pr19969b.S
#as: --64
#ld: -melf_x86_64 tmpdir/pr19969.so
-#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a PDE object; recompile with -fPIC
+#error: .*relocation R_X86_64_32 against symbol `foo' can not be used when making a PDE object; recompile with -fPIE
-.*relocation R_X86_64_PC32 against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIC
+.*relocation R_X86_64_PC32 against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIE
#...
-.*relocation R_X86_64_32S against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIC
+.*relocation R_X86_64_32S against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIE
#...
-.*relocation R_X86_64_PC32 against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIC
+.*relocation R_X86_64_PC32 against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIE
#...
-.*relocation R_X86_64_32S against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIC
+.*relocation R_X86_64_32S against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIE
#...
-.*relocation R_X86_64_PC32 against symbol `foo' can not be used when making a PIE object; recompile with -fPIC
+.*relocation R_X86_64_PC32 against symbol `foo' can not be used when making a PIE object; recompile with -fPIE
#...
run_dump_test "pr17935-2"
run_dump_test "pr18160"
run_dump_test "pr18176"
-run_dump_test "pr18801"
+run_dump_test "pr18801a"
+run_dump_test "pr18801b"
run_dump_test "pr18815"
run_dump_test "pr19013"
run_dump_test "pr19013-x32"