summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/linkerscript/early-assign-symbol.s
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Revert r370635, it caused PR43241."Fangrui Song2019-09-061-4/+7
| | | | | | This reverts commit 50d2dca22b3b05d0ee4883b0cbf93d7d15f241fc. llvm-svn: 371215
* Revert r370635, it caused PR43241.Nico Weber2019-09-061-7/+4
| | | | llvm-svn: 371202
* [ELF] Do not ICF two sections with different output sections (by SECTIONS ↵Fangrui Song2019-09-021-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commands) Fixes PR39418. Complements D47241 (the non-linker-script case). processSectionCommands() assigns input sections to output sections. ICF is called before it, so .text.foo and .text.bar may be folded even if their output sections are made different by SECTIONS commands. ``` markLive<ELFT>() doIcf<ELFT>() // During ICF, we don't know the output sections writeResult() combineEhSections<ELFT>() script->processSectionCommands() // InputSection -> OutputSection assignment ``` This patch splits processSectionCommands() into processSectionCommands() and processSymbolAssignments(), and moves processSectionCommands() before ICF: ``` markLive<ELFT>() combineEhSections<ELFT>() script->processSectionCommands() doIcf<ELFT>() // should remove folded input sections writeResult() script->processSymbolAssignments() ``` An alternative approach is to unfold a section `sec` in processSectionCommands() when we find `sec` and `sec->repl` belong to different output sections. I feel this patch is superior because this can fold more sections and the decouple of SectionCommand/SymbolAssignment gives flexibility: * An ExprValue can't be evaluated before its section is assigned to an output section -> we can delete getOutputSectionVA and simplify another place where we had to check if the output section is null. Moreover, a case in linkerscript/early-assign-symbol.s can be handled now. * processSectionCommands/processSymbolAssignments can be freely moved around. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D66717 llvm-svn: 370635
* Consider only A.Sec in moveAbsRight.Rafael Espindola2017-09-201-3/+4
| | | | | | | | | | | | | | The idea of this function is to simplify the implementation of binary operators like add. A value might be absolute because of an ABSOLUTE expression, but it still depends on the value of a section and we might not be able to evaluate it early. We should keep such values on the LHS, so that we can delay the evaluation. We can now handle both "1 + ABSOLUTE(foo)" and "ABSOLUTE(foo) + 1". llvm-svn: 313794
* Add a special case for trivial alignment.Rafael Espindola2017-09-201-4/+10
| | | | | | | | | | | Normally to find the offset of a value in a section, we have to compute the value since the alignment is defined on the final address. If the alignment is trivial, we can skip the value computation. This allows us to know the offset even in cases where we cannot yet know the value. llvm-svn: 313777
* Don't try to compute a value that is known to fail.Rafael Espindola2017-09-201-0/+4
| | | | | | | | | We try to evaluate expressions early when possible, but it is not possible to evaluate them early if they are based on a section. Before we would get this wrong on ABSOLUTE expressions. llvm-svn: 313764
* [ELF] - Do not segfault when doing logical and/or operations on symbols that ↵George Rimar2017-08-211-0/+3
| | | | | | | | | | | have no output sections. Previously we would crash on samples from testcase, because were trying to access zero pointer to output section. Differential revision: https://reviews.llvm.org/D36145 llvm-svn: 311311
* [ELF] - Linkerscript: improved error reporting.George Rimar2017-06-071-1/+1
| | | | | | | | | | | | | | | | When linking linux kernel LLD currently reports next errors: ld: error: unable to evaluate expression: input section .head.text has no output section assigned ld: error: At least one side of the expression must be absolute ld: error: At least one side of the expression must be absolute That does not provide file/line information and overall looks unclear. Patch adds location information to ExprValue and that allows to provide more clear error messages. Differential revision: https://reviews.llvm.org/D33943 llvm-svn: 304881
* [ELF] - Make text section location explicit in early-assign-symbol.s test.George Rimar2017-05-111-2/+2
| | | | | | | | Testcase itself depends on .text section location, which was orphan earlier. Suggested by Rafael Espíndola llvm-svn: 302792
* [ELF] - Don't segfault when assigning non-calculatable absolute symbol value.George Rimar2017-05-101-0/+14
This is PR32664. Issue was revealed by linux kernel script which was: SECTIONS { . = (0xffffffff80000000 + ALIGN(0x1000000, 0x200000)); phys_startup_64 = ABSOLUTE(startup_64 - 0xffffffff80000000); .text : AT(ADDR(.text) - 0xffffffff80000000) { ..... *(.head.text) Where startup_64 is in .head.text. At the place of assignment to phys_startup_64 we can not calculate absolute value for startup_64 because .text section has no VA assigned. Two patches were prepared earlier to address this: D32173 and D32174. And in comments for D32173 was suggested not try to support this case, but error out. Differential revision: https://reviews.llvm.org/D32793 llvm-svn: 302668
OpenPOWER on IntegriCloud