This is the mail archive of the 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]

Re: Copying .group sections using BFD

On Wed, Jan 28, 2015 at 04:57:22PM -0600, Andrew Geissler wrote:
> And for reference, can anyone explain what a .group section is used
> for?  I haven't been able to find a clear explanation of it.


SHT_GROUP sections are used to tell a linker that a certain group of
sections in a relocatable object file must be handled as a group.
For example, they must all be included in the final executable, or all

On file, a SHT_GROUP section contents consists of an array of 32-bit
words.  The first is a flag word, the rest are section indices
specifying which sections are members of the group.  If you are using
BFD, then the section contents will have been translated to a flag
word followed by struct bfd_section pointers.  On a 64-bit host that
means all elements of the array are 64-bit.  However, you normally
wouldn't have any need to manipulate the SHT_GROUP section contents.

> I've done a lot of googling and searching but I haven't found much
> that has to do with copying a .group section over. The most obvious
> example is in objcopy.c but in setup_section() I see internal calls to
> code like group_signature (i.e. using Elf_Internal_Shdr) which is not
> available when compiling using the standard BFD libraries.  I also see
> that the skip_section() interface will return true for SEC_GROUP
> sections so I'm assuming on a copy of a group, just the code in
> setup_section() is needed?

Yes, don't try to copy the group section contents yourself.  Steal the
objcopy.c code, to have BFD recreate the group.  In particular, you'll
need to set up the group signature symbol and call

Alan Modra
Australia Development Lab, IBM

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]