summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2018-04-09 13:01:50 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2018-04-09 13:01:50 +0000
commit0029f214820d79bf09a9c5c3152012ef9eb4348a (patch)
tree71d0eca1a5ec7e520eebecea0d9425ffc39564e7 /lld/ELF/LinkerScript.cpp
parent9bc20fff4ad2a5bf38e942c9e24ae8a2240ec7e8 (diff)
downloadbcm5719-llvm-0029f214820d79bf09a9c5c3152012ef9eb4348a.tar.gz
bcm5719-llvm-0029f214820d79bf09a9c5c3152012ef9eb4348a.zip
[ELF] - Stop setting OutSecOff too early.
Currently LLD sets OutSecOff in addSection for input sections. That is a fake offset (just a rude approximation to remember the order), used for sorting SHF_LINK_ORDER sections (see resolveShfLinkOrder, compareByFilePosition). There are 2 problems with such approach: 1. We currently change and reuse Size field as a value assigned. Changing size is not good because leads to bugs. Currently, SIZEOF(.bss) for empty .bss returns 2 because we add two empty synthetic sections and increase size twice by 1. (See PR37011: https://bugs.llvm.org/show_bug.cgi?id=37011) 2. Such approach simply does not work when --symbol-ordering-file is involved, because processing of the ordering file might break the initial section order. This fixes PR37011. Differential revision: https://reviews.llvm.org/D45368 llvm-svn: 329560
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r--lld/ELF/LinkerScript.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 15751b876e0..7d372aca650 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -777,9 +777,8 @@ void LinkerScript::assignOffsets(OutputSection *Sec) {
if (PhdrEntry *L = Ctx->OutSec->PtLoad)
L->LMAOffset = Ctx->LMAOffset;
- // The Size previously denoted how many InputSections had been added to this
- // section, and was used for sorting SHF_LINK_ORDER sections. Reset it to
- // compute the actual size value.
+ // We can call this method multiple times during the creation of
+ // thunks and want to start over calculation each time.
Sec->Size = 0;
// We visited SectionsCommands from processSectionCommands to
OpenPOWER on IntegriCloud