summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/linkerscript
Commit message (Collapse)AuthorAgeFilesLines
...
* Mark a few more expressions as absolute.Rafael Espindola2016-10-312-4/+37
| | | | llvm-svn: 285611
* Move IsAbsolute from SymbolAssignment to Expr.Rafael Espindola2016-10-311-0/+17
| | | | | | | | | And as a token of the new feature, make ALIGNOF always absolute. This is a step in making it possible to have non absolute symbols out of output sections. llvm-svn: 285608
* Correctly merge visibility of linkerscript created symbols.Rafael Espindola2016-10-311-0/+22
| | | | llvm-svn: 285567
* [ELF] Better error reporting for undefined symbolsEugene Leviant2016-10-262-4/+4
| | | | | | | | | | | This patch make lld show following details for undefined symbol errors: - file (line) - file (function name) - file (section name + offset) Differential revision: https://reviews.llvm.org/D25826 llvm-svn: 285186
* Use FileCheck's -strict-whitespace option instead of sed.Rui Ueyama2016-10-211-9/+8
| | | | llvm-svn: 284846
* Don't include PHDRs if linker script doesn't want themEugene Leviant2016-10-201-0/+27
| | | | | | | | | | | | | This script below shouldn't include file and program headers to PT_LOAD segment, because it doesn't have PHDRS and FILEHDR attributes: PHDRS { all PT_LOAD; } SECTIONS { /* list of sections here */ } Differential revision: https://reviews.llvm.org/D25774 llvm-svn: 284709
* Allow linker-script-defined entry symbols.Rui Ueyama2016-10-201-0/+8
| | | | | | | | Previously, we were checking the existence of an entry symbol too early. It was done before the linker script processor creates symbols defined in scripts. Fixes bug 30743. llvm-svn: 284676
* Read an expression in the form of "ABSOLUTE(<expr>) op <expr> ...".Rui Ueyama2016-10-191-0/+18
| | | | | | Fixes bug 30741. llvm-svn: 284662
* Avoid using grep command in a test.Rui Ueyama2016-10-191-10/+11
| | | | | | | This test is failing on FreeBSD bots. This is an attempt to fix it by not using grep command. llvm-svn: 284645
* Include ARGV[0] in error messages.Rui Ueyama2016-10-191-2/+2
| | | | | | | | This is what other linkers and clang driver do. Differential Revision: https://reviews.llvm.org/D25780 llvm-svn: 284634
* [ELF] Choose default segment when it is not specifiedEugene Leviant2016-10-193-4/+51
| | | | | | | | | | | | | | | | | | | | Linker scripts may specify PHDRS, but not specify section to segment assignments, i.e: PHDRS { seg PT_LOAD; } SECTIONS { .sec1 {} : seg .sec2 {} } In such case linker should still choose some segment for .sec2 section. This patch will add .sec2 to previously opened segments (seg) or to the very first PT_LOAD segment, if no section-to-segment assignments has been made Differential revision: https://reviews.llvm.org/D24795 llvm-svn: 284600
* [ELF] Add "error" and "warning" prefixes to linker messagesEugene Leviant2016-10-191-2/+2
| | | | | | Differential revision: https://reviews.llvm.org/D25729 llvm-svn: 284575
* [ELF] - Update testcases after llvm change.George Rimar2016-10-182-2/+2
| | | | llvm-svn: 284474
* [ELF] - Linkerscript: accept integer values for PHDRS types.George Rimar2016-10-181-0/+23
| | | | | | | | | | Both gold and ld accepts integers instead of named constants for PHDRS. Patch adds support for that. Differential revision: https://reviews.llvm.org/D25549 llvm-svn: 284470
* [ELF] - Added support of PT_OPENBSD_RANDOMIZEGeorge Rimar2016-10-141-0/+22
| | | | | | | | | | | | | | | This is 30646. PT_OPENBSD_RANDOMIZE The array element specifies the location and size of a part of the memory image of the program that must be filled with random data before any code in the object is executed. The memory region specified by a segment of this type may overlap the region specified by a PT_GNU_RELRO segment, in which case the intersection will be filled with random data before being marked read-only. Reference links: http://man.openbsd.org/OpenBSD-current/man5/elf.5 https://github.com/openbsd/src/commit/c494713c450d98da3f2e1451ee8c7fb675a7c461 Differential revision: https://reviews.llvm.org/D25469 llvm-svn: 284234
* [ELF] - Implemented -z wxneeded.George Rimar2016-10-141-0/+17
| | | | | | | | | | | | | -z wxneeded creates a PHDR PT_OPENBSD_WXNEEDED. PT_OPENBSD_WXNEEDED The array element specifies that a process executing this file may need to be able to map or protect memory regions as simultaneously executable and writable. If the system is unable or unwilling to permit that for this executable then it may fail immediately. This segment type is meaningful only for executable files and is ignored in other objects. http://man.openbsd.org/OpenBSD-current/man5/elf.5 Differential revision: https://reviews.llvm.org/D25472 llvm-svn: 284226
* Alternative fix for reloc tareting discarded sectionEugene Leviant2016-10-121-2/+1
| | | | | | | | | | | | r283984 introduced a problem of too many warning messages being shown when -ffunction-sections and -fdata-sections were used in conjunction with --gc-sections linker flag and debugging information present. This happens because lot of relocations from .debug_line section may become invalid in such case. The newer fix doesn't show any warning message but zeroes OutSec pointer in createInputSectionList() to avoid crash, when relocations are written llvm-svn: 284010
* Don't crash if reloc targets discarded sectionEugene Leviant2016-10-121-2/+7
| | | | | | Differential revision: https://reviews.llvm.org/D25433 llvm-svn: 283984
* [ELF] Don't emit empty PT_LOAD segmentEugene Leviant2016-10-101-0/+22
| | | | | | | | | | | | | Sometimes the very first PT_LOAD segment, created by lld, can be empty. This happens when (all conditions met): - Linker script is used - First section in ELF image is not RO - Not enough space for program headers. Differential revision: https://reviews.llvm.org/D25330 llvm-svn: 283760
* [ELF] Don't fail if undefined symbol is not usedEugene Leviant2016-10-061-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D25240 llvm-svn: 283431
* [ELF] Linker script: implement LOADADDREugene Leviant2016-10-061-0/+42
| | | | | | Differential revision: https://reviews.llvm.org/D24298 llvm-svn: 283429
* Remove trailing whitespace.Rui Ueyama2016-10-051-1/+1
| | | | llvm-svn: 283372
* [ELF] make KEEP command recognize file patternsEugene Leviant2016-10-052-0/+13
| | | | | | Differential revision: https://reviews.llvm.org/D25242 llvm-svn: 283305
* Start linker scripts at 0.Rafael Espindola2016-09-302-3/+7
| | | | | | | | | We were implicitly creating space for the headers. That is not the behaviour of bfd, which requires the script to use SIZEOF_HEADERS. The difference is important for scripts that don't use SIZEOF_HEADERS and expect the first section to be at 0. llvm-svn: 282818
* Don't depend on lld creating space for the headers.Rafael Espindola2016-09-3015-9/+29
| | | | | | | | | | | | | Currently lld will implicitly reserve space for the headers. This is not the case is bfd, where it is the script responsibility to use SIZEOF_HEADERS. This means that a script not using SIZEOF_HEADERS and expecting the address of the first section to be 0 would fail with lld. I am fixing that is the next commit. This one just makes the tests explicitly use SIZEOF_HEADERS to avoid the dependency on the current behaviour. llvm-svn: 282814
* Break long line. NFC.Rafael Espindola2016-09-291-1/+3
| | | | llvm-svn: 282806
* Don't put ro before rx when using linker scripts.Rafael Espindola2016-09-298-24/+25
| | | | | | | | Since they end up going on the same PT_LOAD, there is no reason to sort them. This matches bfd's behaviour and is user visible in the placement of orphan sections. llvm-svn: 282799
* List more sections in linker script.Rafael Espindola2016-09-291-0/+9
| | | | | | This makes the test less brittle with regards to orphan section placement. llvm-svn: 282797
* Use > and not >> to create the script.Rafael Espindola2016-09-291-1/+1
| | | | llvm-svn: 282760
* Don't error if we can't put the header in a PT_LOAD.Rafael Espindola2016-09-291-2/+14
| | | | | | | | | | If there is not sufficient address space, just give up and don't put the header in the PT_LOAD. This matches bfd behaviour and I found at least one script that depends on having a section at address 0. llvm-svn: 282750
* [ELF] Change the way we compute file offsets Eugene Leviant2016-09-291-2/+2
| | | | | | | | | | | If we two sections reside in the same PT_LOAD segment, we compute second section using the following formula: Off2 = Off1 + VA2 - VA1. This allows OS kernel allocating sections correctly when loading an image. Differential revision: https://reviews.llvm.org/D25014 llvm-svn: 282705
* [ELF] Support -z max-page-size optionPetr Hosek2016-09-281-0/+68
| | | | | | | | | | | | This options issupported by both BFD ld and gold and allows overriding the max page size whose default values are defined by the target. https://llvm.org/bugs/show_bug.cgi?id=30541 Differential Revision: https://reviews.llvm.org/D24891 llvm-svn: 282596
* [ELF] Use MaxPageSize for aligning PT_LOADPetr Hosek2016-09-284-12/+12
| | | | | | | | | | | | This matches the behavior of Binutils linkers. We also change the default MaxPageSize on x86-64 to 0x1000 to preserver the current behavior, which is the same as the behavior implemented by gold. https://llvm.org/bugs/show_bug.cgi?id=30541 Differential Revision: https://reviews.llvm.org/D24987 llvm-svn: 282560
* [ELF] - Linkerscript: implemented BYTE/SHORT/LONG/QUAD commands.George Rimar2016-09-261-0/+40
| | | | | | | | | | | | | | | | | | | The BYTE, SHORT, LONG, and QUAD commands store one, two, four, and eight bytes (respectively). After storing the bytes, the location counter is incremented by the number of bytes stored. Previously our scripts handles these commands incorrectly. For example: SECTIONS { .foo : { *(.foo.1) BYTE(0x11) ... We accepted the script above treating BYTE as input section description. These commands are used in the wild though. Differential revision: https://reviews.llvm.org/D24830 llvm-svn: 282429
* Linkerscript: don't crash when GC .debug_lineEugene Leviant2016-09-262-0/+19
| | | | | | Differential revision: https://reviews.llvm.org/D24870 llvm-svn: 282393
* Avoid counting sections twice.Rafael Espindola2016-09-231-1/+1
| | | | | | | | | | | | | We were counting the size of the bss section holding common symbols twice: Dot += CurOutSec->getSize(); flush(); The new code is also simpler as now flush is the only function that inserts in AlreadyOutputOS, which makes sense since the set hold fully output sections. llvm-svn: 282285
* [ELF] - Linkerscript: accept space between '=' and expression in section filler.George Rimar2016-09-231-0/+5
| | | | | | | | | | | | | Previously we failed to parse next scripts because disallowed a space between filler value and '=': .text : { ... } :text = 0x9090 Differential revision: https://reviews.llvm.org/D24831 llvm-svn: 282248
* [ELF] - Linkerscript: implement DEFINED() command.George Rimar2016-09-231-0/+25
| | | | | | | | | | | | DEFINED(symbol) Return 1 if symbol is in the linker global symbol table and is defined before the statement using DEFINED in the script, otherwise return 0. Can be used to define default values for symbols. Found it in the wild. Differential revision: https://reviews.llvm.org/D24858 llvm-svn: 282245
* Linker script: fix crash when discarding sectionEugene Leviant2016-09-231-0/+10
| | | | | | | | | If section contains local symbols ldd crashes, because local symbols are added to symbol table before section is discarded by linker script processor. This patch calls copyLocalSymbols() after createSections, so discarded section symbols are not copied llvm-svn: 282244
* [ELF] - Linkerscript: Implemented >> and <<George Rimar2016-09-231-0/+13
| | | | | | | | | | | Found this operators used in the wild scripts, for example: __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2; __fixup_entries = (. - _FIXUP_TABLE_)>>2; Differential revision: https://reviews.llvm.org/D24860 llvm-svn: 282243
* Remove extra \Rafael Espindola2016-09-221-1/+1
| | | | | | Should fix the windows bots. llvm-svn: 282181
* Don't move orphan sections past assignments.Rafael Espindola2016-09-221-0/+27
| | | | | | This fixes a case where we would produce an unaligned PT_LOAD. llvm-svn: 282180
* Handle empty sections with symbol assignments.Rafael Espindola2016-09-222-0/+77
| | | | | | Before the symbols were becoming undefined. llvm-svn: 282159
* Fix VA computation for tbss.Rafael Espindola2016-09-221-1/+29
| | | | llvm-svn: 282149
* Handle multiple .tbss sections.Rafael Espindola2016-09-221-0/+17
| | | | llvm-svn: 282147
* Once more unto the strict weak ordering, once more.Rafael Espindola2016-09-212-6/+35
| | | | | | This should finally give a stable sorting over all implementations. llvm-svn: 282118
* Implement ONLY_IF_RO/ONLY_IF_RW like bfd.Rafael Espindola2016-09-211-0/+32
| | | | | | | | | | The actual logic is to keep the output section if the output section would have been ro/rw. This is both simpler and more practical, as the intention is linker scripts is to always keep of of a pair of ONLY_IF_RO/ONLY_IF_RW. llvm-svn: 282099
* [ELF] - Linkerscript: support complex section pattern grammar.George Rimar2016-09-211-0/+39
| | | | | | | | | | | | | | | | | | | | | | | This is PR30442. Previously we were failed to parce complex expressions like: foo : { *(SORT_BY_NAME(bar) zed) } Main idea of patch that globs and excludes can be wrapped in a SORT. There is a difference in semanics of ld/gold: ld likes: *(SORT(EXCLUDE_FILE (*file1.o) .foo.1)) gold likes: *(EXCLUDE_FILE (*file1.o) SORT(.foo.1)) Patch implements ld grammar, complex expressions like next is not a problem anymore: .abc : { *(SORT(.foo.* EXCLUDE_FILE (*file1.o) .bar.*) .bar.*) } Differential revision: https://reviews.llvm.org/D24758 llvm-svn: 282078
* Linker script: Fix bug with several .bssEugene Leviant2016-09-211-0/+16
| | | | | | | | When final image has several .bss sections, lld fails because second .bss always has zero VA. This causes link error "Not enough space for ELF and program headers" llvm-svn: 282067
* [ELF] - Linkerscript: reimplement readSectionExcludes()George Rimar2016-09-211-0/+9
| | | | | | | | | | | It is not only a bit more straightforward now, but also next 2 issues are solved: * It just crashed on ".foo : { *(EXCLUDE_FILE (*file1.o)) }" before. * It accepted multiple EXCLUDE_FILEs in a row. Differential revision: https://reviews.llvm.org/D24726 llvm-svn: 282060
OpenPOWER on IntegriCloud