Improve comment.

Thanks to Rafael for helping to dig down into what we're really trying
to communicate here.

llvm-svn: 296580
This commit is contained in:
Sean Silva 2017-03-01 04:44:04 +00:00
parent 6f9b60cf38
commit d4e606273b
1 changed files with 8 additions and 6 deletions

View File

@ -74,12 +74,14 @@ static typename ELFT::uint getSymVA(const SymbolBody &Body, int64_t &Addend) {
// An object in an SHF_MERGE section might be referenced via a
// section symbol (as a hack for reducing the number of local
// symbols).
// We must incorporate the addend into the section offset (and
// zero out the addend for later processing) so that we find the
// right object in the section.
// Note that for an ordinary symbol we do not perform this
// adjustment and thus effectively assume that the addend cannot
// cross the boundaries of mergeable objects.
// Depending on the addend, the reference via a section symbol
// refers to a different object in the merge section.
// Since the objects in the merge section are not necessarily
// contiguous in the output, the addend can thus affect the final
// VA in a non-linear way.
// To make this work, we incorporate the addend into the section
// offset (and zero out the addend for later processing) so that
// we find the right object in the section.
if (D.isSection()) {
Offset += Addend;
Addend = 0;