aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf32-i386.c14
-rw-r--r--bfd/elf64-x86-64.c22
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-i386/tlsdesc2.d10
-rw-r--r--ld/testsuite/ld-x86-64/tlsdesc2.d10
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp1
8 files changed, 52 insertions, 18 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 26b3572..3234230 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2017-04-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
+ DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
+ * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
+ add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
+
2017-04-26 Nick Clifton <nickc@redhat.com>
PR binutils/21434
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 9a568ce..78c5d5b 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -3577,14 +3577,14 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
relocation. */
if (!add_dynamic_entry (DT_PLTGOT, 0))
return FALSE;
+ }
- if (htab->elf.srelplt->size != 0)
- {
- if (!add_dynamic_entry (DT_PLTRELSZ, 0)
- || !add_dynamic_entry (DT_PLTREL, DT_REL)
- || !add_dynamic_entry (DT_JMPREL, 0))
- return FALSE;
- }
+ if (htab->elf.srelplt->size != 0)
+ {
+ if (!add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_REL)
+ || !add_dynamic_entry (DT_JMPREL, 0))
+ return FALSE;
}
if (relocs)
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 965ceb2..0e0a020 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -4052,21 +4052,21 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
relocation. */
if (!add_dynamic_entry (DT_PLTGOT, 0))
return FALSE;
+ }
- if (htab->elf.srelplt->size != 0)
- {
- if (!add_dynamic_entry (DT_PLTRELSZ, 0)
- || !add_dynamic_entry (DT_PLTREL, DT_RELA)
- || !add_dynamic_entry (DT_JMPREL, 0))
- return FALSE;
- }
-
- if (htab->tlsdesc_plt
- && (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
- || !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
+ if (htab->elf.srelplt->size != 0)
+ {
+ if (!add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return FALSE;
}
+ if (htab->tlsdesc_plt
+ && (!add_dynamic_entry (DT_TLSDESC_PLT, 0)
+ || !add_dynamic_entry (DT_TLSDESC_GOT, 0)))
+ return FALSE;
+
if (relocs)
{
if (!add_dynamic_entry (DT_RELA, 0)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 93165f2..c93d903 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-i386/tlsdesc2.d: New test.
+ * testsuite/ld-x86-64/tlsdesc2.d: Likewise.
+
2017-04-26 Maciej W. Rozycki <macro@imgtec.com>
PR ld/21334
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 844b36f..a709bcf 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -437,6 +437,7 @@ run_dump_test "pr18801"
run_dump_test "pr18815"
run_dump_test "pr19939a"
run_dump_test "pr19939b"
+run_dump_test "tlsdesc2"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"
diff --git a/ld/testsuite/ld-i386/tlsdesc2.d b/ld/testsuite/ld-i386/tlsdesc2.d
new file mode 100644
index 0000000..b8569e8
--- /dev/null
+++ b/ld/testsuite/ld-i386/tlsdesc2.d
@@ -0,0 +1,10 @@
+#source: tlsdesc.s
+#as: --32
+#ld: -melf_i386 -shared -z now
+#readelf: -d --wide
+
+#...
+.*\(PLTRELSZ\).*
+.*\(PLTREL\).*
+.*\(JMPREL\).*
+#pass
diff --git a/ld/testsuite/ld-x86-64/tlsdesc2.d b/ld/testsuite/ld-x86-64/tlsdesc2.d
new file mode 100644
index 0000000..8679757
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/tlsdesc2.d
@@ -0,0 +1,10 @@
+#source: tlsdesc.s
+#as: --64
+#ld: -melf_x86_64 -shared -z now
+#readelf: -d --wide
+
+#...
+.*\(PLTRELSZ\).*
+.*\(PLTREL\).*
+.*\(JMPREL\).*
+#pass
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index a9394c3..7127eca 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -530,6 +530,7 @@ run_dump_test "pr20253-4e"
run_dump_test "pr20253-4f"
run_dump_test "pr20253-5a"
run_dump_test "pr20253-5b"
+run_dump_test "tlsdesc2"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"