summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/Inputs
Commit message (Collapse)AuthorAgeFilesLines
* [test][ELF] Verify debug line corruption messages are printed onceJames Henderson2020-01-021-5/+21
| | | | | | | | | | | | | LLD warns if it encounters malformed debug data when parsing line information for an undefined reference. We only want to warn once. This patch adds additional checking to make sure the warnings are printed only once, both for variables within the same program and variables in later line programs. Reviewed by: grimar, MaskRay Differential Revision: https://reviews.llvm.org/D71759
* ELF: Add .interp synthetic sections first in createSyntheticSections().Peter Collingbourne2019-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | Our .interp section is not a SyntheticSection. As a result, it terminates the loop in removeUnusedSyntheticSections(). This has at least two consequences: - The synthetic .bss and .bss.rel.ro sections are always present in dynamically linked executables, even when they are not needed. - The synthetic .ARM.exidx (and possibly other) sections are always present in partitions other than the last one, even when not needed. .ARM.exidx in particular is problematic because it assumes that its list of code sections is non-empty in getLinkOrderDep(), which can lead to a crash if the partition does not have any code sections. Fix these problems by moving the creation of the .interp sections to the top of createSyntheticSections(). While here, make the code a little less error-prone by changing the add() lambdas to take a SyntheticSection instead of an InputSectionBase. Differential Revision: https://reviews.llvm.org/D68256 llvm-svn: 373347
* [ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_X86_64Fangrui Song2019-09-162-2/+2
| | | | | | | | Port the D64906 technique to EM_X86_64. Differential Revision: https://reviews.llvm.org/D67482 llvm-svn: 371958
* [ELF][test] Make tests more tolerant to exact symbol addressesFangrui Song2019-09-102-2/+3
| | | | | | Delete relocation-local.s and relocation-shared.s - covered by various tests llvm-svn: 371514
* [ELF][test] Improve and reorganize another set of testsFangrui Song2019-09-097-24/+19
| | | | | | | | | | | | | | | | | | | | | | Add file-level comments Replace trivial Input/*.s with echo ... | llvm-mc Delete insignificant addresses to make them more tolerant to layout changes Simplify test output Merge merge-section-types.s into compatible-section-types.s and add a missed case Merge gnu-ifunc-gotpcrel.s (added in D19517) into gnu-ifunc-dso.s (added in D35119) and add missed cases Delete typed-undef.s - covered by executable-undefined-ignoreall.s Delete emit-relocs-shared.s - covered by emit-relocs-merge.s Replace copy-rel-pie.s and copy-rel-pie2.s with canonical-plt-pcrel.s, canonical-plt-symbolic.s and copy-rel.s: add -no-pie cases. add a case that a canonical PLT can be created for STT_GNU_IFUNC. The logic in Symbols.h was untested: // ctor of SharedSymbol if (this->type == llvm::ELF::STT_GNU_IFUNC) this->type = llvm::ELF::STT_FUNC; llvm-svn: 371361
* [ELF][test] Improve testsFangrui Song2019-09-072-3/+0
| | | | | | | | | | | | | | Add file-level comments Delete insignificant addresses to make them more tolerant to layout changes Simplify test output Delete weak-undef-val.s - covered by relocation-undefined-weak.s Delete weak-undef-export.s - covered by additional test added to weak-undef.s Delete version-undef-sym.s - covered by undefined-versioned-symbol.s => version-symbol-undef.s Delete symbol-ordering-file2.s - covered by symbol-ordering-file.s Delete gotpcrelx.s - covered by gotpc-relax-und-dso.s => x86-64-gotpc-relax-und-dso.s llvm-svn: 371299
* [ELF][test] Simplify and reorganize testsFangrui Song2019-09-062-5/+0
| | | | | | | | | | | | Add file-level comments Delete insignificant addresses to make them more tolerant to layout changes Simplify test output Delete simple Inputs/*.s files Delete version-script-copy-rel.s - covered by verdef-defaultver.s Delete version-wildcard.test - covered by version-script-glob.s llvm-svn: 371213
* [LLD][ELF] - Simplify the bad-archive.s test case.George Rimar2019-08-211-2/+0
| | | | | | | | | This removes the precompiled binary and improves the check of the error reported. Differential revision: https://reviews.llvm.org/D66523 llvm-svn: 369516
* [ELF] For VS-style diagnostics, prefer printing full paths in the header.Igor Kudrin2019-08-091-1/+3
| | | | | | | | | | | | The filename part in the message header is used by Visual Studio to fill Error List so that a user can click on an item and jump to the mentioned location. If we use only the name of a source file and not the full path, Visual Studio might be unable to find the right file or, even worse, show a wrong one. Differential Revision: https://reviews.llvm.org/D65875 llvm-svn: 368409
* ELF: Simplify test. NFCI.Peter Collingbourne2019-07-181-4/+0
| | | | | | | | | | Avoid splitting the test into multiple files and use zero for the value of the symbol with addends at relocations so that it's clear what value is being used at relocations. Differential Revision: https://reviews.llvm.org/D64684 llvm-svn: 366463
* [lld] Add Visual Studio compatible diagnosticsChris Jackson2019-07-172-0/+37
| | | | | | | | | | | | Summary: Add a --vs-diagnostics flag that alters the format of diagnostic output to enable source hyperlinks in Visual Studio. Differential Revision: https://reviews.llvm.org/D58484 Reviewed by: ruiu llvm-svn: 366333
* [ELF] Fix variable names in comments after VariableName -> variableName changeFangrui Song2019-07-161-1/+1
| | | | | | Also fix some typos. llvm-svn: 366181
* Reland D61583 [ELF] Error on relocations to STT_SECTION symbols if the ↵Fangrui Song2019-06-261-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sections were discarded This restores r361830 "[ELF] Error on relocations to STT_SECTION symbols if the sections were discarded" and dependent commits (r362218, r362497) which were reverted by r364321, with a fix of a --gdb-index issue. .rela.debug_ranges contains relocations of range list entries: // start address of a range list entry // old: 0; after r361830: 0 00000000000033a0 R_X86_64_64 .text._ZN2v88internal7Isolate7factoryEv + 0 // end address of a range list entry // old: 0xe; after r361830: 0 00000000000033a8 R_X86_64_64 .text._ZN2v88internal7Isolate7factoryEv + e If both start and end addresses of a range list entry resolve to 0, DWARFDebugRangeList::isEndOfListEntry() will return true, then the .debug_range decoding loop will terminate prematurely: while (true) { decode StartAddress decode EndAddress if (Entry.isEndOfListEntry()) // prematurely break; Entries.push_back(Entry); } In lld/ELF/SyntheticSections.cpp, readAddressAreas() will read incomplete address ranges and the resulting .gdb_index will be incomplete. For files that gdb hasn't loaded their debug info, gdb uses .gdb_index to map addresses to CUs. The absent entries make gdb fail to symbolize some addresses. To address this issue, we simply allow relocations to undefined symbols in DWARF.cpp:findAux() and let RelocationResolver resolve them. This patch should fix: [1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190603/659848.html [2] https://bugs.chromium.org/p/chromium/issues/detail?id=978067 llvm-svn: 364391
* Revert r362743 "Revert "Revert "Reland D61583 [ELF] Error on relocations to ↵Hans Wennborg2019-06-251-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | STT_SECTION symbols if the sections were discarded""" (In effect, reverting "[ELF] Error on relocations to STT_SECTION symbols if the sections were discarded".) It caused debug info problems in LibreOffice [1] and Chromium/V8 [2]. Reverting until those can be fixed. It also reverts r362497 "STT_SECTION symbol should be defined" on .eh_frame, .debug*, .zdebug* and .gcc_except_table" which was landed as a follow-up to the above. > With -r or --emit-relocs, we warn `STT_SECTION symbol should be defined` > on relocations to discarded section symbol. This was added as an error > in rLLD319404, but was not so effective before D61583 (it turned the > error to a warning). > > Relocations from .eh_frame .debug* .zdebug* .gcc_except_table to > discarded .text are very common and somewhat expected. Don't warn/error > on them. As a reference, ld.bfd has a similar logic in > _bfd_elf_default_action_discarded() to allow these cases. > > Delete invalid-undef-section-symbol.test because what it intended to > check is now covered by the updated comdat-discarded-reloc.s > > Delete relocatable-eh-frame.s because we allow relocations from > .eh_frame as a special case now. And finally it reverts r362218 "[ELF] Replace a dead test in getSymVA() with assert()" as that also depended on the main change reverted here. > Symbols relative to discarded comdat sections are Undefined instead of > Defined now (after D59649 and D61583). The `== &InputSection::Discarded` > test becomes dead. I cannot find a test related to this behavior. [1] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190603/659848.html [2] https://bugs.chromium.org/p/chromium/issues/detail?id=978067 llvm-svn: 364321
* [ELF][PPC][X86] Use [-2**(n-1), 2**n) to check overflows for R_PPC_ADDR16, ↵Fangrui Song2019-06-248-24/+0
| | | | | | | | | | | | | | | | | | | | | R_PPC64_ADDR{16,32}, R_X86_64_{8,16} Similar to R_AARCH64_ABS32, R_PPC64_ADDR32 can represent either a signed value or unsigned value, thus we should use `[-2**(n-1), 2**n)` instead of `[-2**(n-1), 2**(n-1))` to check overflows. The issue manifests as a bogus linker error when linking the powerpc64le Linux kernel. The new behavior is compatible with ld.bfd's complain_overflow_bitfield. The upper bound of the error message is not correct. Fix it as well. The changes to R_PPC_ADDR16, R_PPC64_ADDR16, R_X86_64_8 and R_X86_64_16 are similar. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D63690 llvm-svn: 364164
* [ELF][AArch64] Support for BTI and PACPeter Smith2019-06-0711-0/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Branch Target Identification (BTI) and Pointer Authentication (PAC) are architecture features introduced in v8.5a and 8.3a respectively. The new instructions have been added in the hint space so that binaries take advantage of support where it exists yet still run on older hardware. The impact of each feature is: BTI: For executable pages that have been guarded, all indirect branches must have a destination that is a BTI instruction of the appropriate type. For the static linker, this means that PLT entries must have a "BTI c" as the first instruction in the sequence. BTI is an all or nothing property for a link unit, any indirect branch not landing on a valid destination will cause a Branch Target Exception. PAC: The dynamic loader encodes with PACIA the address of the destination that the PLT entry will load from the .plt.got, placing the result in a subset of the top-bits that are not valid virtual addresses. The PLT entry may authenticate these top-bits using the AUTIA instruction before branching to the destination. Use of PAC in PLT sequences is a contract between the dynamic loader and the static linker, it is independent of whether the relocatable objects use PAC. BTI and PAC are independent features that can be combined. So we can have several combinations of PLT: - Standard with no BTI or PAC - BTI PLT with "BTI c" as first instruction. - PAC PLT with "AUTIA1716" before the indirect branch to X17. - BTIPAC PLT with "BTI c" as first instruction and "AUTIA1716" before the first indirect branch to X17. The use of BTI and PAC in relocatable object files are encoded by feature bits in the .note.gnu.property section in a similar way to Intel CET. There is one AArch64 specific program property GNU_PROPERTY_AARCH64_FEATURE_1_AND and two target feature bits defined: - GNU_PROPERTY_AARCH64_FEATURE_1_BTI -- All executable sections are compatible with BTI. - GNU_PROPERTY_AARCH64_FEATURE_1_PAC -- All executable sections have return address signing enabled. Due to the properties of FEATURE_1_AND the static linker can tell when all input relocatable objects have the BTI and PAC feature bits set. The static linker uses this to enable the appropriate PLT sequence. Neither -> standard PLT GNU_PROPERTY_AARCH64_FEATURE_1_BTI -> BTI PLT GNU_PROPERTY_AARCH64_FEATURE_1_PAC -> PAC PLT Both properties -> BTIPAC PLT In addition to the .note.gnu.properties there are two new command line options: --force-bti : Act as if all relocatable inputs had GNU_PROPERTY_AARCH64_FEATURE_1_BTI and warn for every relocatable object that does not. --pac-plt : Act as if all relocatable inputs had GNU_PROPERTY_AARCH64_FEATURE_1_PAC. As PAC is a contract between the loader and static linker no warning is given if it is not present in an input. Two processor specific dynamic tags are used to communicate that a non standard PLT sequence is being used. DTI_AARCH64_BTI_PLT and DTI_AARCH64_BTI_PAC. Differential Revision: https://reviews.llvm.org/D62609 llvm-svn: 362793
* Revert "Revert "[ELF] Suppress "STT_SECTION symbol should be defined" on ↵Sean Fertile2019-06-061-5/+7
| | | | | | | | .eh_frame, .debug*, .zdebug* and .gcc_except_table"" This reverts commit f49f58527a6d8147524d8d6f2eb1feb70f856292. llvm-svn: 362744
* Revert "[ELF] Suppress "STT_SECTION symbol should be defined" on .eh_frame, ↵Sean Fertile2019-06-061-7/+5
| | | | | | | | | | | .debug*, .zdebug* and .gcc_except_table" This reverts commit dcba4828a9ead5f5b1fa27f0853823618075d0e0. This commit builds on dcba4828a9ead5f5b1fa27f0853823618075d0e0 which breaks the multi-staged PowerPC buildbot. llvm-svn: 362738
* Read .note.gnu.property sections and emit a merged .note.gnu.property section.Rui Ueyama2019-06-058-0/+118
| | | | | | | | | | | | | This patch also adds `--require-cet` option for the sake of testing. The actual feature for IBT-aware PLT is not included in this patch. This is a part of https://reviews.llvm.org/D59780. Submitting this first should make it easy to work with a related change (https://reviews.llvm.org/D62609). Differential Revision: https://reviews.llvm.org/D62853 llvm-svn: 362579
* [ELF] Suppress "STT_SECTION symbol should be defined" on .eh_frame, .debug*, ↵Fangrui Song2019-06-041-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .zdebug* and .gcc_except_table Summary: With -r or --emit-relocs, we warn `STT_SECTION symbol should be defined` on relocations to discarded section symbol. This was added as an error in rLLD319404, but was not so effective before D61583 (it turned the error to a warning). Relocations from .eh_frame .debug* .zdebug* .gcc_except_table to discarded .text are very common and somewhat expected. Don't warn/error on them. As a reference, ld.bfd has a similar logic in _bfd_elf_default_action_discarded() to allow these cases. Delete invalid-undef-section-symbol.test because what it intended to check is now covered by the updated comdat-discarded-reloc.s Delete relocatable-eh-frame.s because we allow relocations from .eh_frame as a special case now. Reviewers: grimar, phosek, ruiu, espindola Reviewed By: ruiu Subscribers: emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62840 llvm-svn: 362497
* [ELF][test] Reorganize some R_*_NONE testsFangrui Song2019-05-171-0/+0
| | | | | | | | | | | | | | | Change R_{386,AARCH64}_NONE yaml2obj tests/icf10.test to use assembly Add relocation-none-{arm,x86_64}.s. Check the referenced section survives under --gc-sections. Check -r copies R_X86_64_NONE R_AARCH64_NONE. (Elf*_Rel arches currently have a bug) Delete the dtrace tests as they are covered by the R_X86_64_NONE test. Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D62051 llvm-svn: 361013
* [ELF] Implement Dependent Libraries FeatureBen Dunbobbin2019-05-172-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements a limited form of autolinking primarily designed to allow either the --dependent-library compiler option, or "comment lib" pragmas ( https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=vs-2017) in C/C++ e.g. #pragma comment(lib, "foo"), to cause an ELF linker to automatically add the specified library to the link when processing the input file generated by the compiler. Currently this extension is unique to LLVM and LLD. However, care has been taken to design this feature so that it could be supported by other ELF linkers. The design goals were to provide: - A simple linking model for developers to reason about. - The ability to to override autolinking from the linker command line. - Source code compatibility, where possible, with "comment lib" pragmas in other environments (MSVC in particular). Dependent library support is implemented differently for ELF platforms than on the other platforms. Primarily this difference is that on ELF we pass the dependent library specifiers directly to the linker without manipulating them. This is in contrast to other platforms where they are mapped to a specific linker option by the compiler. This difference is a result of the greater variety of ELF linkers and the fact that ELF linkers tend to handle libraries in a more complicated fashion than on other platforms. This forces us to defer handling the specifiers to the linker. In order to achieve a level of source code compatibility with other platforms we have restricted this feature to work with libraries that meet the following "reasonable" requirements: 1. There are no competing defined symbols in a given set of libraries, or if they exist, the program owner doesn't care which is linked to their program. 2. There may be circular dependencies between libraries. The binary representation is a mergeable string section (SHF_MERGE, SHF_STRINGS), called .deplibs, with custom type SHT_LLVM_DEPENDENT_LIBRARIES (0x6fff4c04). The compiler forms this section by concatenating the arguments of the "comment lib" pragmas and --dependent-library options in the order they are encountered. Partial (-r, -Ur) links are handled by concatenating .deplibs sections with the normal mergeable string section rules. As an example, #pragma comment(lib, "foo") would result in: .section ".deplibs","MS",@llvm_dependent_libraries,1 .asciz "foo" For LTO, equivalent information to the contents of a the .deplibs section can be retrieved by the LLD for bitcode input files. LLD processes the dependent library specifiers in the following way: 1. Dependent libraries which are found from the specifiers in .deplibs sections of relocatable object files are added when the linker decides to include that file (which could itself be in a library) in the link. Dependent libraries behave as if they were appended to the command line after all other options. As a consequence the set of dependent libraries are searched last to resolve symbols. 2. It is an error if a file cannot be found for a given specifier. 3. Any command line options in effect at the end of the command line parsing apply to the dependent libraries, e.g. --whole-archive. 4. The linker tries to add a library or relocatable object file from each of the strings in a .deplibs section by; first, handling the string as if it was specified on the command line; second, by looking for the string in each of the library search paths in turn; third, by looking for a lib<string>.a or lib<string>.so (depending on the current mode of the linker) in each of the library search paths. 5. A new command line option --no-dependent-libraries tells LLD to ignore the dependent libraries. Rationale for the above points: 1. Adding the dependent libraries last makes the process simple to understand from a developers perspective. All linkers are able to implement this scheme. 2. Error-ing for libraries that are not found seems like better behavior than failing the link during symbol resolution. 3. It seems useful for the user to be able to apply command line options which will affect all of the dependent libraries. There is a potential problem of surprise for developers, who might not realize that these options would apply to these "invisible" input files; however, despite the potential for surprise, this is easy for developers to reason about and gives developers the control that they may require. 4. This algorithm takes into account all of the different ways that ELF linkers find input files. The different search methods are tried by the linker in most obvious to least obvious order. 5. I considered adding finer grained control over which dependent libraries were ignored (e.g. MSVC has /nodefaultlib:<library>); however, I concluded that this is not necessary: if finer control is required developers can fall back to using the command line directly. RFC thread: http://lists.llvm.org/pipermail/llvm-dev/2019-March/131004.html. Differential Revision: https://reviews.llvm.org/D60274 llvm-svn: 360984
* [PPC64] toc-indirect to toc-relative relaxationFangrui Song2019-05-072-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is based on D54720 by Sean Fertile. When accessing a global symbol which is not defined in the translation unit, compilers will generate instructions that load the address from the toc entry. If the symbol is defined, non-preemptable, and addressable with a 32-bit signed offset from the toc pointer, the address can be computed directly. e.g. addis 3, 2, .LC0@toc@ha # R_PPC64_TOC16_HA ld 3, .LC0@toc@l(3) # R_PPC64_TOC16_LO_DS, load the address from a .toc entry ld/lwa 3, 0(3) # load the value from the address .section .toc,"aw",@progbits .LC0: .tc var[TC],var can be relaxed to addis 3,2,var@toc@ha # this may be relaxed to a nop, addi 3,3,var@toc@l # then this becomes addi 3,2,var@toc ld/lwa 3, 0(3) # load the value from the address We can delete the test ppc64-got-indirect.s as its purpose is covered by newly added ppc64-toc-relax.s and ppc64-toc-relax-constants.s Reviewed By: ruiu, sfertile Differential Revision: https://reviews.llvm.org/D60958 llvm-svn: 360112
* [LLD][ELF] - Move the test to a correct folder, remove excessive input. NFCI.George Rimar2019-04-251-21/+0
| | | | | | | | | This test should live in `invalid` folder. Also it was possible to avoid adding input with use of `-docnum=x` yaml2obj argument. llvm-svn: 359194
* [LLD] - Update the test cases after yaml2obj change.George Rimar2019-04-032-4/+4
| | | | | | | | | https://reviews.llvm.org/D60122 (r357595) changed the symbols description format. This change updates the LLD tests. llvm-svn: 357596
* [ELF] Emit weak-undef symbols in .dynsym of a PIE binary only if linked ↵Siva Chandra2019-03-181-0/+2
| | | | | | | | | | | | | | against shared libs. Reviewers: espindola Subscribers: emaste, arichardson, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59275 llvm-svn: 356374
* ELF: Allow GOT relocs pointing to non-preemptable ifunc to resolve to an ↵Peter Collingbourne2019-02-133-0/+6
| | | | | | | | | | | | | | | | IRELATIVE where possible. Non-GOT non-PLT relocations to non-preemptible ifuncs result in the creation of a canonical PLT, which now takes the identity of the IFUNC in the symbol table. This (a) ensures address consistency inside and outside the module, and (b) fixes a bug where some of these relocations end up pointing to the resolver. Fixes (at least) PR40474 and PR40501. Differential Revision: https://reviews.llvm.org/D57371 llvm-svn: 353981
* Convert CRLF. NFC.Rui Ueyama2019-02-111-9/+9
| | | | llvm-svn: 353751
* Fix a bug in R_X86_64_PC{8,16} relocation handling.Rui Ueyama2019-02-071-0/+8
| | | | | | | | R_X86_64_PC{8,16} relocations are sign-extended, so when we check for relocation overflow, we had to use checkInt instead of checkUInt. I confirmed that GNU linkers create the same output for the test case. llvm-svn: 353437
* Recommit r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."George Rimar2019-02-064-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the following changes: 1) Compilation fix: std::atomic<bool> HasStaticTlsModel = false; -> std::atomic<bool> HasStaticTlsModel{false}; 2) Adjusted the comment in code. Initial commit message: DF_STATIC_TLS flag indicates that the shared object or executable contains code using a static thread-local storage scheme. Patch checks if IE/LE relocations were used to check if the code uses a static model. If so it sets the DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D57749 ---- Modified : /lld/trunk/ELF/Arch/X86.cpp Modified : /lld/trunk/ELF/Config.h Modified : /lld/trunk/ELF/SyntheticSections.cpp Added : /lld/trunk/test/ELF/Inputs/i386-static-tls-model1.s Added : /lld/trunk/test/ELF/Inputs/i386-static-tls-model2.s Added : /lld/trunk/test/ELF/Inputs/i386-static-tls-model3.s Added : /lld/trunk/test/ELF/Inputs/i386-static-tls-model4.s Added : /lld/trunk/test/ELF/i386-static-tls-model.s Modified : /lld/trunk/test/ELF/i386-tls-ie-shared.s Modified : /lld/trunk/test/ELF/tls-dynamic-i686.s Modified : /lld/trunk/test/ELF/tls-opt-iele-i686-nopic.s llvm-svn: 353299
* Revert r353293 "[LLD][ELF] - Set DF_STATIC_TLS flag for i386 target."George Rimar2019-02-064-36/+0
| | | | | | | | | | | | It broke BB: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/43450 http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/27891 Error is: tools/lld/ELF/Config.h:84:41: error: copying member subobject of type 'std::atomic<bool>' invokes deleted constructor std::atomic<bool> HasStaticTlsModel = false; llvm-svn: 353297
* [LLD][ELF] - Set DF_STATIC_TLS flag for i386 target.George Rimar2019-02-064-0/+36
| | | | | | | | | | | | DF_STATIC_TLS flag indicates that the shared object or executable contains code using a static thread-local storage scheme. Patch checks if IE/LE relocations were used to check if the code uses a static model. If so it sets the DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D57749 llvm-svn: 353293
* [PPC64] Reland r351978 'Sort .toc sections accessed with small code model ...'Sean Fertile2019-01-243-0/+82
| | | | | | | | | | | | | | | | | | | | | | | Guessing that the slashes used in the scripts SECTION command was causing the windows related failures in the added test. Original commit message: Small code model global variable access on PPC64 has a very limited range of addressing. The instructions the relocations are used on add an offset in the range [-0x8000, 0x7FFC] to the toc pointer which points to .got +0x8000, giving an addressable range of [.got, .got + 0xFFFC]. While user code can be recompiled with medium and large code models when the binary grows too large for small code model, there are small code model relocations in the crt files and libgcc.a which are typically shipped with the distros, and the ABI dictates that linkers must allow linking of relocatable object files using different code models. To minimze the chance of relocation overflow, any file that contains a small code model relocation should have its .toc section placed closer to the .got then any .toc from a file without small code model relocations. Differential Revision: https://reviews.llvm.org/D56920 llvm-svn: 352071
* Revert "[PPC64] Sort .toc sections accessed with small code model ..."Sean Fertile2019-01-233-82/+0
| | | | | | | This reverts commit ca87c57a3aa4770c9cf0defd4b2feccbc342ee93. Added test fails on several windows buildbots. llvm-svn: 351985
* [PPC64] Sort .toc sections accessed with small code model relocs close to .got.Sean Fertile2019-01-233-0/+82
| | | | | | | | | | | | | | | | | | | Small code model global variable access on PPC64 has a very limited range of addressing. The instructions the relocations are used on add an offset in the range [-0x8000, 0x7FFC] to the toc pointer which points to .got +0x8000, giving an addressable range of [.got, .got + 0xFFFC]. While user code can be recompiled with medium and large code models when the binary grows too large for small code model, there are small code model relocations in the crt files and libgcc.a which are typically shipped with the distros, and the ABI dictates that linkers must allow linking of relocatable object files using different code models. To minimze the chance of relocation overflow, any file that contains a small code model relocation should have its .toc section placed closer to the .got then any .toc from a file without small code model relocations. Differential Revision: https://reviews.llvm.org/D56920 llvm-svn: 351978
* Remove an external test file. NFC.Rui Ueyama2019-01-101-4/+0
| | | | llvm-svn: 350855
* [LLD][ELF] - Support MSP430.George Rimar2019-01-101-0/+4
| | | | | | | | | | | Patch by Michael Skvortsov! This change adds a basic support for linking static MSP430 ELF code. Implemented relocation types are intended to correspond to the BFD. Differential revision: https://reviews.llvm.org/D56535 llvm-svn: 350819
* Fix linker-defined symbols possibly not being defined when -wrap is usedThomas Anderson2019-01-021-0/+5
| | | | | | | | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=40134 addWrappedSymbols() must be called before addReservedSymbols() because the latter only defines reserved symbols when they are undefined in the symbol table. If addWrappedSymbols() is called after, then addUndefined() is called which may lazily pull in more object files that could reference reserved symbols. Differential Revision: https://reviews.llvm.org/D56110 llvm-svn: 350251
* gdb-index: Handle errors when parsing rangesDavid Blaikie2018-12-221-0/+2
| | | | | | | | | | When parsing CU ranges for gdb-index, handle the error (now propagated up though the API lld is calling here - previously the error was printed within the libDebugInfo API, not allowing lld to format or handle the message at all) - including information about the object and archive name, as well as failing the link. llvm-svn: 349979
* [ELF] - Added test case for invalid relocation target errors. NFCI.George Rimar2018-11-261-0/+21
| | | | | | We had a proper error reporting, but no test cases. llvm-svn: 347536
* [ELF] Add a better test for the multi-CU .gdb_index bug that D54361 fixedFangrui Song2018-11-131-0/+45
| | | | | | | | gdb-index-multiple-cu-2.s puts the symbol in question to another object file %t1.o, so that its CuIndex is affected by the number of CUs in %t.o Also change `Kind:` in a comment to `Attributes:` as a follow-up of D54480 and D54481 llvm-svn: 346796
* Reland "[PPC64] Add split - stack support."Sean Fertile2018-10-161-0/+8
| | | | | | | | | | | | | | Recommitting https://reviews.llvm.org/rL344544 after fixing undefined behavior from left-shifting a negative value. Original commit message: This support is slightly different then the X86_64 implementation in that calls to __morestack don't need to get rewritten to calls to __moresatck_non_split when a split-stack caller calls a non-split-stack callee. Instead the size of the stack frame requested by the caller is adjusted prior to the call to __morestack. The size the stack-frame will be adjusted by is tune-able through a new --split-stack-adjust-size option. llvm-svn: 344622
* Revert "[PPC64] Add split - stack support."Sean Fertile2018-10-151-8/+0
| | | | | | | | This reverts commit https://reviews.llvm.org/rL344544, which causes failures on a undefined behaviour sanitizer bot --> lld/ELF/Arch/PPC64.cpp:849:35: runtime error: left shift of negative value -1 llvm-svn: 344551
* [PPC64] Add split - stack support.Sean Fertile2018-10-151-0/+8
| | | | | | | | | | | | | This support is slightly different then the X86_64 implementation in that calls to __morestack don't need to get rewritten to calls to __moresatck_non_split when a split-stack caller calls a non-split-stack callee. Instead the size of the stack frame requested by the caller is adjusted prior to the call to __morestack. The size the stack-frame will be adjusted by is tune-able through a new --split-stack-adjust-size option. Differential Revision: https://reviews.llvm.org/D52099 llvm-svn: 344544
* [PPC64] Add test documenting toc-restore when linking with -Bsymbolic. [NFC]Sean Fertile2018-10-031-0/+14
| | | | | | Differential Revision: https://reviews.llvm.org/D52523 llvm-svn: 343728
* [ELF][HEXAGON] Add support for dynamic librariesSid Manning2018-09-281-0/+3
| | | | | | | | | Write out the PLT header and stub. Hexagon uses RELA relocations. Differential Revision: https://reviews.llvm.org/D52317 llvm-svn: 343320
* [PPC64] Optimize redundant instructions in global access sequences.Sean Fertile2018-09-201-0/+0
| | | | | | | | | | | | | | | | | | | The access sequence for global variables in the medium and large code models use 2 instructions to add an offset to the toc-pointer. If the offset fits whithin 16-bits then the instruction that sets the high 16 bits is redundant. This patch adds the --toc-optimize option, (on by default) and enables rewriting of 2 instruction global variable accesses into 1 when the offset from the TOC-pointer to the variable (or .got entry) fits in 16 signed bits. eg addis %r3, %r2, 0 --> nop addi %r3, %r3, -0x8000 --> addi %r3, %r2, -0x8000 This rewriting can be disabled with the --no-toc-optimize flag Differential Revision: https://reviews.llvm.org/D49237 llvm-svn: 342602
* [ELF] Revert "Also demote lazy symbols."Chih-Hung Hsieh2018-09-111-0/+11
| | | | | | | | | This reverts commit https://reviews.llvm.org/rL330869 for a regression to link Android dex2oatds. Differential Revision: https://reviews.llvm.org/D51892 llvm-svn: 342007
* [PPC64] Add TLS initial exec to local exec relaxationZaara Syeda2018-08-211-0/+29
| | | | | | | | | 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
* [ELF] Don't copy STT_TLS in copy relocationFangrui Song2018-08-061-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During copy relocation of a variable defined in a DSO, if a TLS variable in that DSO happens to have the same st_value, it would also be copied. This was unnecessary because the addresses of TLS variables are relative to TLS segment. They don't interfere with non-TLS variables. This copying behavior can be harmful in the following scenario: For function-scope thread-local variables with non-trivial constructors, they have guard variables. In the case of x86_64 general-dynamic model: template <int N> void foo() { thread_local std::string a; } GOT[n] R_X86_64_DTPMOD64 guard variable for a GOT[n+1] R_X86_64_DTPOFF64 guard variable for a GOT[n+2] R_X86_64_DTPMOD64 a GOT[n+3] R_X86_64_DTPOFF64 a a and its guard variable are both represented as TLS variables, which should be within the same module. If one is copy relocated to the main module while the other is not, their module ID will mismatch and can cause access without prior construction. Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D50289 llvm-svn: 339042
OpenPOWER on IntegriCloud