This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
GAS always places section groups (SHT_GROUP) before the rest of the
sections in the output file. However, other assemblers may place
section groups after the group members.
Example in the object attached, xdfdh.o:
COMDAT group section [ 12] `.group.__cg_vis_memcpy' [__cg_vis_memcpy]
contains 1 sections:
[Index] Name
[ 4] .text.__cg_vis_memcpy
Note how .text.__cg_vis_memcpy (idx 4) is placed before
.group.__cg_vis_memcpy (idx 12).
This is not handled properly by BFD. The patch below makes sure to
create BFD sections for all the SHT_GROUP sections in the input file
before processing SHF_GROUP sections.
Tested in sparc64-linux-gnu and x86_64-linux-gnu.
No regressions.
PS: I looked into creating a test for this, but couldn't find a way to
create such an object file with GAS, nor to reorder the sections.
Adding a binary object to the LD testsuite is probably a no-no. Any
suggestion?
2017-06-05 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf.c (setup_group): Make sure BFD sections are created for all
group sections in the input file when processing SHF_GROUP
sections.
diff --git a/bfd/elf.c b/bfd/elf.c
index 34d39c5..1cc0952 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -636,6 +636,11 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
unsigned char *src;
Elf_Internal_Group *dest;
+ /* Make sure the group section has a BFD section
+ attached to it. */
+ if (!bfd_section_from_shdr (abfd, i))
+ return FALSE;
+
/* Add to list of sections. */
elf_tdata (abfd)->group_sect_ptr[num_group] = shdr;
num_group += 1;
Attachment:
xdfdh.o
Description: application/object
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |