summaryrefslogtreecommitdiffstats
path: root/lld/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for R_HEX_B32_PCREL_X, R_HEX_B22_PCREL_X relocationsSid Manning2018-07-191-0/+8
| | | | | | | | A couple more basic relocations plus testcase. Differential Revision: https://reviews.llvm.org/D47791 llvm-svn: 337484
* [ELF] - Eliminate dead code. NFC.George Rimar2018-07-191-2/+1
| | | | | | Code was dead because we call postThunkContents only for SHT_SYMTAB. llvm-svn: 337460
* ELF: Implement --icf=safe using address-significance tables.Peter Collingbourne2018-07-186-11/+85
| | | | | | Differential Revision: https://reviews.llvm.org/D48146 llvm-svn: 337429
* [ELF] Error if -r --gdb-index are used togetherFangrui Song2018-07-181-0/+2
| | | | | | | | | | Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D49513 llvm-svn: 337427
* Revert r336609: Fix direct calls to __wrap_sym when it is relocated.Rui Ueyama2018-07-184-16/+1
| | | | | | | This reverts commit r336609 as it doesn't seem to work with AArch64 thunk creation when used with ASan. llvm-svn: 337413
* Fix `ld.lld --help` message.Rui Ueyama2018-07-181-2/+2
| | | | llvm-svn: 337405
* [ELF] - Stop silently producing a broken .eh_frame_hdr.George Rimar2018-07-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, getFdePC() returns uint64_t. Its because the following encodings might use 8 bytes: DW_EH_PE_absptr and DW_EH_PE_udata8. But caller assigns returned value to uint32_t field: https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L508 Value is used for building .eh_frame_hdr section. We use DW_EH_PE_sdata4 encoding for building it at this moment: https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L2545 And that means that an overflow issue might happen if DW_EH_PE_absptr/DW_EH_PE_udata8 address encodings are present in .eh_frame. In that case, before this patch, we silently would truncate the address and produced broken .eh_frame_hdr section. It would be not hard to support real 64-bit values for DW_EH_PE_absptr/DW_EH_PE_udata8 encodings, but it is unclear if it is usefull and if we should do it. Since nobody faced/reported it, int this patch I only implement a check to stop producing broken output silently for now. llvm-svn: 337382
* [ELF] - Do not produce broken output when amount of sections is > ~65kGeorge Rimar2018-07-181-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | This is a part of ttps://bugs.llvm.org//show_bug.cgi?id=38119 We produce broken ELF header now when the number of output sections is >= SHN_LORESERVE (0xff00). ELF spec says (http://www.sco.com/developers/gabi/2003-12-17/ch4.eheader.html): e_shnum: If the number of sections is greater than or equal to SHN_LORESERVE (0xff00), this member has the value zero and the actual number of section header table entries is contained in the sh_size field of the section header at index 0. (Otherwise, the sh_size member of the initial entry contains 0.) e_shstrndx If the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00), this member has the value SHN_XINDEX (0xffff) and the actual index of the section name string table section is contained in the sh_link field of the section header at index 0. (Otherwise, the sh_link member of the initial entry contains 0.) We did not set these fields correctly earlier. The patch fixes the issue. Differential revision: https://reviews.llvm.org/D49371 llvm-svn: 337363
* Workaround warning bug in old versions of gcc.Sterling Augustine2018-07-181-0/+6
| | | | | | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 llvm-svn: 337340
* Implement framework for linking split-stack object files, and x86_64 support.Sterling Augustine2018-07-177-13/+206
| | | | llvm-svn: 337332
* [ELF] - Eliminate dead 'return' in EhFrameSection::finalizeContents(). NFC.George Rimar2018-07-171-3/+1
| | | | | | | | | EhFrameSection::finalizeContents() is called from a single place: https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L1559 So code was dead. llvm-svn: 337287
* [ELF] - Remove dead code from EhFrameSection::addCie. NFC.George Rimar2018-07-171-5/+1
| | | | | | | | Code was dead because caller of the addCie() already checks that ID is equal to 0: https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L431 llvm-svn: 337281
* [ELF] - Eliminate dead code. NFC.George Rimar2018-07-171-2/+0
| | | | | | | | | Code was dead because at the moment of BssSection creation it can never have a parent. Also, code simply does not make sence as alignment adjastment happens when BssSection is added to its parent later. llvm-svn: 337276
* [ELF] - Simplify Symbol::getSize(). NFC.George Rimar2018-07-171-3/+1
| | | | | | | | | | There are following symbols currently available: DefinedKind, SharedKind, UndefinedKind, LazyArchiveKind, LazyObjectKind. Our code calls getSize() only for first two and there seems to be no reason to return 0 for the rest. llvm-svn: 337265
* Support option -plugin-opt=dwo_dir=Yunlian Jiang2018-07-164-0/+5
| | | | | | | | | | | | | | | | Summary: This adds support to option -plugin-opt=dwo_dir=${DIR}. This option is used to specify the directory to store the .dwo files when LTO and debug fission is used at the same time. Reviewers: ruiu, espindola, pcc Reviewed By: pcc Subscribers: eraman, dexonsmith, mehdi_amini, emaste, arichardson, steven_wu, llvm-commits Differential Revision: https://reviews.llvm.org/D47904 llvm-svn: 337195
* [ELF] - Eliminate ObjFile<ELFT>::getLineInfo. NFC.George Rimar2018-07-163-14/+2
| | | | | | Flow is the same, but a bit shorter after this change. llvm-svn: 337183
* [ELF] - Simplify code. NFC.George Rimar2018-07-121-6/+2
| | | | | | Just use getDataAs for taking sections contents. llvm-svn: 336892
* [ELF] - Eliminate dead code. NFC.George Rimar2018-07-121-4/+0
| | | | | | | | | Code is dead because caller of the isDuplicateArmExidxSex (https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L1446) explicitly does not pass sentinel. So no reason to check it. llvm-svn: 336891
* Also search BitcodeFiles for exclude-lib symbolsYi Kong2018-07-111-1/+8
| | | | | | | | Archives created with ThinLTO are bitcodes, they also need to be searched for excluded symbols. Differential Revision: https://reviews.llvm.org/D48857 llvm-svn: 336826
* [ELF] - Simplify code. NFC.George Rimar2018-07-111-8/+5
| | | | | | This looks a bit simpler IMO. llvm-svn: 336815
* [ELF] - Simplify. NFCI.George Rimar2018-07-111-2/+1
| | | | | | | It does not look possible to end up with empty Sections at this place. And this knowledge allows simplifying the code. llvm-svn: 336814
* [ELF] - Add classof() member for ARMExidxSentinelSection. George Rimar2018-07-112-0/+6
| | | | | | | | | | | | | | Or code uses constructions like isa<ARMExidxSentinelSection>: https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L1428 https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L2944 That is confusing, because without ARMExidxSentinelSection::classof() these lines are equal to isa<SyntheticSection> and the code does not really do the same what it expected to. I found no good way to break it though, but it is not nice. Patch adds ARMExidxSentinelSection::classof(). llvm-svn: 336813
* [ELF] Update addends in non-allocatable sections for REL targets when ↵Igor Kudrin2018-07-111-1/+20
| | | | | | | | | | creating a relocatable output. This fixes PR37735. Differential Revision: https://reviews.llvm.org/D48929 llvm-svn: 336799
* [ELF] - Report proper error message about mixing bitcode files.George Rimar2018-07-111-1/+1
| | | | | | | | | 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
* Remove dead code.Rui Ueyama2018-07-111-2/+0
| | | | llvm-svn: 336791
* Parallelize GdbIndexSection's symbol table creation.Rui Ueyama2018-07-111-13/+41
| | | | | | | | | | | | | | | | | | | | | Since .gdb_index sections contain all known symbols, they can be very large. One of my executables has a .gdb_index section of 1350 GiB. Uniquifying symbols by name takes 3.77 seconds on my machine. This patch parallelize it. Time to call createSymbols() with 8.4 million unique symbols: Without this patch: 3773 ms Parallelism = 1: 4374 ms Parallelism = 2: 2628 ms Parallelism = 16: 837 ms As you can see above, this algorithm is a bit more inefficient than the non-parallelized version, but even with dual-core, it is faster than that, so I think it is overall a win. Differential Revision: https://reviews.llvm.org/D49164 llvm-svn: 336790
* Remove a workaround for an old GCC bug.Rui Ueyama2018-07-111-5/+1
| | | | | | | | | | | | | | This workaround is for GCC 5.4.1. Without this workaround, lld will produce larger .gdb_index sections for object files compiled with the buggy version of the compiler. Since it is not for correctness, and it affects only debug builds (since you are generating .gdb_index sections), perhaps the hack shouldn't have been added in the first place. At least, I think it is time to remove this hack. Differential Revision: https://reviews.llvm.org/D49149 llvm-svn: 336788
* Refactor GdbIndexSection. NFC.Rui Ueyama2018-07-103-161/+165
| | | | | | | | | | | | | | | | This patch merges createGdbIndex function and GdbIndexSection's constructor into a single static member function of the class. This patch also change how we keep CU vectors. Previously, CuVector and GdbSymbols were parallel arrays, but there's no reason to choose that design. Now, CuVector is a member of GdbSymbol class. A lot of members are removed from GdbIndexSection. Previously, it has members that need to be kept in sync over several phases. I belive the new design is less error-prone, and the new code is much easier to read than before. llvm-svn: 336743
* [ELF][MIPS] Add mote tests on MipsArchTree routines, fix typos in error messagesSimon Atanasyan2018-07-101-16/+17
| | | | | | | | | This fix add more test cases for routines check MIPS ELF header flags and flags from .MIPS.abiflags sections. The tests use yaml2obj for object files generation because not all combinations of flags can be produced by LLVM tools. llvm-svn: 336704
* Initialize a variable properly to fix buildbots.Rui Ueyama2018-07-101-1/+1
| | | | llvm-svn: 336700
* Make a struct type declaration private. NFC.Rui Ueyama2018-07-101-7/+6
| | | | llvm-svn: 336690
* Simplify. NFC.Rui Ueyama2018-07-101-1/+1
| | | | llvm-svn: 336686
* Rename a variable for consistency. NFC.Rui Ueyama2018-07-101-3/+3
| | | | llvm-svn: 336674
* Reduce memory usage when creating .gdb_index. NFC.Rui Ueyama2018-07-102-97/+69
| | | | | | | | | | | | | | .gdb_index sections can be very large. When you are compiling multi-gibibyte executables, they can be larger than 1 GiB. The previous implementation of .gdb_index seems to consume too much memory. This patch reduces memory consumption by eliminating temporary objects. In one experiment, memory consumption of GdbIndexSection class is reduced from 962 MiB to 228 MiB when creating a .gdb_index of 1350 GiB. Differential Revision: https://reviews.llvm.org/D49094 llvm-svn: 336672
* [ELF] - Improve call graph pasing error reporting.George Rimar2018-07-101-4/+2
| | | | | | | This adds a file name to the error message, adds a missing test case and refactors code a bit. llvm-svn: 336651
* [ELF] - Report call graph profile file names in error messages.George Rimar2018-07-101-2/+2
| | | | | | We did not report file names for some reason. llvm-svn: 336650
* Report an error for an extremely large .gdb_index section.Rui Ueyama2018-07-102-15/+18
| | | | | | | | | | I believe the only way to test this functionality is to create extremely large object files and attempt to create a .gdb_index that is greater than 4 GiB. But I think that's too much for most environments and buildbots, so I'm commiting this without a test that actually triggers the new error condition. llvm-svn: 336631
* Fix a bug for packed relocations.Rui Ueyama2018-07-091-15/+21
| | | | | | | | | Previously, we didn't create multiple consecutive bitmaps. Added a test to catch this bug too. Differential Revision: https://reviews.llvm.org/D49107 llvm-svn: 336620
* Simplify RelrSection<ELFT>::updateAllocSize.Rui Ueyama2018-07-091-40/+34
| | | | | | | | | This patch also speeds it up by making some constants compile-time constants. Other than that, NFC. Differential Revision: https://reviews.llvm.org/D49101 llvm-svn: 336614
* Fix direct calls to __wrap_sym when it is relocated.Rui Ueyama2018-07-094-1/+16
| | | | | | | | | | | | Patch by Matthew Koontz! Before, direct calls to __wrap_sym would not map to valid PLT entries, so they would crash at runtime. This change maps such calls to the same PLT entry as calls to sym that are then wrapped. Differential Revision: https://reviews.llvm.org/D48502 llvm-svn: 336609
* Factor out code to parse -pack-dyn-relocs. NFC.Rui Ueyama2018-07-092-15/+18
| | | | llvm-svn: 336599
* lld: add experimental support for SHT_RELR sections.Rui Ueyama2018-07-098-21/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Rahul Chaudhry! This change adds experimental support for SHT_RELR sections, proposed here: https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg Pass '--pack-dyn-relocs=relr' to enable generation of SHT_RELR section and DT_RELR, DT_RELRSZ, and DT_RELRENT dynamic tags. Definitions for the new ELF section type and dynamic array tags, as well as the encoding used in the new section are all under discussion and are subject to change. Use with caution! Pass '--use-android-relr-tags' with '--pack-dyn-relocs=relr' to use SHT_ANDROID_RELR section type instead of SHT_RELR, as well as DT_ANDROID_RELR* dynamic tags instead of DT_RELR*. The generated section contents are identical. '--pack-dyn-relocs=android+relr --use-android-relr-tags' enables both '--pack-dyn-relocs=android' and '--pack-dyn-relocs=relr': lld will encode the relative relocations in a SHT_ANDROID_RELR section, and pack the rest of the dynamic relocations in a SHT_ANDROID_REL(A) section. Differential Revision: https://reviews.llvm.org/D48247 llvm-svn: 336594
* [PPC64] Add TLS local dynamic to local exec relaxationZaara Syeda2018-07-094-8/+68
| | | | | | | | | This patch adds the target call back relaxTlsLdToLe to support TLS relaxation from local dynamic to local exec model. Differential Revision: https://reviews.llvm.org/D48293 llvm-svn: 336559
* [ELF] - Remove dead code #2.George Rimar2018-07-061-4/+1
| | | | | | 'Pos' is never can be 0 here. llvm-svn: 336436
* [ELF] - Remove dead code. NFC.George Rimar2018-07-061-2/+0
| | | | | | 'Pos' can never be 0. llvm-svn: 336435
* [ELF][MIPS] Simplify `checkFlags` routine and inline `rejectMicroMips64`. NFCSimon Atanasyan2018-07-061-9/+6
| | | | llvm-svn: 336414
* [ELF][MIPS] Remove support for linking microMIPS 64-bit codeSimon Atanasyan2018-07-062-19/+10
| | | | | | | | | Remove support for linking microMIPS 64-bit code because this kind of ISA is rarely used and unsupported by LLVM. Differential revision: https://reviews.llvm.org/D48949 llvm-svn: 336413
* Remove redundnat call of makeArrayRef(). NFC.Rui Ueyama2018-07-051-1/+1
| | | | llvm-svn: 336378
* Simplify PPC64::calcEFlags().Rui Ueyama2018-07-051-40/+9
| | | | | | | | | | In this file we only have to handle the v2 ABI, so what we need to do is to just make sure that all object files have v2 or unspecified version number. Differential Revision: https://reviews.llvm.org/D48112 llvm-svn: 336372
* [ELF] - Eliminate dead "if". NFC.George Rimar2018-07-051-2/+0
| | | | | | | | | | | | We call switchTo() from assignAddresses() for switching to Aether, and from assignOffsets(). First calls assignOffsets() one by one for each output section. (https://github.com/llvm-mirror/lld/blob/master/ELF/LinkerScript.cpp#L1045) That I believe means the condition removed in this patch is dead. llvm-svn: 336356
OpenPOWER on IntegriCloud