That kind of reference was used only in ELFFile, and the use of
that reference there didn't seem to make sense. All test still
pass (after adjusting symbol names) without that code. LLD is
still be able to link LLD and Clang. Looks like we just don't
From what I recall, ELF has the semantics that you cannot just remove an atom in the middle of a section, because there is not enough relocations in the section to fix up the remaining (e.g CALLs to static functions in the same section don't have relocations on them, so if the distance changed because some atom between the two was removed, the CALL now be to the new location). The group reference was a way to keep all atoms in a section together.
This is mainly relevant when you turn on garbage collection as Nick pointed out. You can refer to an atom in a section but to keep the section to be consistent w.r.t ELF you have to keep all the remaining atoms together.
I think it's not for garbage collection. Because all atoms in the same
section are already connected with LayoutAfter references, they are treated
as a group by the garbage collector.
2015/01/26 19:25 "Shankar Easwaran" <firstname.lastname@example.org>:
This is mainly relevant when you turn on garbage collection as Nick
pointed out. You can refer to an atom in a section but to keep the section
to be consistent w.r.t ELF you have to keep all the remaining atoms
That's not correct. As you may know (because you are the person who implemented section group support to LLD), kindInGroup is not used to implement section group. Please take a look at the code, this piece of code doesn't seem to do anything meaningful including section groups.
Sorry to club this in the current review thread, I think we are overloading the Layout references for garbage collection.
If you are creating a reference (kindLayoutAfter) from A to B, that may not mean that you cannot garbage collect B for the end user.
My thought on Layout references was that it only guarantees that atoms appear in Layout reference order.
Why are we overloading this for Garbage collection (aside from saving space/code) ?
We should create kindLive (or) some better name IMO for Garbage collection. With this the complex LayoutPass can be optional and would be meant only for users that need the LayoutReferences to specify layout of the image.
We could come up with a simpler pass for Layout(to sort atoms by file ordinal).
What do you think ?
Sorry, Shankar, I don't get what you mean by "Section groups is only implemented in lld/Core". Can you please take a look at the diff? kindInGroup was used only in ELFFile.h, and that use didn't make sense. I'm just trying to delete dead code by this change. This change didn't change functionality, LLD is still able to link itself/Clang, nothing more than that.