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.
This commit is contained in:
parent
fa8761a3e0
commit
9ef5d93881
|
@ -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.
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2013-12-19 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR binutils/16317
|
||||
* binutils-all/readelf.s: Updated.
|
||||
* binutils-all/readelf.s-64: Likewise.
|
||||
|
||||
2013-12-13 Kuan-Lin Chen <kuanlinchentw@gmail.com>
|
||||
Wei-Cheng Wang <cole945@gmail.com>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Section Headers:
|
|||
# On the normal MIPS systems, sections must be aligned to 16 byte
|
||||
# boundaries. On IA64, text sections are aligned to 16 byte boundaries.
|
||||
+\[ 1\] .text +PROGBITS +00000000 0000(34|40) 0000(08|10) 00 +AX +0 +0 +(.|..)
|
||||
+\[ 2\] .rel.+text +REL. +0+ 0+.* 0000.. 0. +. +1 +4
|
||||
+\[ 2\] .rel.+text +REL. +0+ 0+.* 0000.. 0. +I +. +1 +4
|
||||
# MIPS targets put .rela.text here.
|
||||
#...
|
||||
+\[ .\] .data +PROGBITS +00000000 0000(3c|48|50) 0000(04|10) 00 +WA +0 +0 +(.|..)
|
||||
|
|
|
@ -8,7 +8,7 @@ Section Headers:
|
|||
+\[ 1\] .text +PROGBITS +0000000000000000 +00000040
|
||||
+00000000000000.. +0000000000000000 +AX +0 +0 +.*
|
||||
+\[ 2\] .rel.+text +REL. +0+ +0+.*
|
||||
+000000000000001. +000000000000001. +. +1 +8
|
||||
+000000000000001. +000000000000001. +I +. +1 +8
|
||||
+\[ 3\] .data +PROGBITS +0000000000000000 +000000(48|50)
|
||||
+000000000000000[48] +0000000000000000 +WA +0 +0 +.*
|
||||
+\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2013-12-19 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR binutils/16317
|
||||
* ld-elf/linkinfo1.s: New file.
|
||||
* ld-elf/linkinfo1a.d: Likewise.
|
||||
* ld-elf/linkinfo1b.d: Likewise.
|
||||
|
||||
2013-12-18 Vidya Praveen <vidyapraveen@arm.com>
|
||||
|
||||
* lib/ld-lib.exp (check_lto_available): Support cflags, ldflags and
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
.text
|
||||
call foo@PLT
|
|
@ -0,0 +1,8 @@
|
|||
#source: linkinfo1.s
|
||||
#ld: -shared
|
||||
#readelf: -SW
|
||||
#target: x86_64-* i?86-*
|
||||
|
||||
#...
|
||||
\[[ 0-9]+\] \.rel[a]?\.plt[ \t]+REL[A]?[ \t][ \t0-9a-f]+AI[ \t0-9a-f]+
|
||||
#pass
|
|
@ -0,0 +1,9 @@
|
|||
#source: linkinfo1.s
|
||||
#ld: -shared
|
||||
#objcopy_linked_file: --strip-debug
|
||||
#readelf: -SW
|
||||
#target: x86_64-* i?86-*
|
||||
|
||||
#...
|
||||
\[[ 0-9]+\] \.rel[a]?\.plt[ \t]+REL[A]?[ \t][ \t0-9a-f]+AI[ \t0-9a-f]+
|
||||
#pass
|
Loading…
Reference in New Issue