summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-readobj] Should declare `ListScope` for `verneed` entries.Xing GUO2019-04-102-30/+36
| | | | | | | | | | | | | | | | Summary: YAML mappings require keys to be unique. See: https://yaml.org/spec/1.2/spec.html#id2764652 Reviewers: jhenderson, grimar, rupprecht, espindola, ruiu Reviewed By: ruiu Subscribers: ruiu, emaste, arichardson, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60438 llvm-svn: 358078
* Discard debuginfo for object files empty after GCRui Ueyama2019-04-107-19/+56
| | | | | | | | | | | | | | | | | | | | | | Patch by Robert O'Callahan. Rust projects tend to link in all object files from all dependent libraries and rely on --gc-sections to strip unused code and data. Unfortunately --gc-sections doesn't currently strip any debuginfo associated with GC'ed sections, so lld links in the full debuginfo from all dependencies even if almost all that code has been discarded. See https://github.com/rust-lang/rust/issues/56068 for some details. Properly stripping debuginfo for discarded sections would be difficult, but a simple approach that helps significantly is to mark debuginfo sections as live only if their associated object file has at least one live code/data section. This patch does that. In a (contrived but not totally artificial) Rust testcase linked above, it reduces the final binary size from 46MB to 5.1MB. Differential Revision: https://reviews.llvm.org/D54747 llvm-svn: 358069
* Rename a variable and add a comment.Rui Ueyama2019-04-102-3/+15
| | | | llvm-svn: 358049
* Move tests in r357996 to correct location within monorepoChih-Mao Chen2019-04-095-0/+179
| | | | llvm-svn: 357997
* [RISCV] Rewrite tests to use llvm-mc/llvm-objdumpChih-Mao Chen2019-04-096-651/+0
| | | | | | | | | | | Previously the tests in lld for RISC-V were given in yaml format as LLVM's RISC-V assembler support was incomplete. Now that the assembler/disassembler has matured we can rewrite all tests to use LLVM's tools. Differential Revision: https://reviews.llvm.org/D60415 llvm-svn: 357996
* [RISCV] Fix range check for HI20/LO12/RVC_LUI relocationsChih-Mao Chen2019-04-091-12/+13
| | | | | | | | | | | | | | | | | The code previously specified a 32-bit range for R_RISCV_HI20 and R_RISCV_LO12_[IS], however this is incorrect as the maximum offset on RV64 that can be formed from the immediate of lui and the displacement of an I-type or S-type instruction is -0x80000800 to 0x7ffff7ff. There is also the same issue with a c.lui and LO12 pair, whose actual addressable range should be -0x20800 to 0x1f7ff. The tests will be included in the next patch that converts all RISC-V tests to use llvm-mc instead of yaml2obj, as assembler support has matured enough to write tests in them. Differential Revision: https://reviews.llvm.org/D60414 llvm-svn: 357995
* De-template SymbolTable::addShared.Rui Ueyama2019-04-093-28/+17
| | | | | | | Because of r357925, this member function doesn't have to be a template of ELFT. llvm-svn: 357982
* [WebAssembly] Ensure ArchiveName is set even in the presence of --whole-archive.Sam Clegg2019-04-096-11/+19
| | | | | | Differential Revision: https://reviews.llvm.org/D60431 llvm-svn: 357966
* ELF: Move verneed tracking data structures out of VersionNeedSection.Peter Collingbourne2019-04-087-87/+89
| | | | | | | | | | | | | | | | For partitions I intend to use the same set of version indexes in each partition for simplicity. Since each partition will need its own VersionNeedSection this will require moving the verneed tracking out of VersionNeedSection. The way I've done this is to move most of the tracking into SharedFile. What will eventually become the per-partition tracking still lives in VersionNeedSection. As a bonus the code gets a little simpler and more consistent with how we handle verdef. Differential Revision: https://reviews.llvm.org/D60307 llvm-svn: 357926
* ELF: De-template SharedFile. NFCI.Peter Collingbourne2019-04-0811-181/+165
| | | | | | Differential Revision: https://reviews.llvm.org/D60305 llvm-svn: 357925
* Fix -emit-reloc against local symbols.Rui Ueyama2019-04-082-0/+19
| | | | | | | | | | | | | | | | Previously, we drop symbols starting with .L from the symbol table, so if there is a relocation that refers a .L symbol, it ended up referencing a null -- which happened to be interpreted as an absolute symbol. This patch copies all symbols including local ones if -emit-reloc is given. Fixes https://bugs.llvm.org/show_bug.cgi?id=41385 Differential Revision: https://reviews.llvm.org/D60306 llvm-svn: 357885
* ELF: De-template ELFFileBase. NFCI.Peter Collingbourne2019-04-056-67/+70
| | | | | | Differential Revision: https://reviews.llvm.org/D60304 llvm-svn: 357806
* ELF: Simplify. NFCI.Peter Collingbourne2019-04-051-7/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D60299 llvm-svn: 357739
* Remove redundant parameters. NFC.Rui Ueyama2019-04-051-7/+7
| | | | llvm-svn: 357738
* [WebAssembly] Include function in wasm table when used in ↵Sam Clegg2019-04-052-6/+14
| | | | | | | | | | | | R_WASM_TABLE_INDEX_REL_SLEB This should have been part of rL357710 but was overlooked because in our test code the function in question was also used in other relocations that caused it to be added to the table anyway. Differential Revision: https://reviews.llvm.org/D60296 llvm-svn: 357737
* [WebAssembly] Apply data relocations at runtime in shared objectsSam Clegg2019-04-0410-43/+189
| | | | | | | | | | | | | See: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md Data section relocations in wasm shared libraries are applied by the library itself at static constructor time. This change adds a new synthetic function that applies relocations to relevant memory locations on startup. Differential Revision: https://reviews.llvm.org/D59278 llvm-svn: 357715
* [WebAssembly] Add new explicit relocation types for PIC relocationsSam Clegg2019-04-042-2/+10
| | | | | | | | See https://github.com/WebAssembly/tool-conventions/pull/106 Differential Revision: https://reviews.llvm.org/D59907 llvm-svn: 357710
* [COFF] Fix delay import directory iteratorJoseph Tremoulet2019-04-043-0/+236
| | | | | | | | | | | | | | | | | | Summary: Take the Index into account in `getDelayImportTable`, otherwise we always return the entry for the first delay DLL reference. Reviewers: ruiu Reviewed By: ruiu Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60081 llvm-svn: 357697
* ELF: Move SymtabSHNDX and getSectionIndex() to ObjFile. NFCI.Peter Collingbourne2019-04-042-11/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D60244 llvm-svn: 357670
* [codeview] Remove Type member from CVRecordReid Kleckner2019-04-041-3/+3
| | | | | | | | | | | | | | | | | Summary: Now CVType and CVSymbol are effectively type-safe wrappers around ArrayRef<uint8_t>. Make the kind() accessor load it from the RecordPrefix, which is the same for types and symbols. Reviewers: zturner, aganea Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60018 llvm-svn: 357658
* [LLD] - Update the test cases after yaml2obj change.George Rimar2019-04-0337-296/+281
| | | | | | | | | https://reviews.llvm.org/D60122 (r357595) changed the symbols description format. This change updates the LLD tests. llvm-svn: 357596
* [COFF] Reduce the size of Chunk and SectionChunk, NFCReid Kleckner2019-04-024-31/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Reorder the fields in both to use padding more efficiently, and add more comments on the purpose of the fields. Replace `std::vector<SectionChunk*> AssociativeChildren` with a singly-linked list. This avoids the separate vector allocation to list associative children, and shrinks the 3 pointers used for the typically empty vector down to 1. In the end, this reduces the sum of heap allocations used to link browser_tests.exe with NO PDB by 13.10%, going from 2,248,728 KB to 1,954,071 KB of heap. These numbers exclude memory mapped files, which are of course a significant factor in LLD's memory usage. Reviewers: ruiu, mstorsjo, aganea Subscribers: jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59797 llvm-svn: 357535
* [LLD][COFF] Move type merging structures out of PDB.cpp. NFCAlexandre Ganea2019-04-022-54/+88
| | | | | | | | | | | | Introduce a new TypeMerger class, out of some type-merge-specific structures from PDB.cpp No changes intended / this is only moving code around. This patch is step 3. in "Proposed commit strategy" in D59226 Differential Revision: https://reviews.llvm.org/D60070 llvm-svn: 357525
* [NFC][LLD] Specify namespaces explicity to fix build failure on GCC 5 after ↵Matthew Voss2019-04-011-3/+7
| | | | | | r357383 llvm-svn: 357421
* ELF: Perform per-section .ARM.exidx processing during ↵Peter Collingbourne2019-04-013-54/+56
| | | | | | | | | | | | combineEhFrameSections(). NFCI. And rename the function to combineEhSections(). This makes the processing of .ARM.exidx even more similar to .eh_frame and means that we can avoid an additional loop over InputSections. Differential Revision: https://reviews.llvm.org/D60026 llvm-svn: 357417
* Fix builder.Alexandre Ganea2019-04-011-2/+2
| | | | | | http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/24702/steps/check-fuzzer/logs/stdio llvm-svn: 357391
* [LLD][COFF] Early dependency detectionAlexandre Ganea2019-04-016-59/+238
| | | | | | | | | | | | We introduce a new class hierarchy for debug types merging (in DebugTypes.h). The end-goal is to parallelize the type merging - please see the plan in D59226. Previously, dependency discovery was done on the fly, much later, during the type merging loop. Unfortunately, parallelizing the type merging requires the dependencies to be merged in first, before any dependent ObjFile, thus this early discovery. The overall intention for this path is to discover debug information dependencies at a much earlier stage, when processing input files. Currently, two types of dependency are supported: PDB type servers (when compiling with MSVC /Zi) and precompiled headers OBJs (when compiling with MSVC /Yc and /Yu). Once discovered, an explicit link is added into the dependent ObjFile, through the new debug types class hierarchy introduced in DebugTypes.h. Differential Revision: https://reviews.llvm.org/D59053 llvm-svn: 357383
* [ELF] Rename SyntheticSection::empty to more appropriate isNeeded() with ↵Fangrui Song2019-04-013-41/+41
| | | | | | | | | | | | | | | | | | | | | | | opposite meaning Summary: Some synthetic sections can be empty while still being needed, thus they can't be removed by removeUnusedSyntheticSections(). Rename this member function to more appropriate isNeeded() with the opposite meaning. No functional change intended. Reviewers: ruiu, espindola Reviewed By: ruiu Subscribers: jhenderson, grimar, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59982 llvm-svn: 357377
* Simplify. NFC.Rui Ueyama2019-04-011-13/+13
| | | | llvm-svn: 357373
* Replace `typedef A B` with `using B = A`. NFC.Rui Ueyama2019-04-0113-58/+58
| | | | | | | | I did this using Perl. Differential Revision: https://reviews.llvm.org/D60003 llvm-svn: 357372
* Re-land "[WebAssembly] Improve invalid relocation error message""Sam Clegg2019-03-294-11/+12
| | | | | | | | | | See https://reviews.llvm.org/D59860 The initial version of this change effected more than just the error message. This version is scoped down to only effect the error itself. llvm-svn: 357328
* Fix build following r357308 : Ensure only live thunks are considered when ↵Alexandre Ganea2019-03-291-0/+3
| | | | | | creating import modules llvm-svn: 357316
* Don't copy the .drective section with std::stringReid Kleckner2019-03-292-3/+3
| | | | | | Both COFF and bitcode input files expose these as stable strings. llvm-svn: 357314
* [WebAssembly] "atomics" feature requires shared memoryThomas Lively2019-03-293-3/+146
| | | | | | | | | | | | | | | | | | Summary: Makes it a linker error if the "atomics" feature is used but the user does not opt in to shared memory or if "atomics" is disallowed but the user does opt in to shared memory. Also check that an appropriate max memory size is supplied if shared memory is used. Reviewers: sbc100, aheejin Subscribers: dschuff, jgravelle-google, sunfish, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59281 llvm-svn: 357310
* [LLD][COFF] Generate import modules & COFF groups in PDBAlexandre Ganea2019-03-296-31/+312
| | | | | | | | | | | | Generate import modules for each imported DLL, along with its symbol stream. Also create COFF groups in the * Linker * module, one for each PartialSection (input, unmerged sections) Currently COFF groups are disabled for MINGW because it significantly increases PDB sizes. We could enable that later with an option. The overall objective for this change is to support code hot patching tools. Such tools need to know the import libraries used, from the PDB alone. Differential Revision: https://reviews.llvm.org/D54802 llvm-svn: 357308
* [LLD][COFF] Improve checkFailIfMismatch()Alexandre Ganea2019-03-294-8/+12
| | | | | | | | As suggested by ruiu here (https://reviews.llvm.org/D58910#1425484), defer a call to toString(File) until it's really needed (if there's an error) Differential Revision: https://reviews.llvm.org/D59411 llvm-svn: 357305
* [ELF][MachO][wasm] Simplify range-style std::find{,_if} with STLExtras.h ↵Fangrui Song2019-03-297-22/+16
| | | | | | utilities. NFC llvm-svn: 357269
* Revert "[WebAssembly] Improve invalid relocation error message"Derek Schuff2019-03-294-21/+14
| | | | | | This reverts commit 0805ec5f7b5c80474352531a99e721c30e73e77f. llvm-svn: 357225
* Revert "[WebAssembly] Improve invalid relocation error message"Derek Schuff2019-03-293-5/+5
| | | | | | | | | | | | | Also Revert "[WebAssembly] Fix typo from rL357143" This reverts commit 0805ec5f7b5c80474352531a99e721c30e73e77f and a9958fc30d0c6d4c140be892c5a824b827d2eb5d (rL357143 and rL357144) They cause failures with address-taken extern (JS) functions in emscripten. llvm-svn: 357224
* Remove a duplicate assignment. NFC.Rui Ueyama2019-03-281-1/+0
| | | | llvm-svn: 357223
* Fixed the lld test using ld-lld command to use ld.lld instead.Rumeet Dhindsa2019-03-281-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D59962 llvm-svn: 357216
* [COFF] Optimize range extension thunk insertion memory usageReid Kleckner2019-03-285-53/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This avoids allocating O(#relocs) of intermediate data for each section when range extension thunks aren't needed for that section. This also removes a std::vector from SectionChunk, which further reduces its size. Instead, this change adds the range extension thunk symbols to the object files that contain sections that need extension thunks. By adding them to the symbol table of the parent object, that means they now have a symbol table index. Then we can then modify the original relocation, after copying it to read-write memory, to use the new symbol table index. This makes linking browser_tests.exe with no PDB 10.46% faster, moving it from 11.364s to 10.288s averaged over five runs. Reviewers: mstorsjo, ruiu Subscribers: aganea, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59902 llvm-svn: 357200
* Create an instance of Target after reading all input files. NFC.Rui Ueyama2019-03-285-19/+26
| | | | | | | | This change itself doesn't mean anything, but it helps D59780 because in patch, we don't know whether we need to create a CET-aware PLT or not until we read all input files. llvm-svn: 357194
* Make a member function a non-member function.Rui Ueyama2019-03-281-6/+2
| | | | | | | Since this member function doesn't use anything in the class, it doesn't have to be a member of the class. llvm-svn: 357193
* De-template X86_64TargetInfo. NFC.Rui Ueyama2019-03-283-90/+54
| | | | llvm-svn: 357191
* Make helper functions static. NFC.Benjamin Kramer2019-03-281-1/+2
| | | | llvm-svn: 357187
* Make TargetInfo const. NFC.Rui Ueyama2019-03-282-4/+4
| | | | | | | We do not mutate a TargetInfo instance after creating it. This change makes it explicit. llvm-svn: 357185
* [ELF][ARM] Recommit Redesign of .ARM.exidx handling to use a SyntheticSectionPeter Smith2019-03-2813-176/+498
| | | | | | | | | | | | | | | | | | | | | | Recommit r356666 with fixes for buildbot failure, as well as handling for --emit-relocs, which we decide not to emit any relocation sections as the table is already position independent and an offline tool can deduce the relocations. Instead of creating extra Synthetic .ARM.exidx sections to account for gaps in the table, create a single .ARM.exidx SyntheticSection that can derive the contents of the gaps from a sorted list of the executable InputSections. This has the benefit of moving the ARM specific code for SyntheticSections in SHF_LINK_ORDER processing and the table merging code into the ARM specific SyntheticSection. This also makes it easier to create EXIDX_CANTUNWIND table entries for executable InputSections that don't have an associated .ARM.exidx section. Fixes pr40277 Differential Revision: https://reviews.llvm.org/D59216 llvm-svn: 357160
* [WebAssembly] Fix typo from rL357143Sam Clegg2019-03-283-5/+5
| | | | llvm-svn: 357144
* [WebAssembly] Improve invalid relocation error messageSam Clegg2019-03-284-14/+21
| | | | | | | | This message now matches the equivalent message in the ELF linker. Differential Revision: https://reviews.llvm.org/D59860 llvm-svn: 357143
OpenPOWER on IntegriCloud