[lld] r296580 - Improve comment.
Sean Silva via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 20:44:04 PST 2017
Author: silvas
Date: Tue Feb 28 22:44:04 2017
New Revision: 296580
URL: http://llvm.org/viewvc/llvm-project?rev=296580&view=rev
Log:
Improve comment.
Thanks to Rafael for helping to dig down into what we're really trying
to communicate here.
Modified:
lld/trunk/ELF/Symbols.cpp
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=296580&r1=296579&r2=296580&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Tue Feb 28 22:44:04 2017
@@ -74,12 +74,14 @@ static typename ELFT::uint getSymVA(cons
// 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;
More information about the llvm-commits
mailing list