summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/linkerscript/Inputs
Commit message (Collapse)AuthorAgeFilesLines
* Copy test data so tests don't traverse test directories. NFCRichard Trieu2019-08-261-0/+70
| | | | llvm-svn: 369984
* [LLD] Do not overwrite LMAOffset of PT_LOAD headerGeorge Rimar2018-08-021-0/+8
| | | | | | | | | | | | Patch by Konstantin Schwarz! If more than a single output section is added to a PT_LOAD header, only the first section should set the LMAOffset of the segment. Otherwise, we get a load-address overlap error Differential revision: https://reviews.llvm.org/D50133 llvm-svn: 338697
* [LLD] Only increase LMARegion if different from MemRegionGeorge Rimar2018-08-021-0/+7
| | | | | | | | | | | | Patch by Konstantin Schwarz! If both the MemRegion and LMARegion are set for an output section in a linker script, we should only increase the LMARegion if it is different from the MemRegion. Otherwise, we reserve the memory twice. Differential revision: https://reviews.llvm.org/D50065 llvm-svn: 338684
* [LLD] - Improve handling of AT> linker script commandsGeorge Rimar2018-08-021-0/+11
| | | | | | | | | | | | | Patch by Konstantin Schwarz! The condition to create a new phdr must also check the usage of "AT>" linker script command, and create a new PT_LOAD header if a new LMARegion is used. This fixes PR38307 Differential revision: https://reviews.llvm.org/D50052 llvm-svn: 338679
* [ELF] - Print LMA in a -Map file.George Rimar2018-04-051-0/+19
| | | | | | | | | | Currently, LLD prints VA, but not LMA in a map file. It seems can be useful to print both to reveal layout details and patch implements it. Differential revision: https://reviews.llvm.org/D44899 llvm-svn: 329271
* [ELF] - Restrict section offsets that exceeds file size.George Rimar2018-03-131-0/+6
| | | | | | | | | | | | | | | | | This is part of PR36515. With some linkerscripts it is possible to get file offset overlaps and overflows. Currently LLD checks overlaps in checkNoOverlappingSections(). And also we allow broken output with --no-inhibit-exec. Problem is that sometimes final offset of sections is completely broken and we calculate output file size wrong and might crash. Patch implements check to verify that there is no output section which offset exceeds file size. Differential revision: https://reviews.llvm.org/D43819 llvm-svn: 327376
* [ELF] - Support "INSERT AFTER" statement.George Rimar2018-03-082-0/+15
| | | | | | | | | | | | | | | | | | | | This implements INSERT AFTER in a following way: During reading scripts it collects all insert statements. After we done and read all files it inserts statements into script commands list. With that: * Rest of code does know nothing about INSERT. * Approach is straightforward and have no visible limitations. * It is also easy to support INSERT BEFORE (was seen in clang code once). * Should work for PR35877 and similar cases. Cons: * It assumes we have "main" scripts that describes sections. Differential revision: https://reviews.llvm.org/D43468 llvm-svn: 327003
* Convert more tests as linker scripts instead of assembly.Rui Ueyama2018-03-016-0/+79
| | | | llvm-svn: 326415
* Convert more .s files to linker script files.Rui Ueyama2018-03-016-0/+78
| | | | | | | | | | | | | | Summary: This change removes large "echo" commands from the test by writing tests themselves as linker scripts. Reviewers: rafael Subscribers: emaste, javed.absar, llvm-commits, arichardson Differential Revision: https://reviews.llvm.org/D43900 llvm-svn: 326403
* [ELF] Create and export symbols provided by a linker script if they ↵Igor Kudrin2018-02-271-0/+3
| | | | | | | | | | | referenced by DSOs. It should be possible to resolve undefined symbols in dynamic libraries using symbols defined in a linker script. Differential Revision: https://reviews.llvm.org/D43011 llvm-svn: 326176
* [ELF] - Simplify testcase. NFC.George Rimar2018-02-211-12/+0
| | | | | | | | This removes script input file and inlines script into testcase body. That is consistent with othet LS tests and makes testcase easier to read. llvm-svn: 325673
* Add missing test. NFC.Rafael Espindola2017-11-301-0/+5
| | | | | | | | | | We had no tests for what PROVIDE should do if there is a shared symbol with the same name. In both bfd and our existing implementation PROVIDE wins. Add a test for that. llvm-svn: 319486
* Handle copy relocations in symbol assignments.Rafael Espindola2017-11-301-0/+5
| | | | | | | | | | | When a linker script has "foo = bar" and bar is the result of a copy relocation foo should point to the same location in .bss. This is part of a growing evidence that copy relocations should be implemented by using replaceSymbol to replace the SharedSymbol with a Defined. llvm-svn: 319449
* Currently lld creates a single section to collect all commons. There is no wayDmitry Mikulin2017-09-082-0/+4
| | | | | | | | | | | | | | | to separate commons based on file name patterns. The following linker script construct does not work because commons are allocated before section placement is done and the only synthesized BssSection that holds all commons has no file associated with it: SECTIONS { .common_0 : { *file0.o(COMMON) }} This patch changes the allocation of commons to create a section per common symbol and let the section logic do the layout. Differential revision: https://reviews.llvm.org/D37489 llvm-svn: 312796
* [ELF] Align the value if needed when computing the expressionPetr Hosek2017-07-201-0/+5
| | | | | | | | | Also add the test cases for the addition and subtraction both for the relative and absolute case. Differential Revision: https://reviews.llvm.org/D35346 llvm-svn: 308692
* [ELF] - Linkerscript: support combination of linkerscript and ↵George Rimar2017-05-081-0/+3
| | | | | | | | | | | | --compress-debug-sections. Previously it was impossible to use linkerscript with --compress-debug-sections because of assert failture: Assertion failed: isFinalized(), file C:\llvm\lib\MC\StringTableBuilder.cpp, line 64 Patch fixes the issue llvm-svn: 302413
* [ELF] Insert linkerscript symbols directly into symbol tablePetr Hosek2017-02-211-0/+2
| | | | | | | | | | This change exposes the symbol table insert method and uses it to insert the linkerscript defined symbols directly into the symbol table to avoid unnecessarily pulling the object out of an archive. Differential Revision: https://reviews.llvm.org/D30224 llvm-svn: 295780
* Fix program header propagation.Rafael Espindola2016-11-141-0/+12
| | | | | | | | | | Propagate program headers by walking the commands, not the sections. This allows us to propagate program headers even from sections that don't end up in the output. Fixes pr30997. llvm-svn: 286837
* [ELF] make KEEP command recognize file patternsEugene Leviant2016-10-051-0/+2
| | | | | | Differential revision: https://reviews.llvm.org/D25242 llvm-svn: 283305
* Linkerscript: don't crash when GC .debug_lineEugene Leviant2016-09-261-0/+5
| | | | | | Differential revision: https://reviews.llvm.org/D24870 llvm-svn: 282393
* [ELF] - SEGMENT_START's default argument can be an expressionGeorge Rimar2016-09-171-1/+1
| | | | | | | | | | | Our implementation supported integer value previously. ld can use expression, for example, it is OK to write . = SEGMENT_START("foobar", .); Patch implements that. llvm-svn: 281831
* Recommit r281721 "[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle ↵George Rimar2016-09-162-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of a input section description." With fix for 2 bots. Details about the fix performed is on a review page. Initial commit message: This is PR30387: From PR description: We fail to parse SECTIONS { foo : { *(sec0 EXCLUDE_FILE (zed1.o) sec1 EXCLUDE_FILE (zed2.o) sec2 ) } } The semantics according to bfd are: Include sec1 from every file but zed1.o Include sec2 from every file but zed2.o Include sec0 from every file Patch implements the support. Differential revision: https://reviews.llvm.org/D24650 llvm-svn: 281754
* Reverted r281721 ("[ELF] - Linkerscript: implement EXCLUDE_FILE in the ↵George Rimar2016-09-162-16/+0
| | | | | | | | | middle of a input section description."). It broke build bot: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27508 llvm-svn: 281723
* [ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of a input ↵George Rimar2016-09-162-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | section description. This is PR30387: From PR description: We fail to parse SECTIONS { foo : { *(sec0 EXCLUDE_FILE (zed1.o) sec1 EXCLUDE_FILE (zed2.o) sec2 ) } } The semantics according to bfd are: Include sec1 from every file but zed1.o Include sec2 from every file but zed2.o Include sec0 from every file Patch implements the support. Differential revision: https://reviews.llvm.org/D24650 llvm-svn: 281721
* Remove useless file prefix.Rui Ueyama2016-09-024-0/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D24207 llvm-svn: 280540
* [ELF] - Fix for PR28976 - Corrupted section contents when using linker scriptsGeorge Rimar2016-08-191-0/+3
| | | | | | | | | | | | This is fix for PR28976. Problem was that in scanRelocs, we computed relocation offset too early for case when linkerscript was used. Patch fixes the issue delaying the calculation. Differential revision: https://reviews.llvm.org/D23655 llvm-svn: 279264
* [ELF] - Linkerscript: support all kinds of sorting (including nested).George Rimar2016-08-032-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we supported only sorting by name. When there are nested section sorting commands in linker script, there can be at most 1 level of nesting for section sorting commands. SORT_BY_NAME (SORT_BY_ALIGNMENT (wildcard section pattern)). It will sort the input sections by name first, then by alignment if 2 sections have the same name. SORT_BY_ALIGNMENT (SORT_BY_NAME (wildcard section pattern)). It will sort the input sections by alignment first, then by name if 2 sections have the same alignment. SORT_BY_NAME (SORT_BY_NAME (wildcard section pattern)) is treated the same as SORT_ BY_NAME (wildcard section pattern). SORT_BY_ALIGNMENT (SORT_BY_ALIGNMENT (wildcard section pattern)) is treated the same as SORT_BY_ALIGNMENT (wildcard section pattern). All other nested section sorting commands are invalid. Patch implements that all above. Differential revision: https://reviews.llvm.org/D23019 llvm-svn: 277583
* [ELF] - Linkerscript: Implemented SORT command.George Rimar2016-07-291-0/+14
| | | | | | | | | | | | When the SORT keyword is used, the linker will sort the files or sections into ascending order by name before placing them in the output file. It is used in FreeBSD script: https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l139 This is PR28689. Differential revision: https://reviews.llvm.org/D22749 llvm-svn: 277153
* [ELF] - Linkerscript: implemented filename specification.George Rimar2016-07-281-0/+2
| | | | | | | | | | | | | | | Scripts can contain something like: KEEP (*crtbegin.o(.ctors)) What means that "*crtbegin.o" is a wildcard of file to take the sections from. This is some kind of opposite to EXCLUDE_FILE and used in FreeBSD script: https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l122 Patch implements this. Differential revision: https://reviews.llvm.org/D22852 llvm-svn: 277042
* Add support for SEGMENT_START.Rafael Espindola2016-07-281-0/+7
| | | | | | | | | | | | | | | | | | This is a bit of an odd feature. It is normally used in . = SEGMENT_START(seg, val); In bfd it evaluates to val or to the value of the corresponding -T<seg>-segment. Note that the -T<seg>-segment in bfd doesn't actually change the segment address, just the value this evaluates too, including in the default linker script. In gold the -T<seg>-segment options do change the segment address and seeing this expressions in linker scripts disables the options. For new this just always evaluates the expression to val. llvm-svn: 277014
* [ELF/LinkerScript] Support EXCLUDE_FILE inside KEEP.Davide Italiano2016-07-272-0/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D22795 llvm-svn: 276825
* [ELF] Linkerscript: implement DATA_SEGMENT_RELRO_END.George Rimar2016-07-261-0/+10
| | | | | | | | | | | | | | | | | | | | In compare with what GNU linkers do (https://sourceware.org/binutils/docs/ld/Builtin-Functions.html), this implementation simple: Do not touch DATA_SEGMENT_ALIGN, it do what it do now - just aligns to the page boundary. Parameters of DATA_SEGMENT_RELRO_END is ignored. That should be correct as it is usually just a 24 bytes shift that allows to protect first 3 entries of got.plt with relro. (https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l146). DATA_SEGMENT_RELRO_END just aligns to the page boundary. That is what expected because all sections that are not affected by relro should be on another memory page. So at fact the difference with documented behavior is that we do not pad DATA_SEGMENT_ALIGN. 3 entries of got.plt are uncovered by relro, but functionality is simple and equal to lld behavior for case when script is not given. Differential revision: https://reviews.llvm.org/D22813 llvm-svn: 276778
* [ELF] Move linker script tests to a subdirectory. NFCI.Davide Italiano2016-07-242-0/+6
llvm-svn: 276582
OpenPOWER on IntegriCloud