diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-01-24 15:48:26 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-01-24 15:48:26 +0000 |
commit | a4e0f76208b2d56ee4b92735bf28275f8d5ff819 (patch) | |
tree | ca8d214d4071945e6bfb8df8f352ae767942165a /ELF/ScriptParser.cpp | |
parent | 29428941e27149f45d47b77da00b80b2438bbca7 (diff) |
Merging r322359, r322421, and r322801:
------------------------------------------------------------------------
r322359 | grimar | 2018-01-12 10:07:35 +0100 (Fri, 12 Jan 2018) | 8 lines
[ELF] - Fix for ld.lld does not accept "AT" syntax for declaring LMA region
AT> lma_region expression allows to specify the memory region
for section load address.
Should fix PR35684.
Differential revision: https://reviews.llvm.org/D41397
------------------------------------------------------------------------
------------------------------------------------------------------------
r322421 | rafael | 2018-01-13 00:26:25 +0100 (Sat, 13 Jan 2018) | 9 lines
Fix incorrect physical address on self-referencing AT command.
When a section placement (AT) command references the section itself,
the physical address of the section in the ELF header was calculated
incorrectly due to alignment happening right after the location
pointer's value was captured.
The problem was diagnosed and the first version of the patch written
by Erick Reyes.
------------------------------------------------------------------------
------------------------------------------------------------------------
r322801 | rafael | 2018-01-18 02:14:57 +0100 (Thu, 18 Jan 2018) | 5 lines
Handle parsing AT(ADDR(.foo-bar)).
The problem we had with it is that anything inside an AT is an
expression, so we failed to parse the section name because of the - in
it.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/lld/branches/release_60@323336 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'ELF/ScriptParser.cpp')
-rw-r--r-- | ELF/ScriptParser.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ELF/ScriptParser.cpp b/ELF/ScriptParser.cpp index 426394498..e068beeee 100644 --- a/ELF/ScriptParser.cpp +++ b/ELF/ScriptParser.cpp @@ -709,6 +709,14 @@ OutputSection *ScriptParser::readOutputSectionDescription(StringRef OutSec) { if (consume(">")) Cmd->MemoryRegionName = next(); + if (consume("AT")) { + expect(">"); + Cmd->LMARegionName = next(); + } + + if (Cmd->LMAExpr && !Cmd->LMARegionName.empty()) + error("section can't have both LMA and a load region"); + Cmd->Phdrs = readOutputSectionPhdrs(); if (consume("=")) @@ -922,7 +930,10 @@ ByteCommand *ScriptParser::readByteCommand(StringRef Tok) { StringRef ScriptParser::readParenLiteral() { expect("("); + bool Orig = InExpr; + InExpr = false; StringRef Tok = next(); + InExpr = Orig; expect(")"); return Tok; } |