[LLVMdev] Handling ELF groups.
Michael Spencer
bigcheesegs at gmail.com
Wed Dec 19 16:25:20 PST 2012
So I was looking into handling ELF groups today in the Atom model. It
appears that we will need to add the concept of a group to the atom
model directly, as modeling it with references fails to capture some
semantics.
http://www.sco.com/developers/gabi/latest/ch4.sheader.html
Groups in ELF are collections of sections that must be either included
or excluded as a unit. They also are used to implement COMDAT. Each
group has an "identifying symbol entry" or "group signature". This is
only used in the case of COMDAT groups (which are marked with a flag).
When two COMDAT groups have the same group signature the linker must
select one (not specified how to pick) and discard _all_ members of
the other group.
Correctly implementing this requires knowing the group name for each
group and having the resolver remove the correct set of atoms on
collision. We also need to be able to explicitly track the identifying
symbol entry for the relocatable case.
An idea for implementing this would be to add a list of Groups to each
File. I don't believe a Group should be an atom as it has different
semantics and would have to be treated specially everywhere.
A group would have a name, merge attribute, and a list of atoms it contains.
YAML mockup:
---
groups:
- name: _Z4funcIiET_S0_
merge: pickAny
members: [_Z4funcIiET_S0_, ".debug._Z4funcIiET_S0_"]
atoms:
- name _Z4funcIiET_S0_
scope: global
merge: asWeak
type: code
...
The main problem I see with this is that groups are no longer
represented explicitly in the reference graph.
- Michael Spencer
More information about the llvm-dev
mailing list