aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-12-19 11:34:47 -0800
committerH.J. Lu <hjl.tools@gmail.com>2013-12-19 11:34:47 -0800
commit9ef5d938819dff73d7640a2654b07df64670d7f9 (patch)
tree035e8760ec659165e1dc2d2665604c02d3a85f33 /bfd
parentfa8761a3e0d999ada63194291ddf9b308a8d8276 (diff)
downloadgdb-9ef5d938819dff73d7640a2654b07df64670d7f9.zip
gdb-9ef5d938819dff73d7640a2654b07df64670d7f9.tar.gz
gdb-9ef5d938819dff73d7640a2654b07df64670d7f9.tar.bz2
Set SHF_INFO_LINK bit for SHT_REL/SHT_RELA sections
It is a good pratice to set the SHF_INFO_LINK bit when the sh_info field represents a section header index. bfd/ PR binutils/16317 * elf.c (assign_section_numbers): Set the SHF_INFO_LINK bit for SHT_REL/SHT_RELA sections when setting the sh_info field. binutils/testsuite/ PR binutils/16317 * binutils-all/readelf.s: Updated. * binutils-all/readelf.s-64: Likewise. ld/testsuite/ PR binutils/16317 * ld-elf/linkinfo1.s: New file. * ld-elf/linkinfo1a.d: Likewise. * ld-elf/linkinfo1b.d: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf.c7
2 files changed, 12 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 95355fc..70c7e72 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2013-12-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/16317
+ * elf.c (assign_section_numbers): Set the SHF_INFO_LINK bit for
+ SHT_REL/SHT_RELA sections when setting the sh_info field.
+
2013-12-19 Pierre Muller <muller@sourceware.org>
* peXXigen.c (rsrc_cmp): Fix unused variable warning.
diff --git a/bfd/elf.c b/bfd/elf.c
index b589e60..59b1d4b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3075,11 +3075,13 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
{
d->rel.hdr->sh_link = elf_onesymtab (abfd);
d->rel.hdr->sh_info = d->this_idx;
+ d->rel.hdr->sh_flags |= SHF_INFO_LINK;
}
if (d->rela.idx != 0)
{
d->rela.hdr->sh_link = elf_onesymtab (abfd);
d->rela.hdr->sh_info = d->this_idx;
+ d->rela.hdr->sh_flags |= SHF_INFO_LINK;
}
/* We need to set up sh_link for SHF_LINK_ORDER. */
@@ -3166,7 +3168,10 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
name += 5;
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_info = elf_section_data (s)->this_idx;
+ d->this_hdr.sh_flags |= SHF_INFO_LINK;
+ }
break;
case SHT_STRTAB: