[PATCH] D66279: [ELF] Make LinkerScript::assignAddresses iterative
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 02:26:01 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: grimar, peter.smith, ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
For the new test linkerscript/expr-converge.s, we currently set
st_value(a)=0xff00 and st_value(b)=0xff. PR42990
The following call tree demonstrates the problem:
link<ELF64LE>(Args);
Script->declareSymbols(); // insert a and b as absolute Defined
Writer<ELFT>().run();
Script->processSectionCommands();
addSymbol(cmd); // LinkerScript::getSymbolValue is used to retrieve values
finalizeSections();
forEachRelSec(scanRelocations<ELFT>);
processRelocAux // another problem PR42506, not affected by this patch
finalizeAddressDependentContent(); // loop executed once
script->assignAddresses(); // a = 0, b = 0xffff
script->assignAddresses(); // a = 0xff00, _end = 0xffff
This patch
1. modifies assignAddress to track the original section/value of each symbol and return a symbol whose section/value has changed.
2. moves the post-finalizeSections assignAddress() inside the loop of finalizeAddressDependentContent() and makes it iterative. Symbol assignment may not converge so we make a few attempts before bailing out.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D66279
Files:
ELF/LinkerScript.cpp
ELF/LinkerScript.h
ELF/Writer.cpp
test/ELF/linkerscript/expr-converge.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66279.215346.patch
Type: text/x-patch
Size: 3985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/da0b1998/attachment.bin>
More information about the llvm-commits
mailing list