summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/lto/Inputs
Commit message (Collapse)AuthorAgeFilesLines
* Reland "Change the X86 datalayout to add three address spacesAmy Huang2019-09-1036-36/+36
| | | | | | | | | | for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568
* [ELF] Set `referenced` bit of Undefined created by BitcodeFileFangrui Song2019-08-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | D64136 and D65584, while fixing STB_WEAK issues and improving our compatibility with ld.bfd, can cause another STB_WEAK problem related to LTO: If %tundef.o has an undefined reference on f, and %tweakundef.o has a weak undefined reference on f, %tdef.o has a definition of f ``` ld.lld %tundef.o %tweakundef.o --start-lib %tdef.o --end-lib ``` 1) `%tundef.o` doesn't set the `referenced` bit. 2) `%weakundef.o` changes the binding from STB_GLOBAL to STB_WEAK 3) `%tdef.o` is not fetched because the binding is weak. Step (1) is incorrect. This patch sets the `referenced` bit of Undefined created by bitcode files. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D66992 llvm-svn: 370437
* Revert "Change the X86 datalayout to add three address spaces for 32 bit ↵Vlad Tsyrklevich2019-08-2836-36/+36
| | | | | | | | | signed," This reverts commit r370083 because it caused check-lld failures on sanitizer-x86_64-linux-fast. llvm-svn: 370142
* Change the X86 datalayout to add three address spaces for 32 bit signed,Amy Huang2019-08-2736-36/+36
| | | | | | 32 bit unsigned, and 64 bit pointers. llvm-svn: 370083
* [LTO] Improve readability of module IDsIgor Kudrin2019-05-161-0/+10
| | | | | | | | | Module IDs can appear in diagnostic messages. This patch adds some auxiliary symbols to improve their readability. Differential Revision: https://reviews.llvm.org/D61857 llvm-svn: 360858
* Output ELF files after ThinLTO is run.Bill Wendling2019-02-261-0/+7
| | | | | | | | | | | | | | | | | | Summary: The gold linker allowed you to output the ELF files after LTO was run. It did it by using the 'obj-path' option. This replicates that behavior. Reviewers: espindola, ruiu, MaskRay, pcc Reviewed By: MaskRay, pcc Subscribers: grimar, emaste, inglorion, arichardson, steven_wu, dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D56046 llvm-svn: 354917
* ELF: Only add libcall symbols to the link if defined in bitcode.Peter Collingbourne2018-08-081-0/+2
| | | | | | | | | | | | | | | | | 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
* ELF: Add libcall symbols to the link when LTO is being used.Peter Collingbourne2018-07-311-0/+6
| | | | | | | | | | | | If any of our inputs are bitcode files, the LTO code generator may create references to certain library functions that might not be explicit in the bitcode file's symbol table. If any of those library functions are defined in a bitcode file in an archive member, we need to arrange to use LTO to compile those archive members by adding them to the link beforehand. Differential Revision: https://reviews.llvm.org/D50017 llvm-svn: 338434
* [ELF] - Report proper error message about mixing bitcode files.George Rimar2018-07-111-0/+2
| | | | | | | | | If we have 2 bitcode inputs for different targets, LLD would print "<internal>" instead of the name of one of the files. The patch adds a test and fixes this issue. llvm-svn: 336794
* [LTO] Errors in LLVM backend should manifest as lld errorsSam Clegg2018-07-021-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D48812 llvm-svn: 336143
* [ELF] Remove -m argument to lld in test files. NFC.Sam Clegg2018-05-302-0/+2
| | | | | | | | | | | This should be correctly implied by the linker. This also makes the tests slightly easier to maintain and compare with the equivalent tests under for other platforms. Differential Revision: https://reviews.llvm.org/D47513 llvm-svn: 333567
* Added support for ThinLTO plugin options : thinlto-index-only and ↵Rumeet Dhindsa2018-05-021-0/+2
| | | | | | | | thinlto-prefix-replace Differential Revision: https://reviews.llvm.org/D46034 llvm-svn: 331405
* Add a test for an issue fixed in r329092.Rafael Espindola2018-04-031-0/+6
| | | | | | We were setting IsUsedInRegularObj in lazy symbols only used from IR. llvm-svn: 329101
* [ELF] - Added testcase for testing visibility of weak_odr symbols.George Rimar2018-02-231-0/+6
| | | | | | | | | | | | This is relative to "Bug 36166 - tools/gold/X86/comdat.ll is failing only on Debian Unstable" (PR36166). Something changed in newer versions of gold and now together with gold-plugin there is an issue shown in PR, symbol may get wrong visibility. LLD works fine, but we have no testcase for the same use case, patch adds it. Differential revision: https://reviews.llvm.org/D43193 llvm-svn: 325874
* Don't set dso_local flag in LTO resolutions for absolute symbols defined in ELFDmitry Mikulin2018-02-071-0/+2
| | | | | | | | | objects, it confuses codegen into generating pc-rel relocations for those symbols, which leads to linker errors. Differential Revision: https://reviews.llvm.org/D42977 llvm-svn: 324435
* [ELF] - Extend lto/asmundef.ll testcase.George Rimar2018-01-271-0/+4
| | | | | | | | | | | Patch adds one more module with non-prevailing version of asm symbol, defined in main module This is for D42107, which is under review. Extended version of testcase would fail with the diff 9 version of patch posted. llvm-svn: 323584
* [ELF] - LTO: do not optimize away symbols accessed from linkerscript.George Rimar2017-09-251-0/+9
| | | | | | | | | | | Previously when BC file had global variable that was accessed from script, it was optimized away or inlined by IPO. In this patch I add symbols at left side of assignment expression as LinkerRedefined, what prevents optimization for them. Differential revision: https://reviews.llvm.org/D37059 llvm-svn: 314097
* [LTO] Make sure symbol ordering is honoured also for data.Davide Italiano2017-07-241-0/+6
| | | | | | Follow-up to r308915 suggested by Rafael and Peter. llvm-svn: 308920
* [LTO] Make sure symbol ordering is honoured.Davide Italiano2017-07-241-0/+10
| | | | | | | | | We do this emitting a section for every function when LTO is used. Fixes PR33888. Differential Revision: https://reviews.llvm.org/D35809 llvm-svn: 308915
* Symbols re-defined with -wrap and -defsym need to be excluded from inter-Dmitry Mikulin2017-06-052-0/+35
| | | | | | | | | | procedural optimizations to prevent dropping symbols and allow the linker to process re-directs. PR33145: --wrap doesn't work with lto. Differential Revision: https://reviews.llvm.org/D33621 llvm-svn: 304719
* [lld] Infer relocation model from module flags in relocatable LTO link.Evgeniy Stepanov2017-05-221-0/+11
| | | | | | Fix for PR33096. llvm-svn: 303579
* Remember archive name when creating LazyObjectFile.Rafael Espindola2017-05-051-0/+6
| | | | | | | | It is needed for creating an unique identifier for ThinLTO. This fixes pr32931. llvm-svn: 302235
* Address a few nits pointed out by Sean.Peter Collingbourne2017-03-021-1/+1
| | | | llvm-svn: 296728
* ELF: Add ThinLTO caching support.Peter Collingbourne2017-03-011-0/+10
| | | | | | | | | | This patch adds an option named --thinlto-cache-dir, which specifies the path to a directory in which to cache native object files for ThinLTO incremental builds. Differential Revision: https://reviews.llvm.org/D30509 llvm-svn: 296702
* [ThinLTO] Avoid archive member collisions.Davide Italiano2016-10-122-0/+23
| | | | | | | | This fixes PR30665. Differential Revision: https://reviews.llvm.org/D25495 llvm-svn: 284034
* [LTO/Thin] Make the number of threads to run in the BE configurable.Davide Italiano2016-10-101-0/+7
| | | | | | | Before the default was whatever number hardware_concurrency() returned. Users can specify the number of threads via --lto-jobs=X option. llvm-svn: 283787
* Internalize common variables.Rafael Espindola2016-08-311-0/+3
| | | | | | | | | | | Before this lld was always creating common symbols itself. It worked, but prevented them from being internalized when possible. Now it preserves common symbols is the bitcode and they are internalized. Fixes pr30184. llvm-svn: 280242
* [LTO] Fix the logic for dropping unnamed_addr.Davide Italiano2016-08-301-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D24037 llvm-svn: 280144
* Document an interesting LTO case.Rafael Espindola2016-06-151-0/+6
| | | | | | | This is a reduction from the only symbol in a build of clang that the gold plugin internalizes but lld does not. llvm-svn: 272845
* Update LLD for D20550.Peter Collingbourne2016-05-271-0/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D20704 llvm-svn: 270968
* [LTO] Don't crash on old DebugInfo.Davide Italiano2016-05-111-0/+0
| | | | | | Drop them and produce a graceful warning instead. llvm-svn: 269149
* Don't depend on lld creating relocations in ro segments.Rafael Espindola2016-04-301-0/+2
| | | | | | | | | | | | | | | We currently don't do a good job of diagnosing inputs that would require dynamic relocations to be applied to read only segments. I am about to improve lld in that area, but unfortunately we developed tests that depend on the current behavior. To make clear what is actually changing, this first patch just updates tests to not depend on the current behavior. In most cases this just means using a rw section instead of a ro one, but that unfortunately changes many addresses. llvm-svn: 268145
* [LTO] Create Undefined Bitcode symbol when we drop a comdat member.Davide Italiano2016-04-221-0/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D19389 llvm-svn: 267181
* Internalize linkonce_odr more often.Rafael Espindola2016-04-211-0/+6
| | | | | | | | | | | | | | Since there is a copy in every translation unit that uses them, they can be omitted from the symbol table if the address is not significant. This still doesn't catch as many cases as the gold plugin. The difference is that we check canBeOmittedFromSymbolTable in each file and use lazy loading which limits what it can do. Gold checks it in the merged file. I think the correct way of getting the same results as gold is just to cache in the IR the result of canBeOmittedFromSymbolTable. llvm-svn: 267063
* [LTO] Another couple of tests for cases we already get right.Davide Italiano2016-04-211-0/+12
| | | | | | | -> Drop linkage when converting to decl -> Handling of unnamed_addr. llvm-svn: 266954
* [LTO] Another type merge test.Davide Italiano2016-04-201-0/+8
| | | | llvm-svn: 266899
* [LTO] Add a test to ensure we handle basic type merging correctly.Davide Italiano2016-04-201-0/+8
| | | | llvm-svn: 266896
* Fix another crash bug in --start-lib.Rui Ueyama2016-04-082-1/+9
| | | | | | | The previous fix didn't work for bitcode files. This patch fixes the remaining issue. llvm-svn: 265854
* ELF: Implement --start-lib and --end-libRui Ueyama2016-04-071-0/+6
| | | | | | | | | | | | | | | | start-lib and end-lib are options to link object files in the same semantics as archive files. If an object is in start-lib and end-lib, the object is linked only when the file is needed to resolve undefined symbols. That means, if an object is in start-lib and end-lib, it behaves as if it were in an archive file. In this patch, I introduced a new notion, LazyObjectFile. That is analogous to Archive file type, but that works for a single object file instead of for an archive file. http://reviews.llvm.org/D18814 llvm-svn: 265710
* Change the type hierarchy for undefined symbols.Rafael Espindola2016-04-061-0/+6
| | | | | | | | | | We have to differentiate undefined symbols from bitcode and undefined symbols from other sources. Undefined symbols from bitcode should not inhibit the symbol being internalized. Undefined symbols from other sources should. llvm-svn: 265536
* Fix another case of propagating IsUsedRegularObj.Rafael Espindola2016-04-051-0/+5
| | | | | | | I have an idea on how to clean this up, but lets get the tests passing first. llvm-svn: 265374
* ELF: Preserve MustBeInDynSym for bitcode symbols.Peter Collingbourne2016-04-051-0/+3
| | | | | | | | | | | Make sure to copy the MustBeInDynSym field when replacing shared symbols with bitcode symbols, and when replacing bitcode symbols with regular symbols in addCombinedLtoObject. Fixes interposition of DSO symbols with bitcode symbols in the main executable. Differential Revision: http://reviews.llvm.org/D18780 llvm-svn: 265371
* [LTO] Fix symbols which were internalized incorrectly.Davide Italiano2016-04-021-0/+6
| | | | | | | | | | | | | If a symbol is defined in an archive, when we replace its body the isUsedInRegularObj wasn't set correctly. Internalize makes its decision based on that bit so we ended up internalizing symbols that we shouldn't (because they're referenced). This should fix. Thanks to Peter and Rafael for discussion and help diagnosing the issue! Found during LTO of unittests. llvm-svn: 265208
* [LTO] Add a test to ensure we treat externally available symbols correctly.Davide Italiano2016-03-301-0/+6
| | | | | | We already get it right, but there was no coverage for it. llvm-svn: 264925
* [LTO] Include in .symtab/.dynsym symbols introduced by optimizations.Davide Italiano2016-03-291-0/+5
| | | | | | | | | | | | Some optimizations, e.g. SimplifyLibCalls, can replace functions with others as part of the lowering, e.g. printf => puts. The new symbols don't have the isUsedInRegularObj flag set so they don't get included in the final symbol table (and dynamic symbol table), and the dynamic linker gets confused. Include them as a fix. Differential Revision: http://reviews.llvm.org/D18357 llvm-svn: 264688
* [LTO] Keep linkonce symbols when required.Davide Italiano2016-03-231-0/+6
| | | | | | | Similarly to how we do with linkonce_odr symbols already, but change their linkage to weak. llvm-svn: 264181
* [LTO] Keep linkonce_odr symbols when appropriate.Davide Italiano2016-03-221-0/+6
| | | | | | | | | | | Ensure we keep the symbol we need to before it reaches the Writer (and hit an assertion), changing its linkage from linkonce_odr to weak. For a more detailed description of the problem, see PR19901 where a similar problem was fixed for the gold plugin. Thanks to Rafael for providing a testcase. llvm-svn: 264111
* [lto] Add beginning of -save-temps option.Sean Silva2016-03-091-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: This is useful for debugging issues with LTO. The option follows the analogous option in ld64 and the gold plugin (per Rafael's suggestion). For starters, this only dumps the combined bitcode file. In a future patch I will add dumping for the .o file. The naming of the output follows ld64's convention which is slightly more consistent IMO (consistent `.lto.<extension>` for all the files). Reviewers: rafael, ruiu Subscribers: joker.eph, Bigcheese, llvm-commits Differential Revision: http://reviews.llvm.org/D18006 llvm-svn: 263055
* [lto] Record whether a variable is TLS.Sean Silva2016-03-091-0/+4
| | | | | | | | | | | | Summary: Reviewers: rafael Subscribers: Bigcheese, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D17974 llvm-svn: 262975
* Add support for common symbols.Rafael Espindola2016-03-071-0/+1
| | | | llvm-svn: 262848
OpenPOWER on IntegriCloud