This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] PR ld/18169: sh_info of .rel.plt/.rela.plt sections isn't correct
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 26 Mar 2015 11:34:55 -0700
- Subject: [PATCH] PR ld/18169: sh_info of .rel.plt/.rela.plt sections isn't correct
- Authentication-results: sourceware.org; auth=none
Since .rela.plt/rel.plt section doesn't contain relocations against .plt
section, we shouldn't set sh_info for .rela.plt/rel.plt section. OK for
master?
H.J.
--
bfd/
PR ld/18169
* elf.c (assign_section_numbers): Don't mark .rela.plt/rel.plt
section as relocations against .plt section.
ld/testsuite/
PR ld/18169
* ld-elf/linkinfo1a.d: Updated.
* ld-elf/linkinfo1b.d: Likewise.
* ld-tic6x/shlib-1.rd: Likewise.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-app-1.rd: Likewise.
* ld-tic6x/shlib-app-1b.rd: Likewise.
* ld-tic6x/shlib-app-1r.rd: Likewise.
* ld-tic6x/shlib-app-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.
---
bfd/elf.c | 13 +++++++++----
ld/testsuite/ld-elf/linkinfo1a.d | 2 +-
ld/testsuite/ld-elf/linkinfo1b.d | 2 +-
ld/testsuite/ld-tic6x/shlib-1.rd | 2 +-
ld/testsuite/ld-tic6x/shlib-1b.rd | 2 +-
ld/testsuite/ld-tic6x/shlib-1r.rd | 2 +-
ld/testsuite/ld-tic6x/shlib-1rb.rd | 2 +-
ld/testsuite/ld-tic6x/shlib-app-1.rd | 2 +-
ld/testsuite/ld-tic6x/shlib-app-1b.rd | 2 +-
ld/testsuite/ld-tic6x/shlib-app-1r.rd | 2 +-
ld/testsuite/ld-tic6x/shlib-app-1rb.rd | 2 +-
ld/testsuite/ld-tic6x/shlib-noindex.rd | 2 +-
12 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/bfd/elf.c b/bfd/elf.c
index c4defda..6bc1c87 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3319,11 +3319,16 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
name += 4;
else
name += 5;
- s = bfd_get_section_by_name (abfd, name);
- if (s != NULL)
+ /* .rela.plt/rel.plt section doesn't contain relocations
+ against .plt section. */
+ if (strcmp (name, ".plt") != 0)
{
- d->this_hdr.sh_info = elf_section_data (s)->this_idx;
- d->this_hdr.sh_flags |= SHF_INFO_LINK;
+ s = bfd_get_section_by_name (abfd, name);
+ if (s != NULL)
+ {
+ d->this_hdr.sh_info = elf_section_data (s)->this_idx;
+ d->this_hdr.sh_flags |= SHF_INFO_LINK;
+ }
}
break;
diff --git a/ld/testsuite/ld-elf/linkinfo1a.d b/ld/testsuite/ld-elf/linkinfo1a.d
index 8c6fb71..6aa5ec4 100644
--- a/ld/testsuite/ld-elf/linkinfo1a.d
+++ b/ld/testsuite/ld-elf/linkinfo1a.d
@@ -4,5 +4,5 @@
#target: x86_64-* i?86-*
#...
- \[[ 0-9]+\] \.rel[a]?\.plt[ \t]+REL[A]?[ \t][ \t0-9a-f]+AI[ \t0-9a-f]+
+ \[[ 0-9]+\] \.rel[a]?\.plt[ \t]+REL[A]?[ \t][ \t0-9a-f]+A[ \t]+[0-9a-f]+[ \t]+0[ \t]+[0-9a-f]+
#pass
diff --git a/ld/testsuite/ld-elf/linkinfo1b.d b/ld/testsuite/ld-elf/linkinfo1b.d
index cc3aaed..347b3c4 100644
--- a/ld/testsuite/ld-elf/linkinfo1b.d
+++ b/ld/testsuite/ld-elf/linkinfo1b.d
@@ -5,5 +5,5 @@
#target: x86_64-* i?86-*
#...
- \[[ 0-9]+\] \.rel[a]?\.plt[ \t]+REL[A]?[ \t][ \t0-9a-f]+AI[ \t0-9a-f]+
+ \[[ 0-9]+\] \.rel[a]?\.plt[ \t]+REL[A]?[ \t][ \t0-9a-f]+A[ \t]+[0-9a-f]+[ \t]+0[ \t]+[0-9a-f]+
#pass
diff --git a/ld/testsuite/ld-tic6x/shlib-1.rd b/ld/testsuite/ld-tic6x/shlib-1.rd
index 5818326..c7635c5 100644
--- a/ld/testsuite/ld-tic6x/shlib-1.rd
+++ b/ld/testsuite/ld-tic6x/shlib-1.rd
@@ -9,7 +9,7 @@ Section Headers:
\[ 4\] \.rela\.got RELA 00008140 001140 000024 0c AI 2 10 4
\[ 5\] \.rela\.neardata RELA 00008164 001164 000018 0c AI 2 11 4
\[ 6\] \.dynamic DYNAMIC 0000817c 00117c 0000a8 08 WA 3 0 4
- \[ 7\] \.rela\.plt RELA 10000000 002000 000018 0c AI 2 8 4
+ \[ 7\] \.rela\.plt RELA 10000000 002000 000018 0c A 2 0 4
\[ 8\] \.plt PROGBITS 10000020 002020 000060 18 AX 0 0 32
\[ 9\] \.text PROGBITS 10000080 002080 000080 00 AX 0 0 32
\[10\] \.got PROGBITS 10000100 002100 000028 00 WA 0 0 4
diff --git a/ld/testsuite/ld-tic6x/shlib-1b.rd b/ld/testsuite/ld-tic6x/shlib-1b.rd
index 5818326..c7635c5 100644
--- a/ld/testsuite/ld-tic6x/shlib-1b.rd
+++ b/ld/testsuite/ld-tic6x/shlib-1b.rd
@@ -9,7 +9,7 @@ Section Headers:
\[ 4\] \.rela\.got RELA 00008140 001140 000024 0c AI 2 10 4
\[ 5\] \.rela\.neardata RELA 00008164 001164 000018 0c AI 2 11 4
\[ 6\] \.dynamic DYNAMIC 0000817c 00117c 0000a8 08 WA 3 0 4
- \[ 7\] \.rela\.plt RELA 10000000 002000 000018 0c AI 2 8 4
+ \[ 7\] \.rela\.plt RELA 10000000 002000 000018 0c A 2 0 4
\[ 8\] \.plt PROGBITS 10000020 002020 000060 18 AX 0 0 32
\[ 9\] \.text PROGBITS 10000080 002080 000080 00 AX 0 0 32
\[10\] \.got PROGBITS 10000100 002100 000028 00 WA 0 0 4
diff --git a/ld/testsuite/ld-tic6x/shlib-1r.rd b/ld/testsuite/ld-tic6x/shlib-1r.rd
index 5818326..c7635c5 100644
--- a/ld/testsuite/ld-tic6x/shlib-1r.rd
+++ b/ld/testsuite/ld-tic6x/shlib-1r.rd
@@ -9,7 +9,7 @@ Section Headers:
\[ 4\] \.rela\.got RELA 00008140 001140 000024 0c AI 2 10 4
\[ 5\] \.rela\.neardata RELA 00008164 001164 000018 0c AI 2 11 4
\[ 6\] \.dynamic DYNAMIC 0000817c 00117c 0000a8 08 WA 3 0 4
- \[ 7\] \.rela\.plt RELA 10000000 002000 000018 0c AI 2 8 4
+ \[ 7\] \.rela\.plt RELA 10000000 002000 000018 0c A 2 0 4
\[ 8\] \.plt PROGBITS 10000020 002020 000060 18 AX 0 0 32
\[ 9\] \.text PROGBITS 10000080 002080 000080 00 AX 0 0 32
\[10\] \.got PROGBITS 10000100 002100 000028 00 WA 0 0 4
diff --git a/ld/testsuite/ld-tic6x/shlib-1rb.rd b/ld/testsuite/ld-tic6x/shlib-1rb.rd
index 5818326..c7635c5 100644
--- a/ld/testsuite/ld-tic6x/shlib-1rb.rd
+++ b/ld/testsuite/ld-tic6x/shlib-1rb.rd
@@ -9,7 +9,7 @@ Section Headers:
\[ 4\] \.rela\.got RELA 00008140 001140 000024 0c AI 2 10 4
\[ 5\] \.rela\.neardata RELA 00008164 001164 000018 0c AI 2 11 4
\[ 6\] \.dynamic DYNAMIC 0000817c 00117c 0000a8 08 WA 3 0 4
- \[ 7\] \.rela\.plt RELA 10000000 002000 000018 0c AI 2 8 4
+ \[ 7\] \.rela\.plt RELA 10000000 002000 000018 0c A 2 0 4
\[ 8\] \.plt PROGBITS 10000020 002020 000060 18 AX 0 0 32
\[ 9\] \.text PROGBITS 10000080 002080 000080 00 AX 0 0 32
\[10\] \.got PROGBITS 10000100 002100 000028 00 WA 0 0 4
diff --git a/ld/testsuite/ld-tic6x/shlib-app-1.rd b/ld/testsuite/ld-tic6x/shlib-app-1.rd
index db1c560..bcb3a90 100644
--- a/ld/testsuite/ld-tic6x/shlib-app-1.rd
+++ b/ld/testsuite/ld-tic6x/shlib-app-1.rd
@@ -10,7 +10,7 @@ Section Headers:
\[ 5\] \.rela\.neardata RELA 00008154 001154 000018 0c AI 2 12 4
\[ 6\] \.rela\.bss RELA 0000816c 00116c 00000c 0c AI 2 13 4
\[ 7\] \.dynamic DYNAMIC 00008178 001178 0000b8 08 WA 3 0 4
- \[ 8\] \.rela\.plt RELA 10000000 002000 00000c 0c AI 2 9 4
+ \[ 8\] \.rela\.plt RELA 10000000 002000 00000c 0c A 2 0 4
\[ 9\] \.plt PROGBITS 10000020 002020 000040 18 AX 0 0 32
\[10\] \.text PROGBITS 10000060 002060 000040 00 AX 0 0 32
\[11\] \.got PROGBITS 100000a0 0020a0 000020 00 WA 0 0 4
diff --git a/ld/testsuite/ld-tic6x/shlib-app-1b.rd b/ld/testsuite/ld-tic6x/shlib-app-1b.rd
index 086f21a..206ffff 100644
--- a/ld/testsuite/ld-tic6x/shlib-app-1b.rd
+++ b/ld/testsuite/ld-tic6x/shlib-app-1b.rd
@@ -10,7 +10,7 @@ Section Headers:
\[ 5\] \.rela\.neardata RELA 00008154 001154 000018 0c AI 2 12 4
\[ 6\] \.rela\.bss RELA 0000816c 00116c 00000c 0c AI 2 13 4
\[ 7\] \.dynamic DYNAMIC 00008178 001178 0000b8 08 WA 3 0 4
- \[ 8\] \.rela\.plt RELA 10000000 002000 00000c 0c AI 2 9 4
+ \[ 8\] \.rela\.plt RELA 10000000 002000 00000c 0c A 2 0 4
\[ 9\] \.plt PROGBITS 10000020 002020 000040 18 AX 0 0 32
\[10\] \.text PROGBITS 10000060 002060 000040 00 AX 0 0 32
\[11\] \.got PROGBITS 100000a0 0020a0 000020 00 WA 0 0 4
diff --git a/ld/testsuite/ld-tic6x/shlib-app-1r.rd b/ld/testsuite/ld-tic6x/shlib-app-1r.rd
index f09738c..01ea188 100644
--- a/ld/testsuite/ld-tic6x/shlib-app-1r.rd
+++ b/ld/testsuite/ld-tic6x/shlib-app-1r.rd
@@ -9,7 +9,7 @@ Section Headers:
\[ 4\] \.rela\.got RELA 0000810c 00110c 000018 0c AI 2 10 4
\[ 5\] \.rela\.bss RELA 00008124 001124 00000c 0c AI 2 12 4
\[ 6\] \.dynamic DYNAMIC 00008130 001130 0000b8 08 WA 3 0 4
- \[ 7\] \.rela\.plt RELA 10000000 002000 00000c 0c AI 2 8 4
+ \[ 7\] \.rela\.plt RELA 10000000 002000 00000c 0c A 2 0 4
\[ 8\] \.plt PROGBITS 10000020 002020 000040 18 AX 0 0 32
\[ 9\] \.text PROGBITS 10000060 002060 000040 00 AX 0 0 32
\[10\] \.got PROGBITS 100000a0 0020a0 000020 00 WA 0 0 4
diff --git a/ld/testsuite/ld-tic6x/shlib-app-1rb.rd b/ld/testsuite/ld-tic6x/shlib-app-1rb.rd
index a49fc05..734c166 100644
--- a/ld/testsuite/ld-tic6x/shlib-app-1rb.rd
+++ b/ld/testsuite/ld-tic6x/shlib-app-1rb.rd
@@ -9,7 +9,7 @@ Section Headers:
\[ 4\] \.rela\.got RELA 00008110 001110 000018 0c AI 2 10 4
\[ 5\] \.rela\.bss RELA 00008128 001128 00000c 0c AI 2 12 4
\[ 6\] \.dynamic DYNAMIC 00008134 001134 0000b8 08 WA 3 0 4
- \[ 7\] \.rela\.plt RELA 10000000 002000 00000c 0c AI 2 8 4
+ \[ 7\] \.rela\.plt RELA 10000000 002000 00000c 0c A 2 0 4
\[ 8\] \.plt PROGBITS 10000020 002020 000040 18 AX 0 0 32
\[ 9\] \.text PROGBITS 10000060 002060 000040 00 AX 0 0 32
\[10\] \.got PROGBITS 100000a0 0020a0 000020 00 WA 0 0 4
diff --git a/ld/testsuite/ld-tic6x/shlib-noindex.rd b/ld/testsuite/ld-tic6x/shlib-noindex.rd
index 62d237b..06bdd11 100644
--- a/ld/testsuite/ld-tic6x/shlib-noindex.rd
+++ b/ld/testsuite/ld-tic6x/shlib-noindex.rd
@@ -10,7 +10,7 @@ Section Headers:
\[ 5\] \.rela\.got RELA 0000814c 00114c 000024 0c AI 2 11 4
\[ 6\] \.rela\.neardata RELA 00008170 001170 000018 0c AI 2 12 4
\[ 7\] \.dynamic DYNAMIC 00008188 001188 0000b0 08 WA 3 0 4
- \[ 8\] \.rela\.plt RELA 10000000 002000 000018 0c AI 2 9 4
+ \[ 8\] \.rela\.plt RELA 10000000 002000 000018 0c A 2 0 4
\[ 9\] \.plt PROGBITS 10000020 002020 000060 18 AX 0 0 32
\[10\] \.text PROGBITS 10000080 002080 000080 00 AX 0 0 32
\[11\] \.got PROGBITS 10000100 002100 000028 00 WA 0 0 4
--
2.1.0