summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF][HEXAGON] Add R_HEX_11/10/9_X supportSid Manning2018-08-271-0/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D51225 llvm-svn: 340739
* Handle identifying AMDGPU bitcode filesMatt Arsenault2018-08-272-0/+24
| | | | llvm-svn: 340738
* [ELF][HEXAGON] Add R_HEX_B13_PCREL relocation supportSid Manning2018-08-251-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D51166 llvm-svn: 340693
* [ELF][HEXAGON] Add R_HEX_B9_PCREL and R_HEX_B9_PCREL_X relocation supportSid Manning2018-08-251-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D51045 llvm-svn: 340692
* Modify tests to show PLT entry labelsJoel Galenson2018-08-2410-5/+59
| | | | llvm-svn: 340616
* Attempt to fix ELF/lto-plugin-ignore.s on Windows after r340487.Nico Weber2018-08-241-2/+2
| | | | | | | I removed the ".exe" regex in the wrong place. lld-link in front of the "error:" no longer has the suffix; the --plugin-opt diagnostic still has it. llvm-svn: 340590
* Revert "[PPC64] Fix DQ-form instruction handling and emit error for misalign..."Sean Fertile2018-08-233-84/+0
| | | | | | | | This reverts commit 5125b44dbb5d06b715213e4bec75c7346bfcc7d3. ppc64-dq.s and ppc64-error-missaligned-dq.s fail on several of the build-bots. Reverting to investigate. llvm-svn: 340568
* [PPC64] Fix DQ-form instruction handling and emit error for misalignment.Sean Fertile2018-08-233-0/+84
| | | | | | | | | | | Fixes the handling of *_DS relocations used on DQ-form instructions where we were overwriting some of the extended opcode bits. Also adds an alignment check so that the user will receive a diagnostic error if the value we are writing is not properly aligned. Differential Revision: https://reviews.llvm.org/D51124 llvm-svn: 340564
* win: Omit ".exe" from lld warning and error messages.Nico Weber2018-08-221-2/+2
| | | | | | | | | | | This is a minor follow-up to https://reviews.llvm.org/D49189. On Windows, lld used to print "lld-link.exe: error: ...". Now it just prints "lld-link: error: ...". This matches what link.exe does (it prints "LINK : ...") and makes lld's output less dependent on the host system. https://reviews.llvm.org/D51133 llvm-svn: 340487
* [ELF][HEXAGON] Add R_HEX_16_X relocationSid Manning2018-08-221-0/+17
| | | | | | | | This relocation has only 6-bits the remaining are in the extender. Differential Revision: https://reviews.llvm.org/D50603 llvm-svn: 340413
* Change how we handle -wrap.Rui Ueyama2018-08-225-55/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have an issue with -wrap that the option doesn't work well when renamed symbols get PLT entries. I'll explain what is the issue and how this patch solves it. For one -wrap option, we have three symbols: foo, wrap_foo and real_foo. Currently, we use memcpy to overwrite wrapped symbols so that they get the same contents. This works in most cases but doesn't when the relocation processor sets some flags in the symbol. memcpy'ed symbols are just aliases, so they always have to have the same contents, but the relocation processor breaks that assumption. r336609 is an attempt to fix the issue by memcpy'ing again after processing relocations, so that symbols that are out of sync get the same contents again. That works in most cases as well, but it breaks ASan build in a mysterious way. We could probably fix the issue by choosing symbol attributes that need to be copied after they are updated. But it feels too complicated to me. So, in this patch, I fixed it once and for all. With this patch, we no longer memcpy symbols. All references to renamed symbols point to new symbols after wrapSymbols() is done. Differential Revision: https://reviews.llvm.org/D50569 llvm-svn: 340387
* [Support][CachePruning] prune least recently accessed files firstBob Haarman2018-08-221-0/+14
| | | | | | | | | | | | | | | | | Summary: Before this change, pruning order was based on size. This changes it to be based on time of last use instead, preferring to keep recently used files and prune older ones. Reviewers: pcc, rnk, espindola Reviewed By: rnk Subscribers: emaste, arichardson, hiraditya, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51062 llvm-svn: 340374
* [ELF] -thinlto-object-suffix-replace=: don't error if the path does not end ↵Fangrui Song2018-08-211-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with old suffix Summary: For -thinlto-object-suffix-replace=old\;new, in tools/gold/gold-plugin.cpp, the thinlto object filename is Path minus optional old suffix. static std::string getThinLTOObjectFileName(StringRef Path, StringRef OldSuffix, StringRef NewSuffix) { if (OldSuffix.empty() && NewSuffix.empty()) return Path; StringRef NewPath = Path; NewPath.consume_back(OldSuffix); std::string NewNewPath = NewPath; NewNewPath += NewSuffix; return NewNewPath; } Currently lld will error that the path does not end with old suffix. This patch makes lld accept such paths but only add new suffix if Path ends with old suffix. This fixes a link error where bitcode members in an archive are regular LTO objects without old suffix. Acording to tejohnson, this will "enable supporting mix and match of minimized ThinLTO bitcode files with normal ThinLTO bitcode files in a single link (where we want to apply the suffix replacement to the minimized files, and just ignore it for the normal ThinLTO files)." Reviewers: ruiu, pcc, tejohnson, espindola Reviewed By: tejohnson Subscribers: emaste, inglorion, arichardson, eraman, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51055 llvm-svn: 340364
* [PPC64] Add TLS initial exec to local exec relaxationZaara Syeda2018-08-212-0/+169
| | | | | | | | | This patch adds the target call back relaxTlsIeToLe to support TLS relaxation from initial exec to local exec model. Differential Revision: https://reviews.llvm.org/D48091 llvm-svn: 340281
* [LLD][ELF] - Fix BB after r340257.George Rimar2018-08-211-1/+1
| | | | | | Renamed Filecheck->FileCheck. llvm-svn: 340259
* [LLD][ELF] - Check the architecture of lazy objects earlier.George Rimar2018-08-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | Our code in LazyObjFile::parse() has an ELFT switch and adds a lazy object by its ELFT kind. Though it might be possible to add a file using a different architecture and make LLD to silently accept it (if the file is empty or contains only week symbols). That itself, not a huge issue perhaps (because the error would be reported later if the file is fetched), but still does not look clean and correct. It is possible to report an error earlier and clean up the code. That is what the patch does. Ideally, we might want to reuse isCompatible from SymbolTable.cpp, but it is static and accepts a file as an argument, what is not convenient. Since such a situation should be rare, I think it should be OK to go with the way chosen in this patch. Differential revision: https://reviews.llvm.org/D50899 llvm-svn: 340257
* [ELF] Add support for Armv5 and Armv6 compatible ThunksPeter Smith2018-08-2018-25/+175
| | | | | | | | | | | | | | | | Older Arm architectures do not support the MOVT and MOVW instructions so we must use an alternative sequence of instructions to transfer control to the destination. Assuming at least Armv5 this patch adds support for Thunks that load or add to the program counter. Note that there are no Armv5 Thumb Thunks as there is no Thumb branch instruction in Armv5 that supports Thunks. These thunks will not work for Armv4t (arm7tdmi) as this architecture cannot change state from using the LDR or ADD instruction. Differential Revision: https://reviews.llvm.org/D50077 llvm-svn: 340160
* [ELF] Add support for older Arm Architectures with smaller branch rangePeter Smith2018-08-2013-19/+63
| | | | | | | | | | | | | | The Thumb BL and BLX instructions on older Arm Architectures such as v5 and v6 have a constrained encoding J1 and J2 must equal 1, later Architectures relaxed this restriction allowing J1 and J2 to be used to calculate a larger immediate. This patch adds support for the old encoding, it is used when the build attributes for the input objects only contain older architectures. Differential Revision: https://reviews.llvm.org/D50076 llvm-svn: 340159
* [ELF] mergeSections: remove non-alive MergeInputSectionFangrui Song2018-08-161-3/+7
| | | | | | | | | | | | | | Summary: This makes it conform to what the comment says. Otherwise when getErrPlace() is called afterwards, cast<InputSection>(D) will cause incompatible cast as MergeInputSection is not a subclass of InputSection. Reviewers: ruiu, grimar, espindola, pcc Reviewed By: grimar Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D50742 llvm-svn: 339904
* [LLD][ELF] - Add a test case for DT_SONAME entry reading.George Rimar2018-08-161-0/+18
| | | | | | | This covers a following line with a test: https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L899 llvm-svn: 339880
* [LLD][ELF] - Add a test case.George Rimar2018-08-161-0/+16
| | | | | | | This covers the following line with a test: https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L487 llvm-svn: 339876
* [LLD][ELF] - Add test case.George Rimar2018-08-161-0/+22
| | | | | | | To cover the following error message: https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L463 llvm-svn: 339867
* [LLD][ELF] - Stop using binary input in merge-invalid-size.s test. NFCI.George Rimar2018-08-153-3/+21
| | | | | | This rewrites the test using yaml. llvm-svn: 339775
* [LLD][ELF] - Convert binary input to yaml in sht-group.s test. NFC.George Rimar2018-08-153-3/+18
| | | | | | This removes test that used binary input and adds a yaml based test instead. llvm-svn: 339774
* [LLD][ELF] - Handle SHT_GROUP more carefully. NFCI.George Rimar2018-08-151-0/+25
| | | | | | | | | | | | This patch solves 2 problems: 1) It adds a test to check the line below: https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L334 Test case contains SHT_GROUP section with a broken (0xFF) flag. 2) The patch fixes the case when we silently accepted such broken groups in the case when there were no other objects with the same group signature. llvm-svn: 339765
* [LLD][ELF] - Eliminate dead code from OffsetGetter::get().George Rimar2018-08-141-0/+31
| | | | | | | | | We have a dead piece of code there which is impossible to trigger using regular objects I believe. Patch removes it and adds a test case showing how this condition can be triggered with use of a broken object and crash the linker. llvm-svn: 339680
* [ELF][HEXAGON] Add R_HEX_32 supportSid Manning2018-08-141-0/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D50657 llvm-svn: 339677
* Support shared objects for split stack.Sterling Augustine2018-08-131-0/+31
| | | | llvm-svn: 339626
* [LLD][ELF] - Update test case to check the error message reported. NFC.George Rimar2018-08-131-1/+6
| | | | | | | | | | This updates znotext-plt-relocations-protected.s test case (adds a file symbol) to check how the error message is built. It allows to cover/test the following line: https://github.com/llvm-mirror/lld/blob/master/ELF/Relocations.cpp#L79 llvm-svn: 339550
* [LLD][ELF] - Add one more test case for CallGraphSort.George Rimar2018-08-121-0/+38
| | | | | | | This adds a coverage for the following early continue: https://github.com/llvm-mirror/lld/blob/master/ELF/CallGraphSort.cpp#L200 llvm-svn: 339514
* [ELF][HEXAGON] Put test back in.Sid Manning2018-08-101-3/+2
| | | | | | The registers are tied. llvm-svn: 339487
* [ELF][HEXAGON] Remove test that breaks assembler.Sid Manning2018-08-101-2/+3
| | | | | | | Remove testcase the breaks the assembler parser. Will fix llvm-mc and put this back afterward. llvm-svn: 339486
* [ELF][HEXAGON] Add R_HEX_8_X relocationSid Manning2018-08-101-0/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D50577 llvm-svn: 339477
* [LLD][ELF] - Fix crash when using empty --defsym.George Rimar2018-08-101-0/+6
| | | | | | | | | | | | | | | | | | | | We have a crash issue when handling the empty -defsym. For parsing this option we are using ScriptParser class which is used generally for reading the linker script. For empty defsym case, we pass the empty memory buffer and crash in the place removed in https://reviews.llvm.org/rL336436. But reverting of the above patch would not help here (we would still crash but a bit later). And even after fixing the crash we would report something like "lld.exe: error: -defsym:1: unexpected EOF" It is probably not the appropriate message because mentions EOF. I think the issue should be handled on a higher level like this patch does. So we do not want to pass the empty memory buffer first of all I believe. Differential revision: https://reviews.llvm.org/D50498 llvm-svn: 339412
* [ELF][HEXAGON] Add R_HEX_HI16/R_HEX_LO16 relocationsSid Manning2018-08-091-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D50520 llvm-svn: 339371
* Support RISC-VRui Ueyama2018-08-096-0/+657
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by PkmX. This patch makes lld recognize RISC-V target and implements basic relocation for RV32/RV64 (and RVC). This should be necessary for static linking ELF applications. The ABI documentation for RISC-V can be found at: https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md. Note that the documentation is far from complete so we had to figure out some details from bfd. The patch should be pretty straightforward. Some highlights: - A new relocation Expr R_RISCV_PC_INDIRECT is added. This is needed as the low part of a PC-relative relocation is linked to the corresponding high part (auipc), see: https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#pc-relative-symbol-addresses - LLVM's MC support for RISC-V is very incomplete (we are working on this), so tests are given in objectyaml format with the original assembly included in the comments. Once we have complete support for RISC-V in MC, we can switch to llvm-as/llvm-objdump. - We don't support linker relaxation for now as it requires greater changes to lld that is beyond the scope of this patch. Once this is accepted we can start to work on adding relaxation to lld. Differential Revision: https://reviews.llvm.org/D39322 llvm-svn: 339364
* [LLD][ELF] - Add a test for elf::getPriority(StringRef S)George Rimar2018-08-091-2/+4
| | | | | | | It covers the following line with a test: https://github.com/llvm-mirror/lld/blob/master/ELF/OutputSections.cpp#L383 llvm-svn: 339348
* [LLD][ELF] - Add a test for ScriptParser::readPhdrType().George Rimar2018-08-091-0/+4
| | | | | | This adds a test for https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L1289. llvm-svn: 339342
* [LLD][ELF] - Add a test for ScriptParser::readOutputSectionDescription.George Rimar2018-08-091-0/+5
| | | | | | | This covers the following line: https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L415 llvm-svn: 339333
* Add R_HEX_6_X relocation supportSid Manning2018-08-091-0/+122
| | | | | | | | | This is a larger patch. This relocation has irregular immediate masks that require a lookup to find the correct mask. Differential Revision: https://reviews.llvm.org/D50450 llvm-svn: 339332
* [LLD][ELF] - Add a test for ScriptParser::readPhdrs(). NFCI.George Rimar2018-08-091-0/+4
| | | | | | | This covers the following line with a test: https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L415 llvm-svn: 339327
* [LLD][ELF] - Add a test case for parsing -defsym.George Rimar2018-08-091-2/+5
| | | | | | | This adds a coverage for the following line of the code: https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L274 llvm-svn: 339326
* ELF: Only add libcall symbols to the link if defined in bitcode.Peter Collingbourne2018-08-082-1/+7
| | | | | | | | | | | | | | | | | Adding all libcall symbols to the link can have undesired consequences. For example, the libgcc implementation of __sync_val_compare_and_swap_8 on 32-bit ARM pulls in an .init_array entry that aborts the program if the Linux kernel does not support 64-bit atomics, which would prevent the program from running even if it does not use 64-bit atomics. This change makes it so that we only add libcall symbols to the link before LTO if we have to, i.e. if the symbol's definition is in bitcode. Any other required libcall symbols will be added to the link after LTO when we add the LTO object file to the link. Differential Revision: https://reviews.llvm.org/D50475 llvm-svn: 339301
* Add missing REQUIRES x86 to tests.Peter Smith2018-08-085-0/+5
| | | | | | | | Add REQUIRES to tests that fail when an x86 backend is not present. Differential Revision: https://reviews.llvm.org/D50440 llvm-svn: 339253
* [LLD][ELF] - Add test cases for ScriptParser::readDynamicList(). NFCI.George Rimar2018-08-072-0/+14
| | | | | | | | This 2 test cases covers the following code: https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L185 https://github.com/llvm-mirror/lld/blob/master/ELF/ScriptParser.cpp#L189 llvm-svn: 339137
* [LLD][ELF] - Added test case for non-nullterminated wide strings.George Rimar2018-08-071-0/+19
| | | | | | | This covers the following line: https://github.com/llvm-mirror/lld/blob/master/ELF/InputSection.cpp#L1032 llvm-svn: 339124
* [LLD][ELF] - Add a test case for code in Archive::fetch(). NFCI.George Rimar2018-08-071-0/+15
| | | | | | | | | This covers the following piece with a test. https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L830 Thanks to Peter Collingbourne for providing the reproducer sample! llvm-svn: 339114
* [lit, python] Always add quotes around the python path in litStella Stamenova2018-08-061-1/+1
| | | | | | | | | | | | | | | Summary: The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes. This is a companion change to: https://reviews.llvm.org/D50206 Reviewers: asmith, zturner, espindola Subscribers: emaste, sbc100, arichardson, aheejin, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D50282 llvm-svn: 339075
* Add TARGET(foo) linker script directive.Rui Ueyama2018-08-061-0/+18
| | | | | | | | | | | | | | | | | | GNU ld's manual says that TARGET(foo) is basically an alias for `--format foo` where foo is a BFD target name such as elf64-x86-64. Unlike GNU linkers, lld doesn't allow arbitrary BFD target name for --format. We accept only "default", "elf" or "binary". This makes situation a bit tricky because we can't simply make TARGET an alias for --target. A quick code search revealed that the usage number of TARGET is very small, and the only meaningful usage is to switch to the binary mode. Thus, in this patch, we handle only TARGET(elf.*) and TARGET(binary). Differential Revision: https://reviews.llvm.org/D48153 llvm-svn: 339060
* ELF: Enable address-significance tables during LTO.Peter Collingbourne2018-08-061-0/+9
| | | | | | | | This allows safe ICF to work when linking with LTO. Differential Revision: https://reviews.llvm.org/D50221 llvm-svn: 339050
OpenPOWER on IntegriCloud