aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2019-04-17 10:22:19 -0700
committerH.J. Lu <hjl.tools@gmail.com>2019-04-17 10:25:28 -0700
commit9a7f0679fd3b9815b8eb938bfdad3934b8435419 (patch)
tree4b1d7e65292f9e4e1fa93e26ede4e885ddf553c2 /ld
parent4e84a8f8bbeab52fa7048873655e582ceb92534d (diff)
downloadgdb-9a7f0679fd3b9815b8eb938bfdad3934b8435419.zip
gdb-9a7f0679fd3b9815b8eb938bfdad3934b8435419.tar.gz
gdb-9a7f0679fd3b9815b8eb938bfdad3934b8435419.tar.bz2
x86: Suggest -fPIE when not building shared object
When PIC is needed, linker should suggest -fPIE, instead of -fPIC, when not building shared object. bfd/ * 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. ld/ * 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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog22
-rw-r--r--ld/testsuite/ld-i386/i386.exp3
-rw-r--r--ld/testsuite/ld-i386/pr18801a.d (renamed from ld/testsuite/ld-i386/pr18801.d)3
-rw-r--r--ld/testsuite/ld-i386/pr18801b.d4
-rw-r--r--ld/testsuite/ld-x86-64/pie2.d2
-rw-r--r--ld/testsuite/ld-x86-64/pr18801a.d (renamed from ld/testsuite/ld-x86-64/pr18801.d)3
-rw-r--r--ld/testsuite/ld-x86-64/pr18801b.d4
-rw-r--r--ld/testsuite/ld-x86-64/pr19719.d2
-rw-r--r--ld/testsuite/ld-x86-64/pr19807-2a.d2
-rw-r--r--ld/testsuite/ld-x86-64/pr19969.d2
-rw-r--r--ld/testsuite/ld-x86-64/pr21997-1a.err2
-rw-r--r--ld/testsuite/ld-x86-64/pr21997-1b.err2
-rw-r--r--ld/testsuite/ld-x86-64/pr22001-1a.err2
-rw-r--r--ld/testsuite/ld-x86-64/pr22001-1b.err2
-rw-r--r--ld/testsuite/ld-x86-64/pr22791-1.err2
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp3
16 files changed, 47 insertions, 13 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 0fae659..c1632c2 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,27 @@
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.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index e9c2cfb..9579df6 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -512,7 +512,8 @@ run_dump_test "pr14215"
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"
diff --git a/ld/testsuite/ld-i386/pr18801.d b/ld/testsuite/ld-i386/pr18801a.d
index 4bb2efb..f8dc3f1 100644
--- a/ld/testsuite/ld-i386/pr18801.d
+++ b/ld/testsuite/ld-i386/pr18801a.d
@@ -1,3 +1,4 @@
+#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
diff --git a/ld/testsuite/ld-i386/pr18801b.d b/ld/testsuite/ld-i386/pr18801b.d
new file mode 100644
index 0000000..f1d5c8d
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr18801b.d
@@ -0,0 +1,4 @@
+#source: pr18801.s
+#as: --32
+#ld: -m elf_i386 -shared
+#error: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
diff --git a/ld/testsuite/ld-x86-64/pie2.d b/ld/testsuite/ld-x86-64/pie2.d
index 9532141..37ca9dd 100644
--- a/ld/testsuite/ld-x86-64/pie2.d
+++ b/ld/testsuite/ld-x86-64/pie2.d
@@ -1,3 +1,3 @@
#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
diff --git a/ld/testsuite/ld-x86-64/pr18801.d b/ld/testsuite/ld-x86-64/pr18801a.d
index 459db6b..b527f04 100644
--- a/ld/testsuite/ld-x86-64/pr18801.d
+++ b/ld/testsuite/ld-x86-64/pr18801a.d
@@ -1,3 +1,4 @@
+#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
diff --git a/ld/testsuite/ld-x86-64/pr18801b.d b/ld/testsuite/ld-x86-64/pr18801b.d
new file mode 100644
index 0000000..7cdb2cd
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr18801b.d
@@ -0,0 +1,4 @@
+#source: pr18801.s
+#as: --64
+#ld: -melf_x86_64 -shared
+#error: read-only segment has dynamic IFUNC relocations; recompile with -fPIC
diff --git a/ld/testsuite/ld-x86-64/pr19719.d b/ld/testsuite/ld-x86-64/pr19719.d
index 03cfc15..b5220c7 100644
--- a/ld/testsuite/ld-x86-64/pr19719.d
+++ b/ld/testsuite/ld-x86-64/pr19719.d
@@ -1,3 +1,3 @@
#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
diff --git a/ld/testsuite/ld-x86-64/pr19807-2a.d b/ld/testsuite/ld-x86-64/pr19807-2a.d
index c99852a..da044e3 100644
--- a/ld/testsuite/ld-x86-64/pr19807-2a.d
+++ b/ld/testsuite/ld-x86-64/pr19807-2a.d
@@ -1,4 +1,4 @@
#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
diff --git a/ld/testsuite/ld-x86-64/pr19969.d b/ld/testsuite/ld-x86-64/pr19969.d
index 1aea67c..2bca08f 100644
--- a/ld/testsuite/ld-x86-64/pr19969.d
+++ b/ld/testsuite/ld-x86-64/pr19969.d
@@ -1,4 +1,4 @@
#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
diff --git a/ld/testsuite/ld-x86-64/pr21997-1a.err b/ld/testsuite/ld-x86-64/pr21997-1a.err
index 5d663a3..e57ebd1 100644
--- a/ld/testsuite/ld-x86-64/pr21997-1a.err
+++ b/ld/testsuite/ld-x86-64/pr21997-1a.err
@@ -1,2 +1,2 @@
-.*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
#...
diff --git a/ld/testsuite/ld-x86-64/pr21997-1b.err b/ld/testsuite/ld-x86-64/pr21997-1b.err
index 365de67..a99fc1d 100644
--- a/ld/testsuite/ld-x86-64/pr21997-1b.err
+++ b/ld/testsuite/ld-x86-64/pr21997-1b.err
@@ -1,2 +1,2 @@
-.*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
#...
diff --git a/ld/testsuite/ld-x86-64/pr22001-1a.err b/ld/testsuite/ld-x86-64/pr22001-1a.err
index 640aa07..0cd4170 100644
--- a/ld/testsuite/ld-x86-64/pr22001-1a.err
+++ b/ld/testsuite/ld-x86-64/pr22001-1a.err
@@ -1,2 +1,2 @@
-.*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
#...
diff --git a/ld/testsuite/ld-x86-64/pr22001-1b.err b/ld/testsuite/ld-x86-64/pr22001-1b.err
index 9617e73..e9a80e3 100644
--- a/ld/testsuite/ld-x86-64/pr22001-1b.err
+++ b/ld/testsuite/ld-x86-64/pr22001-1b.err
@@ -1,2 +1,2 @@
-.*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
#...
diff --git a/ld/testsuite/ld-x86-64/pr22791-1.err b/ld/testsuite/ld-x86-64/pr22791-1.err
index 5500fa5..8c55659 100644
--- a/ld/testsuite/ld-x86-64/pr22791-1.err
+++ b/ld/testsuite/ld-x86-64/pr22791-1.err
@@ -1,2 +1,2 @@
-.*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
#...
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 7ebc461..98aa4b0 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -566,7 +566,8 @@ run_dump_test "pr17935-1"
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"