summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix retpoline PLT for x86-64 when used for >4GB address.Rui Ueyama2018-05-252-3/+11
| | | | | | Previously, we wrote only the least significant 32 bits. llvm-svn: 333313
* Add a comment for retpoline PLT.Rui Ueyama2018-05-251-0/+9
| | | | llvm-svn: 333312
* Fix a bug that we truncated GOTPLT entries to 32 bits.Rui Ueyama2018-05-252-1/+17
| | | | llvm-svn: 333294
* Add llvm-bcanalyzer as an LLD test dependencyJames Henderson2018-05-251-1/+1
| | | | | | | | | | | | Recently an LLD test change was made that introduced the use of llvm-bcanalyzer. This change adds the tool to the list of LLD test dependencies. Reviewed by: rdhindsa, ruiu Patch by Owen Reynolds. llvm-svn: 333277
* Fix regex in lld ppc64-ifunc test.Sean Fertile2018-05-241-1/+1
| | | | | | One of the regexes for reading in a hex address was missing the a-f part. llvm-svn: 333209
* [PPC64] Set the IRelative relocation type.Sean Fertile2018-05-242-0/+11
| | | | | | | Set the IRelative relocation type and extend the related test to verify. Differential Revision: https://reviews.llvm.org/D46877 llvm-svn: 333203
* [PPC64] Add .toc section after .got sectionZaara Syeda2018-05-244-6/+128
| | | | | | | | | | | | | | | | | | | | PPC64 maintains a compiler managed got in the .toc section. When accessing a global variable through got-indirect access, a .toc entry is created for the variable. The relocation for the got-indirect access will refer to the .toc section rather than the symbol that is actually accessed. The .toc entry contains the address of the global variable. We evaluate the offset from r2 (which is the TOC base) to the address of the toc entry for the global variable. Currently, the .toc is not near the .got. This causes errors because the offset from r2 to the toc section is too large. The linker needs to add all the .toc input sections to the .got output section, merging the compiler managed got with the linker got. This ensures that the offsets from the TOC base to the toc entries are not too large. This patch puts the .toc section right after the .got section. Differential Revision: https://reviews.llvm.org/D45833 llvm-svn: 333199
* Revert "[ELF] Simplify. NFC"Fangrui Song2018-05-231-2/+2
| | | | | | This reverts commit cc6f052261096dc9d4c9d3123e37b023c3e171df. llvm-svn: 333099
* Replace last DEBUG occurrence with LLVM_DEBUG in lld.Nicola Zaghen2018-05-231-9/+9
| | | | llvm-svn: 333084
* ELF: Do not ICF sections named with a C identifier.Peter Collingbourne2018-05-233-2/+17
| | | | | | | | | | A user program may enumerate sections named with a C identifier using __start_* and __stop_* symbols. We cannot ICF any such sections because that could change program semantics. Differential Revision: https://reviews.llvm.org/D47242 llvm-svn: 333054
* ELF: Do not ICF two sections with different output sections.Peter Collingbourne2018-05-236-4/+21
| | | | | | | | | | Note that this doesn't do the right thing in the case where there is a linker script. We probably need to move output section assignment before ICF to get the correct behaviour here. Differential Revision: https://reviews.llvm.org/D47241 llvm-svn: 333052
* [WebAssembly] Fix crash when relocation synbol is not liveSam Clegg2018-05-234-45/+64
| | | | | | | | | | | | | | | | When a symbol is GC'd it can still be references by relocations in the debug sections, but such symbols are not assigned virtual addresses. This change adds a new global data symbol which gets GC'd but should still appears in the output debug info, albeit with a 0 address. Fixes 37555 Differential Revision: https://reviews.llvm.org/D47238 llvm-svn: 333047
* Add missing REQUIRES: x86.Peter Collingbourne2018-05-221-0/+1
| | | | llvm-svn: 333043
* ELF: Allow ICF on .data.rel.ro sections.Peter Collingbourne2018-05-222-2/+19
| | | | | | Differential Revision: https://reviews.llvm.org/D47234 llvm-svn: 333040
* [WebAssembly] Remove dead code from LEB compression pass.Sam Clegg2018-05-221-9/+2
| | | | | | | | | | There are only certain relocation types that can exist in the wasm code section and they are all LEB types. Remove the dead code for handling the other (I32) reloc types. Differential Revision: https://reviews.llvm.org/D47226 llvm-svn: 333030
* Code cleanup in preparation for adding LTO for wasm. NFC.Sam Clegg2018-05-2211-79/+72
| | | | | | | | | | | | | | - Move some common code into Common/rrorHandler.cpp and Common/Strings.h. - Don't use `fatal` when incompatible bitcode files are encountered. - Rename NameRef variable to just Name See D47162 Differential Revision: https://reviews.llvm.org/D47206 llvm-svn: 333021
* [WebAssembly] Fix two bugs in LEB compression: properly calculate function ↵Sam Clegg2018-05-221-1/+2
| | | | | | | | | | | | | body offset, and write I32 values. * Gets function size field from right location * Writes I32 values during compression Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D47204 llvm-svn: 333002
* Move code to improve readability. NFC.Rui Ueyama2018-05-221-1/+1
| | | | llvm-svn: 332995
* Simplify. NFC.Rui Ueyama2018-05-221-9/+5
| | | | | | We can directly assign to a std::pair without std::tie. llvm-svn: 332994
* [ELF] Simplify. NFCFangrui Song2018-05-221-2/+2
| | | | llvm-svn: 332952
* CommandFlags.def -> CommandFlags.inc, leftover after r329840Fangrui Song2018-05-221-2/+2
| | | | llvm-svn: 332951
* Handle --plugin-opt= options as alias options.Rui Ueyama2018-05-227-64/+91
| | | | | | | | | | Previously, we had a loop to iterate over options starting with `--plugin-opt=` and parse them by hand. But we can make OptTable do that job for us. Differential Revision: https://reviews.llvm.org/D47167 llvm-svn: 332935
* Fix typo.Rui Ueyama2018-05-211-1/+2
| | | | llvm-svn: 332859
* [ELF] Update due to API change in .debug_line parsingJames Henderson2018-05-211-3/+6
| | | | | | | | | | See r332845. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D46832 llvm-svn: 332846
* Fix unused variable warning in non-debug builds.Richard Trieu2018-05-191-1/+1
| | | | llvm-svn: 332789
* [WebAssembly] Add option to remove LEB padding at relocate sitesSam Clegg2018-05-187-4/+175
| | | | | | | | | | | | | | | | | This change adds the ability for lld to remove LEB padding from code section. This effectively shrinks the size of the resulting binary in proportion to the number of code relocations. Since there will be a performance cost this is currently only active for -O1 and above. Some toolchains may instead want to perform this compression as a post linker step (for example running a binary through binaryen will automatically compress these values). I imagine we might want to make this the default in the future. Differential Revision: https://reviews.llvm.org/D46416 llvm-svn: 332783
* Support: Simplify endian stream interface. NFCI.Peter Collingbourne2018-05-181-1/+1
| | | | | | | | | | | | Provide some free functions to reduce verbosity of endian-writing a single value, and replace the endianness template parameter with a field. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47032 llvm-svn: 332757
* Mitigate relocation overflow [part 2 of 2]Han Shen2018-05-182-27/+36
| | | | | | | | | _init_array_start/end are placed at 0 if no ".init_array" presents, this causes .text relocation against them become more prone to overflow. This CL sets ".init_array" address to that of ".text" to mitigate the situation. Review: https://reviews.llvm.org/D46200 llvm-svn: 332688
* Resubmit [pdb] Change /DEBUG:GHASH to emit 8 byte hashes."Zachary Turner2018-05-175-258/+258
| | | | | | | This fixes the remaining failing tests, so resubmitting with no functional change. llvm-svn: 332676
* Revert "[pdb] Change /DEBUG:GHASH to emit 8 byte hashes."Zachary Turner2018-05-175-258/+258
| | | | | | | A few tests haven't been properly updated, so reverting while I have time to investigate proper fixes. llvm-svn: 332672
* [pdb] Change /DEBUG:GHASH to emit 8 byte hashes.Zachary Turner2018-05-175-258/+258
| | | | | | | | | | | | | | | | Previously we emitted 20-byte SHA1 hashes. This is overkill for identifying debug info records, and has the negative side effect of making object files bigger and links slower. By using only the last 8 bytes of a SHA1, we get smaller object files and ~10% faster links. This modifies the format of the .debug$H section by adding a new value for the hash algorithm field, so that the linker will still work when its object files have an old format. Differential Revision: https://reviews.llvm.org/D46855 llvm-svn: 332669
* Fix lld wasm debug info test on Windows (path separator, sigh)Reid Kleckner2018-05-171-5/+5
| | | | llvm-svn: 332668
* [codeview] Include record prefix in global type hashingReid Kleckner2018-05-174-98/+168
| | | | | | | | | | | | The prefix includes type kind, which is important to preserve. Two different type leafs can easily have the same interior record contents as another type. We ran into this issue in PR37492 where a bitfield type record collided with a const modifier record. Their contents were bitwise identical, but their kinds were different. llvm-svn: 332664
* Fix typo in error message.Rui Ueyama2018-05-172-2/+2
| | | | llvm-svn: 332658
* Make ALIGN work with -r in linker scriptsRui Ueyama2018-05-172-4/+26
| | | | | | | | | | | | Patch by Mark Kettenis. Make ALIGN work in linker scripts used with the -r option. This works in GNU ld (ld.bfd) and is used to generate the "random gap" object for linking the OpenBSD kernel. Differential Revision: https://reviews.llvm.org/D46839 llvm-svn: 332656
* Improve error message for -thinlto-object-suffix-replace and simplify code.Rui Ueyama2018-05-175-50/+52
| | | | llvm-svn: 332643
* [COFF] Add /Brepro and /TIMESTAMP options.Zachary Turner2018-05-175-3/+44
| | | | | | | | | | | | | | | | | | | | Previously we would always write a hash of the binary into the PE file, for reproducible builds. This breaks AppCompat, which is a feature of Windows that relies on the timestamp in the PE header being set to a real value (or at the very least, a value that satisfies certain properties). To address this, we put the old behavior of writing the hash behind the /Brepro flag, which mimics MSVC linker behavior. We also match MSVC default behavior, which is to write an actual timestamp to the PE header. Finally, we add the /TIMESTAMP option (an lld extension) so that the user can specify the exact value to be used in case he/she manually constructs a value which is both reproducible and satisfies AppCompat. Differential Revision: https://reviews.llvm.org/D46966 llvm-svn: 332613
* [ELF] - Do not crash when do --gc-sections for non-allocatable metadata ↵George Rimar2018-05-172-4/+44
| | | | | | | | | | | | | | | | sections. Currently, LLD marks all non-allocatable sections except SHF_REL[A] as Live when doing GC. This can be a reason of the crash when SHF_LINK_ORDER sections are involved, because their parents can be dead. We should do GC for them correctly. The patch implements it. Differential revision: https://reviews.llvm.org/D46880 llvm-svn: 332589
* [ELF] PowerOpen ABI -> Power Architecture 64-bit v2 ABI. NFCFangrui Song2018-05-171-5/+6
| | | | | | | | | | Reviewers: sfertile, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D46904 llvm-svn: 332572
* Add support for ThinLTO plugin option thinlto-object-suffix-replaceRumeet Dhindsa2018-05-166-2/+81
| | | | | | Differential Revision: https://reviews.llvm.org/D46608 llvm-svn: 332527
* [WebAssembly] Fix R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocation entriesSam Clegg2018-05-152-15/+5
| | | | | | | | | | | | | | | | | Fixes: lld: warning: unexpected existing value for R_WEBASSEMBLY_FUNCTION_OFFSET_I32: existing=839 expected=838 The existing solution is trying to erroneously recover correct offset of the function code from the body (which is not a function segment that includes its size, locals, and code). The D46763 is trying to maintain the offset of the function code allowing properly calculate the new relocation entry. Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D46765 llvm-svn: 332412
* [lld] Make helpers static. NFC.Benjamin Kramer2018-05-154-5/+7
| | | | llvm-svn: 332408
* [MinGW] Handle the GNU ld option -Map for outputting a linker mapMartin Storsjo2018-05-153-0/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D46872 llvm-svn: 332398
* [lld] Mitigate relocation overflow [part 1 of 2].Han Shen2018-05-1559-321/+376
| | | | | | | | | | | This CL places .dynsym and .dynstr at the beginning of SHF_ALLOC sections. We do this to mitigate the possibility that huge .dynsym and .dynstr sections placed between ro-data and text sections cause relocation overflow. Differential Revision: https://reviews.llvm.org/D45788 llvm-svn: 332374
* Remove \brief commands from doxygen comments.Fangrui Song2018-05-1514-78/+78
| | | | | | | | | | | | Summary: This is similar to D46290 D46320. Reviewers: ruiu, grimar Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D46861 llvm-svn: 332372
* [lld] Update uses of DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-1511-94/+102
| | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Differential Revision: https://reviews.llvm.org/D44977 llvm-svn: 332351
* [ELF] Implement --keep-unique optionPeter Smith2018-05-155-4/+67
| | | | | | | | | | | | | | The --keep-unique <symbol> option is taken from gold. The intention is that <symbol> will be prevented from being folded by ICF. Although not specifically mentioned in the documentation <symbol> only matches global symbols, with a warning if the symbol is not found. The implementation finds the Section defining <symbol> and removes it from the set of sections considered for ICF. Differential Revision: https://reviews.llvm.org/D46755 llvm-svn: 332332
* [MinGW] Add a LLD specific option -pdbMartin Storsjo2018-05-153-2/+12
| | | | | | | | | This allows producing pdb debug info. This is an LLD specific option since GCC and GNU binutils doesn't support the PDB file format. Differential Revision: https://reviews.llvm.org/D46796 llvm-svn: 332327
* [WebAssembly] Allow signautre of entry function to be flexibleSam Clegg2018-05-1410-29/+49
| | | | | | | | | Since we a no longer using this function for the wasm start section we don't actually care what its signature is. Differential Revision: https://reviews.llvm.org/D46594 llvm-svn: 332308
* [WebAssembly] Update to match llvm changesSam Clegg2018-05-144-27/+12
| | | | | | | | Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46849 llvm-svn: 332306
OpenPOWER on IntegriCloud