summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/linkerscript
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "Revert "Only restrict order if both sections are in the script.""Rafael Espindola2016-09-203-5/+21
| | | | | | | | | | | | | | | | | | | This reverts commit r282021, bringing back r282015. The problem was that the comparison function was not a strict weak ordering anymore, which this patch fixes. Original message: Only restrict order if both sections are in the script. This matches gold and bfd behavior and is required to handle some scripts. The script has to assume where PT_LOADs start in order to align that spot. If we don't allow section it doesn't know about to move to the middle, we can need more PT_LOADs and those will not be aligned. llvm-svn: 282035
* Revert "Only restrict order if both sections are in the script."Rafael Espindola2016-09-203-21/+5
| | | | | | This reverts commit r282015. It broke some bots. llvm-svn: 282021
* Only restrict order if both sections are in the script.Rafael Espindola2016-09-203-5/+21
| | | | | | | | | | This matches gold and bfd behavior and is required to handle some scripts. The script has to assume where PT_LOADs start in order to align that spot. If we don't allow section it doesn't know about to move to the middle, we can need more PT_LOADs and those will not be aligned. llvm-svn: 282015
* Make test less dependent on the section order.Rafael Espindola2016-09-207-42/+39
| | | | | | | This means either relaxing CHECKs or listing more sections and addresses in linker scripts. llvm-svn: 282014
* Simplify SORT and --sort-section command line option handling.Rui Ueyama2016-09-201-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D24685 llvm-svn: 282006
* Don't produce an error for undefined entry symbol.Rafael Espindola2016-09-201-4/+3
| | | | | | | | | | This is particularly important when the symbol comes from a linker script. It is common to use the same linker script for shared libraries and executables. Without this we would always fail to link shared libraries with -z,defs and a linker script with an ENTRY directive. llvm-svn: 281989
* Redirect stderr to /dev/null. NFC.Rafael Espindola2016-09-201-6/+6
| | | | | | Makes the error output less confusing when this test fails. llvm-svn: 281985
* Disable --rosegment when we have linker scripts.Rafael Espindola2016-09-208-34/+47
| | | | | | | | Linker scripts are responsible for aliging '.'. Since they are designed for bfd which has no --rosegment, they don't align the RO to RX transition. llvm-svn: 281978
* Make tests less dependent on the exact layout.Rafael Espindola2016-09-2016-132/+142
| | | | | | | | | In most cases that means just not checking the address when we don't need it. For some tests it is easier to just set . to a known value. llvm-svn: 281976
* Move test to the correct directory. NFC.Rafael Espindola2016-09-202-0/+105
| | | | llvm-svn: 281974
* Remove empty section commands.Rafael Espindola2016-09-201-0/+14
| | | | | | | We were already not creating them, and with this other parts of the code don't have to worry about them. llvm-svn: 281968
* Use FileCheck variables. NFC.Rafael Espindola2016-09-191-3/+3
| | | | llvm-svn: 281932
* Don't CHECK the addresses. NFCRafael Espindola2016-09-191-13/+13
| | | | | | | That is not what this test is about. This reduces changes in another patch that changes layout. llvm-svn: 281929
* [ELF] - Linkerscript: change locationcounter.s to use llvm-objdumpGeorge Rimar2016-09-171-287/+21
| | | | | | | Previously it used llvm-readobj -s, now changed to llvm-objdump -section-headers, that reduced the output significantly and helps to read/support it. llvm-svn: 281832
* [ELF] - SEGMENT_START's default argument can be an expressionGeorge Rimar2016-09-172-3/+3
| | | | | | | | | | | 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
* [ELF] Linkerscript: fixed bug about commands processing.George Rimar2016-09-171-0/+20
| | | | | | | | | It was possible situation about some commands just were not processed (were skipped) because of a bug appeared when constraint checking used. Testcase is attached. llvm-svn: 281818
* Put SHF_ALLOC sections first, even with linker scripts.Rafael Espindola2016-09-162-12/+12
| | | | | | | | | | | | This matches gold and bfd, and is pretty much required by some linker scripts. They end with commands like foo 0 : { *(bar) } if we put any SHF_ALLOC sections after they can have an address that is too low. llvm-svn: 281778
* Only process commands in a ONLY_IF_RO if it matches.Rafael Espindola2016-09-161-0/+11
| | | | | | | This matches bfd behavior. It also makes future changes simpler as we don't have to worry about ignoring these commands in multiple places llvm-svn: 281775
* Fix constraint checking in ONLY_IF_RO.Rafael Espindola2016-09-161-0/+14
| | | | | | We have to look at all the relevant input sections at once. llvm-svn: 281772
* [ELF] - Implemented --sort-section cmd line option and SORT_NONE script command.George Rimar2016-09-162-0/+31
| | | | | | | | | | | | | | | | This fixes Bug 30385 - SORT_NONE not implemented, `SORT_NONE' disables section sorting by ignoring the command line section sorting option. That is why this patch also implements --sort-section option. Description of sorting rules available at https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html Differential revision: https://reviews.llvm.org/D24604 llvm-svn: 281771
* Recommit r281721 "[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle ↵George Rimar2016-09-163-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Improve handling ASSERT outside SECTIONS blockEugene Leviant2016-09-161-0/+15
| | | | | | Differential revision: https://reviews.llvm.org/D24450 llvm-svn: 281740
* Change how we compute offsets with linker scripts.Rafael Espindola2016-09-162-15/+8
| | | | | | | | | | | | This fixes pr30367, but more importantly, it changes how we compute offsets. Now offset computation in a walk over linker script commands, like the rest of assignAddresses. IMHO this is simpler to understand and if we ever have to create multiple outputsections or chunks to change how we handle test/ELF/linkerscript/alternate-sections.s it should be easier to do it. llvm-svn: 281736
* Reverted r281721 ("[ELF] - Linkerscript: implement EXCLUDE_FILE in the ↵George Rimar2016-09-163-44/+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-163-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Error out instead of producing a corrupt PT_LOAD.Rafael Espindola2016-09-151-0/+10
| | | | | | | What bfd and gold do is give up in putting the headers in the PT_LOAD and just start the PT_LOAD in the second page. llvm-svn: 281660
* Make sure we create all necessary PT_LOADs.Rafael Espindola2016-09-151-0/+28
| | | | | | We were some times stopping early when using linker scripts. llvm-svn: 281647
* [ELF] - Linkerscript: implemented SORT_BY_INIT_PRIORITY.George Rimar2016-09-151-0/+24
| | | | | | | | | | | This is PR30386, SORT_BY_INIT_PRIORITY is a keyword can be used to sort sections by numerical value of the GCC init_priority attribute encoded in the section name. Differential revision: https://reviews.llvm.org/D24611 llvm-svn: 281646
* Check the return of getInteger.Rafael Espindola2016-09-151-0/+5
| | | | llvm-svn: 281608
* Handle arbitrary expressions in DATA_SEGMENT_RELRO_END.Rafael Espindola2016-09-141-1/+1
| | | | llvm-svn: 281521
* Add an interesting test.Rafael Espindola2016-09-141-0/+34
| | | | llvm-svn: 281515
* Add a test showing we handle .tbss sections in linker scripts.Rafael Espindola2016-09-141-0/+37
| | | | llvm-svn: 281496
* Enable merging of SHF_MERGE sections with linker scripts.Rafael Espindola2016-09-133-3/+99
| | | | | | | | | This also fixes the related problem of non SHF_MERGE sections with different flags not being merged. Fixes pr30355. llvm-svn: 281338
* Linker script: implement AT [ (address) ] for PHDREugene Leviant2016-09-091-1/+25
| | | | | | Differential revision: https://reviews.llvm.org/D24340 llvm-svn: 281024
* Linker script: implement ALIGNOFEugene Leviant2016-09-081-0/+41
| | | | | | Differential revision: https://reviews.llvm.org/D24141 llvm-svn: 280915
* Set entry address to 0x0 if no _start symbolEugene Leviant2016-09-081-1/+2
| | | | | | Differential revision: https://reviews.llvm.org/D23925 llvm-svn: 280912
* Rename test file. NFC.Rui Ueyama2016-09-081-0/+0
| | | | llvm-svn: 280904
* [ELF] - Linkerscript: create multiple output sections for inputs with ↵George Rimar2016-09-073-31/+5
| | | | | | | | | | | | | | | different attributes. Previously we combined sections by name if linkerscript was used. For that we had to disable SHF_MERGE handling temporarily, but then found that implementing it properly will require additional complexity layers like subsections or something. At the same time looks we can live with multiple output sections approach for now. That patch do this change. Differential revision: https://reviews.llvm.org/D24127 llvm-svn: 280801
* Support ABSOLUE keyword in symbol assignmentsEugene Leviant2016-09-071-6/+11
| | | | | | | | | | | | This patch allows making section defined symbols absolute: .foo : { begin_foo = ABSOLUTE(.); *(.foo) } Differential revision: https://reviews.llvm.org/D24135 llvm-svn: 280788
* [ELF] - Linkerscript: implemented FILL command as alias for =fillexprGeorge Rimar2016-09-062-1/+31
| | | | | | | | | Patch implements FILL just as alias for =fillexpr. This allows to make implementation much shorted and simpler than D24186. Differential revision: https://reviews.llvm.org/D24227 llvm-svn: 280708
* [ELF] PR30221 - linker script expression parser does not accept '~'Simon Atanasyan2016-09-022-0/+36
| | | | | | | | | | | The patch adds support for both '-' and '~' unary expressions. Also it brings support for signed numbers is expressions. https://llvm.org/bugs/show_bug.cgi?id=30221 Differential revision: https://reviews.llvm.org/D24128 llvm-svn: 280546
* Move a test file to the right place.Rui Ueyama2016-09-021-0/+122
| | | | llvm-svn: 280541
* Remove useless file prefix.Rui Ueyama2016-09-0250-12/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D24207 llvm-svn: 280540
* Fix potential test failures.Rui Ueyama2016-09-021-5/+3
| | | | | | | | | | | | | | | | | Windows does not allow opened files to be removed. This patch fixes two types of errors. - Output file being the same as input file. Because LLD itself holds a file descriptor of the input file, it cannot create an output file with the same name as a new file. - Removing files before releasing MemoryBuffer objects. These tests are not failing no because MemoryBuffer happens to decide not to use mmap on these files. But we shouldn't rely on that behavior. llvm-svn: 280507
* [ELF] - Linkerscript: add support for suffixes in numbers.George Rimar2016-09-021-0/+72
| | | | | | | | | | | | | | Both bfd and gold accept: foo = 1K; bar = 1M; zed = 1H; And lowercase forms: k, m, h. Patch adds support for that. Differential revision: https://reviews.llvm.org/D24194 llvm-svn: 280494
* [ELF] Linkerscript: define symbols outside SECTIONSPetr Hosek2016-08-311-0/+9
| | | | | | | | | Symbol assignments outside of SECTIONS command need to be created even when SECTIONS command is not used. Differential Revision: https://reviews.llvm.org/D23751 llvm-svn: 280252
* Allow adding start/end symbols to any sectionEugene Leviant2016-08-311-14/+52
| | | | | | | | | Allows adding start and/or end symbols to special output sections, like .eh_frame_hdr, which aren't lists of regular input sections. Differential revision: https://reviews.llvm.org/D23716 llvm-svn: 280205
* Allow .eh_frame_hdr to be placed before .eh_frameEugene Leviant2016-08-311-0/+20
| | | | | | Differential revision: https://reviews.llvm.org/D24041 llvm-svn: 280203
* [ELF] - Linkerscript: implemented ADDR command.George Rimar2016-08-301-0/+32
| | | | | | | | | | | ADDR(section) Return the absolute address (the VMA) of the named section. Used in the wild, eg.: https://searchcode.com/file/53617342/arch/x86/kernel/vmlinux.lds.S Differential revision: https://reviews.llvm.org/D23913 llvm-svn: 280070
* [ELF] - Fix for: bug 29115 - linkerscript does not support non-wildcard ↵George Rimar2016-08-301-0/+18
| | | | | | | | | | | | | | | filename spec. FreeBSD/mips script has non-wildcard filename specifications: .text : { start.o(.text*) Patch adds support for that, this is PR29115. Differential revision: https://reviews.llvm.org/D23839 llvm-svn: 280069
OpenPOWER on IntegriCloud