diff options
author | Alan Modra <amodra@gmail.com> | 2017-10-04 09:53:53 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-10-05 08:38:11 +1030 |
commit | db4677b8bd90b49f826807352c6c3c7eb0d57814 (patch) | |
tree | c73ecf5bd1a49511dfcf9e73292569557949e7a2 /gas/testsuite/gas/mips | |
parent | 5cd63fda035d4ba949e6478406162c4673b3c9ef (diff) | |
download | binutils-gdb-db4677b8bd90b49f826807352c6c3c7eb0d57814.tar.gz |
PR21167, relocation sections not included in groups
This fixes a wart I've known about for years, but haven't done
anything about because BFD treats relocation sections as an adjunct to
the section they relocate. SHF_GROUP on the section thus implicitly
applies to its relocation section(s), but it is an error that the
reloc sections aren't part of the group.
Like many patches to gas, this wasn't as straightforward as it could
be due to a number of backends, i386, cr16 and others, removing relocs
in tc_get_reloc rather than marking them as "done" earlier in
md_apply_reloc. So it isn't possible for the group support to
reliably detect the presence of relocs by looking at fixups earlier
than write_relocs. However the group support needs to create
signature symbols, and that must be done before the symbol table is
frozen, before write_relocs. So split off the group sizing from
elf_adjust_symtab and put it in elf_frob_file_after_relocs.
bfd/
PR 21167
* elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
groups.
(_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
flag from section.
(elf_fake_sections): Adjust calls. Exit immediately on failure.
(bfd_elf_set_group_contents): Add associated reloc section indices
to group contents
gas/
PR 21167
* config/obj-elf.c (struct group_list): Delete elt_count.
(groups): New static.
(build_group_lists): Don't count elements.
(elf_adjust_symtab): Use groups rather than auto list. Set up
pointer from group member to SHT_GROUP section. Don't size
SHT_GROUP section or clean up here..
(elf_frob_file_after_relocs): ..do so here instead.
* testsuite/gas/arc/jli-1.d,
* testsuite/gas/elf/groupautob.d,
* testsuite/gas/mips/compact-eh-eb-2.d,
* testsuite/gas/mips/compact-eh-eb-5.d,
* testsuite/gas/mips/compact-eh-el-2.d,
* testsuite/gas/mips/compact-eh-el-5.d: Adjust.
ld/
PR 21167
* testsuite/ld-elf/group9b.d: Adjust for relocs included in group.
Diffstat (limited to 'gas/testsuite/gas/mips')
-rw-r--r-- | gas/testsuite/gas/mips/compact-eh-eb-2.d | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/compact-eh-eb-5.d | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/compact-eh-el-2.d | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/mips/compact-eh-el-5.d | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/gas/testsuite/gas/mips/compact-eh-eb-2.d b/gas/testsuite/gas/mips/compact-eh-eb-2.d index 226a5ffe81e..feefafa8809 100644 --- a/gas/testsuite/gas/mips/compact-eh-eb-2.d +++ b/gas/testsuite/gas/mips/compact-eh-eb-2.d @@ -23,7 +23,7 @@ OFFSET TYPE VALUE Contents of section .group: - 0000 00000001 00000007 .* + 0000 00000001 00000007 00000008 .* Contents of section .text: 0000 00000000.* Contents of section .reginfo: diff --git a/gas/testsuite/gas/mips/compact-eh-eb-5.d b/gas/testsuite/gas/mips/compact-eh-eb-5.d index fd278a16f4a..79a65bb31c2 100644 --- a/gas/testsuite/gas/mips/compact-eh-eb-5.d +++ b/gas/testsuite/gas/mips/compact-eh-eb-5.d @@ -23,7 +23,7 @@ OFFSET TYPE VALUE Contents of section .group: - 0000 00000001 00000007 .* + 0000 00000001 00000007 00000008 .* Contents of section .text: 0000 00000000 00000000 00000000 00000000 .* 0010 00000000.* diff --git a/gas/testsuite/gas/mips/compact-eh-el-2.d b/gas/testsuite/gas/mips/compact-eh-el-2.d index 80627ebddcb..f5fe968d2e5 100644 --- a/gas/testsuite/gas/mips/compact-eh-el-2.d +++ b/gas/testsuite/gas/mips/compact-eh-el-2.d @@ -23,7 +23,7 @@ OFFSET TYPE VALUE Contents of section .group: - 0000 01000000 07000000 .* + 0000 01000000 07000000 08000000 .* Contents of section .text: 0000 00000000.* Contents of section .reginfo: diff --git a/gas/testsuite/gas/mips/compact-eh-el-5.d b/gas/testsuite/gas/mips/compact-eh-el-5.d index 7f0762290ca..aa8433290de 100644 --- a/gas/testsuite/gas/mips/compact-eh-el-5.d +++ b/gas/testsuite/gas/mips/compact-eh-el-5.d @@ -22,7 +22,7 @@ OFFSET TYPE VALUE Contents of section .group: - 0000 01000000 07000000 .* + 0000 01000000 07000000 08000000 .* Contents of section .text: 0000 00000000 00000000 00000000 00000000 .* 0010 00000000.* |