summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/Inputs
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement R_X86_64_16.Rafael Espindola2017-02-132-0/+6
| | | | | | It is used by qemu. llvm-svn: 294965
* [ELF] - Simplify i386-ps8.s testcase.George Rimar2017-02-061-2/+0
| | | | | | Removes dependency on second input file. llvm-svn: 294178
* Fix -r when the input has a relocation with no symbol.Rafael Espindola2017-01-261-0/+0
| | | | | | Should fix a few freebsd packages with dtrace. llvm-svn: 293177
* [ELF] - Implemented support for R_386_PC8/R_386_8 relocations.George Rimar2017-01-251-0/+2
| | | | | | | | These relocations are used in linux kernel. Differential revision: https://reviews.llvm.org/D28094 llvm-svn: 293054
* ELF: Fix ICF crash on absolute symbol relocations.Peter Collingbourne2017-01-201-0/+3
| | | | | | | | | | | If two sections contained relocations to absolute symbols with the same value we would crash when trying to access their sections. Add a check that both symbols point to sections before accessing their sections, and treat absolute symbols as equal if their values are equal. Differential Revision: https://reviews.llvm.org/D28935 llvm-svn: 292578
* Also define 'end' if it is present in a .so.Rafael Espindola2017-01-191-0/+1
| | | | | | I don't know of anything using it, but we should handle it like _end. llvm-svn: 292513
* Create _end symbol even if a .so defines it.Rafael Espindola2017-01-191-0/+2
| | | | | | | | | The freebsd sbrk implementation uses _end to find the initial value of brk, so it has to be defined in the main binary. This should fix the emacs build. llvm-svn: 292512
* ELF: Add support for relocation type R_X86_64_8.Peter Collingbourne2017-01-182-0/+6
| | | | | | | | | Although this relocation type is not part of the x86-64 psABI, I intend to use it internally as part of the ThinLTO implementation. Differential Revision: https://reviews.llvm.org/D28841 llvm-svn: 292330
* Implement -Map.Rafael Espindola2017-01-133-0/+13
| | | | | | | The format is not exactly the same as the one in bfd since bfd always follows a linker script and prints it along. llvm-svn: 291958
* [ELF] - Explicitly list supported relocations for x86 target.George Rimar2017-01-111-0/+2
| | | | | | | | | | | | | | | | Previously some value was returned by default for relocations by getRelExpr(), even if relocation actually was not supported. This is orthogonal alternative to D28094. Instead of implementing probably useless R_386_PC8/R_386_8 relocations, this patch uses them in a testcase to demonstrate what happens when LLD mets unsupported relocations. Patch passes all testcases and changes logic only for x86. Differential revision: https://reviews.llvm.org/D28516 llvm-svn: 291658
* ELF: Reserve space for copy relocations of read-only symbols in relro.Peter Collingbourne2017-01-102-0/+15
| | | | | | | | | | | | | | When reserving copy relocation space for a shared symbol, scan the DSO's program headers to see if the symbol is in a read-only segment. If so, reserve space for that symbol in a new synthetic section named .bss.rel.ro which will be covered by the relro program header. This fixes the security issue disclosed on the binutils mailing list at: https://sourceware.org/ml/libc-alpha/2016-12/msg00914.html Differential Revision: https://reviews.llvm.org/D28272 llvm-svn: 291524
* [ELF][MIPS] Allow .MIPS.abiflags larger than one Elf_Mips_ABIFlags structSimon Atanasyan2016-12-211-0/+0
| | | | | | | | | | | Older versions of BFD generate libraries with .MIPS.abiflags that only concatenate the individual .MIPS.abiflags sections instead of merging. Patch by Alexander Richardson. Differential revision: https://reviews.llvm.org/D27770 llvm-svn: 290237
* [ELF] Accept first SHT_ARM_ATTRIBUTES sectionPeter Smith2016-12-141-0/+29
| | | | | | | | | | | | | | | | | | The eglibc library, as used by Ubuntu 14.04 requires the presence of an SHT_ARM_ATTRIBUTES section in for the purposes of checking hard/soft float compatibility when dlopen() is used. Unfortunately when the section is not present dlopen() fails with a generic could not find file message. This change makes lld keep the first .ARM.attributes section that it encounters and propagates it to the output. This is not a complete SHT_ARM_ATTRIBUTES implementation, that would involve reading the contents of the section and joining each individual attribute. It should suffice for a homogenous build all libraries and executables on the same system with a compatible set of command line options. Differential revision: https://reviews.llvm.org/D27718 llvm-svn: 289642
* [ELF] ifunc implementation using synthetic sectionsPeter Smith2016-12-082-0/+17
| | | | | | | | | | | | | | | | | This change introduces new synthetic sections IpltSection, IgotPltSection that represent the ifunc entries that would previously have been put in the PltSection and the GotPltSection. The separation makes sure that the R_*_IRELATIVE relocations are placed after the non R_*_IRELATIVE relocations, which permits ifunc resolvers to know that the .got.plt slots will be initialized prior to the resolver being called. A secondary benefit is that for ARM we can move the IgotPltSection and its dynamic relocations to the .got and .rel.dyn as the ARM glibc expects all the R_*_IRELATIVE relocations to be in the .rel.dyn Differential revision: https://reviews.llvm.org/D27406 llvm-svn: 289045
* [ELF] - Print absolute file name in errors when possible.George Rimar2016-12-071-1/+1
| | | | | | | | | | | | | | | | | | | Currently LLD prints basename of source file name in error messages, for example: $ mkdir foo $ echo 'void _start(void) { foobar(); }' > foo/bar.c $ gcc -g -c foo/bar.c $ bin/ld.lld -o out bar.o bin/ld.lld: error: bar.c:1: undefined symbol 'foobar' $ This should say: bin/ld.lld: error: foo/bar.c:1: undefined symbol 'foobar' This is PR31299 Differential revision: https://reviews.llvm.org/D27506 llvm-svn: 288966
* Don't crash trying to write an 0 addend.Rafael Espindola2016-12-061-0/+5
| | | | | | | | | For preemptable symbols the dynamic linker does all the work. Trying to compute the addend is at best wasteful and can also lead to crashes in cases of programs that uses tls but doesn't define any tls variables. llvm-svn: 288803
* Ignone SHF_INFO_LINK.Rafael Espindola2016-12-031-0/+21
| | | | | | | | | Some elf producers (dtrace) put this flag in relocation sections and some (MC) don't. If we don't ignore the flag we end up with multiple relocation sections poiting to the same section, which we don't support. llvm-svn: 288585
* Removed a wrong assertion about non-colorable sections.Rui Ueyama2016-12-021-0/+8
| | | | | | | | | | The assertion asserted that colorable sections can never have a reference to non-colorable sections, but that was simply wrong. They can have references to non-colorable sections. If that's the case, referenced sections must be the same in terms of pointer comparison. llvm-svn: 288511
* Better formatting.Rui Ueyama2016-11-231-2/+2
| | | | | | If a line is too long, its error message becomes hard to read. llvm-svn: 287739
* [ELF] Attempt to fix Windows buidbotEugene Leviant2016-11-211-0/+2
| | | | llvm-svn: 287538
* [ELF] - Do not create reserved symbols in case of relocatable output.George Rimar2016-11-151-0/+1
| | | | | | | | | | | This patch stops creating symbols like __ehdr_start, _end/_etext_edata,__tls_get_addr when using -r. This fixes PR30984. Differential revision: https://reviews.llvm.org/D26600 llvm-svn: 286941
* [ELF] - Better diagnostic for relative relocation to an absolute value error.George Rimar2016-11-151-0/+2
| | | | | | | | | | | | | | Patch adds a filename to that error message. I faced next error when debugged one of FreeBSD port: error: relocation R_X86_64_PLT32 cannot refer to absolute symbol __tls_get_addr error message was poor and this patch improves it to show the locations of symbol declaration and using. Differential revision: https://reviews.llvm.org/D26508 llvm-svn: 286940
* [ELF] Better error reporting for duplicate symbolEugene Leviant2016-11-081-0/+5
| | | | | | Differential revision: https://reviews.llvm.org/D26397 llvm-svn: 286244
* [ELF][MIPS] N32 ABI supportSimon Atanasyan2016-11-051-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | In short the patch introduces support for linking object file conform MIPS N32 ABI [1]. This ABI is similar to N64 ABI but uses 32-bit pointer size. The most non-trivial requirement of this ABI is one more relocation packing format. N64 ABI puts multiple relocation type into the single relocation record. The N32 ABI uses series of successive relocations with the same offset for this purpose. In this patch, new function `mergeMipsN32RelTypes` handle this case and "convert" N32 relocation to the N64 relocation so the rest of the code keep unchanged. For now, linker does not support series of relocations applied to sections without SHF_ALLOC bit. Probably later I will add the support or insert some sort of assert into the `relocateNonAlloc` routine to catch this case. [1] ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf Differential revision: https://reviews.llvm.org/D26298 llvm-svn: 286052
* Allow fetching source line, when multiple "AX" sections presentEugene Leviant2016-11-011-0/+8
| | | | | | Differential revision: https://reviews.llvm.org/D26070 llvm-svn: 285680
* [ELF] Better error reporting for undefined symbolsEugene Leviant2016-10-261-0/+3
| | | | | | | | | | | This patch make lld show following details for undefined symbol errors: - file (line) - file (function name) - file (section name + offset) Differential revision: https://reviews.llvm.org/D25826 llvm-svn: 285186
* [ELF] - Partial support of --gdb-index command line option (Part 1).George Rimar2016-10-202-0/+0
| | | | | | | | | | | | | | | In this patch partial gdb_index section is created. For costructing the .gdb_index section 6 steps should be performed (details are in SplitDebugInfo.cpp file header), this patch do first 3: Creates proper section header. Fills list of compilation units. Types CU list area is not supposed to be supported, so it is ignored and therefore can be treated as implemented either. Differential revision: https://reviews.llvm.org/D24706 llvm-svn: 284708
* ELF: Override DSO definitions when creating __start_* and __stop_* symbols.Peter Collingbourne2016-10-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously we would fail to synthesise a __start_ or __stop_ symbol if there existed a definition in a DSO. Instead, we would try to link against the DSO definition. This became possible after D23552 when linking against lld-produced DSOs but could in principle also occur when linking against DSOs produced by other linkers. Not only does it seem more likely that a user would expect the resolved definition to be local to the executable, but if a __start_ or __stop_ symbol was synthesised by the linker, it is effectively impossible to link against correctly from a non-PIC executable in a read-only section. Neither a PLT nor a copy relocation would give us the right semantics here. The only way the link could succeed is if the executable provided its own synthetic definition of the symbol. The fix is to also synthesise the definition if the only definition comes from a DSO. Since this is what the addOptionalSynthetic function does, switch to using that function. Fixes PR30680. Differential Revision: https://reviews.llvm.org/D25544 llvm-svn: 284168
* [ELF][ARM] Initial implentation of ARM exceptions supportPeter Smith2016-10-101-0/+40
| | | | | | | | | | | | | | | | | | | The .ARM.exidx sections contain a table. Each entry has two fields: - PREL31 offset to the function the table entry describes - Action to take, either cantunwind, inline unwind, or PREL31 offset to .ARM.extab section The table entries must be sorted in order of the virtual addresses the first entry of the table describes. Traditionally this is implemented by the SHF_LINK_ORDER dependency. Instead of implementing this directly we sort the table entries post relocation. The .ARM.exidx OutputSection is described by the PT_ARM_EXIDX program header Differential revision: https://reviews.llvm.org/D25127 llvm-svn: 283730
* [ELF] Don't fail if undefined symbol is not usedEugene Leviant2016-10-061-0/+2
| | | | | | Differential revision: https://reviews.llvm.org/D25240 llvm-svn: 283431
* [ELF][MIPS] Set GP0 value to zero in case of relocatable object generationSimon Atanasyan2016-09-291-0/+0
| | | | | | | | | | LLD does not update relocations addends when generate a relocatable object. That is why we should not write a non-zero GP0 value into the .reginfo and .MIPS.options sections. And we should not accept input object files with non-zero GP0 value because we cannot handle them properly. llvm-svn: 282716
* [ELF][MIPS] Do not use a binary input file in the test case. NFCSimon Atanasyan2016-09-293-0/+12
| | | | llvm-svn: 282715
* Don't GC non-alloc mergeable section piecesEugene Leviant2016-09-291-0/+1
| | | | | | Differential revision: https://reviews.llvm.org/D25033 llvm-svn: 282708
* [ELF] - Created new "Invalid" subfolder for testcases.George Rimar2016-09-289-0/+0
| | | | | | | | | | | This subfolder just like "linkerscript" subfolder keeps testcases with invalid input. According to PR30540 it seems we might have many new ones soon, so it is seems reasonable to separate them from regular testcases. Differential revision: https://reviews.llvm.org/D25010 llvm-svn: 282595
* [ARM] ARM TLS shouldn't use relaxationsPeter Smith2016-09-231-0/+13
| | | | | | | | | | | | | | | | | The ARM TLS relocations are placed on literal data and not the code-sequence, it is therefore not possible to implement the relaxTls* functions. This change updates handleMipsTlsRelocation() to handleNoRelaxTlsRelocation() and incorporates ARM as well as Mips. The ARM support in handleNoRelaxTlsRelocation() currently needs to ouput the module index dynamic relocation in all cases as it is relying on the dynamic linker to set the module index in the got. Should address PR30218 Differential Revision: https://reviews.llvm.org/D24827 llvm-svn: 282250
* [ELF/AArch64] Implement some UABS relocsEugene Leviant2016-09-121-0/+4
| | | | | | Differential revision: https://reviews.llvm.org/D24403 llvm-svn: 281202
* [ELF][MIPS] Replace binary test input file by asembler code in the test. NFCSimon Atanasyan2016-07-261-0/+0
| | | | llvm-svn: 276809
* Remove trailing whitespaces.Rui Ueyama2016-07-251-1/+1
| | | | llvm-svn: 276649
* Add a test for accessing __tls_get_addr with a GOT.Rafael Espindola2016-07-041-0/+6
| | | | | | This was already passing, but missing a test. llvm-svn: 274513
* [ELF] - Added support for --unresolved-symbols option.George Rimar2016-06-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Option has next description (http://linux.die.net/man/1/ld): "--unresolved-symbols=method Determine how to handle unresolved symbols. There are four possible values for method according to documentation: ignore-all: Do not report any unresolved symbols. report-all: Report all unresolved symbols. This is the default. ignore-in-object-files: Report unresolved symbols that are contained in shared libraries, but ignore them if they come from regular object files. ignore-in-shared-libs: Report unresolved symbols that come from regular object files, but ignore them if they come from shared libraries." Since report-all is default and we traditionally do not report about undefined symbols in lld, report-all does not report about undefines from DSO. ignore-in-object-files also does not do that. Handling of that option differs from what gnu linkers do. Option works in next way in lld: ignore-all: Do not report any unresolved symbols. report-all: Report all unresolved symbols except symbols from DSOs. This is the default. ignore-in-object-files: The same as ignore-all. gnore-in-shared-libs: The same as report-all. This is PR24524. Differential revision: http://reviews.llvm.org/D21794 llvm-svn: 274123
* Handle empty versions.Rafael Espindola2016-06-281-0/+2
| | | | | | They are significant now that we support @ in symbol names. llvm-svn: 274071
* [ELF] - Implemented support of default/non-default symbols versionsGeorge Rimar2016-06-281-0/+22
| | | | | | | | | | | | | | | | | | | | t is possible to create new version of symbol instead of depricated one using combination of version script and asm commands. For example: __asm__(".symver b_1,b@LIBSAMPLE_1.0"); int b_1() { return 10; } __asm__(".symver b_2,b@@LIBSAMPLE_2.0"); int b_2() { return 20; } This code makes b_2() to be default implementation for b(). b_1() is used for compatibility with binaries compiled against library of older version LIBSAMPLE_1.0. This patch implements support for above functionality in lld. Differential revision: http://reviews.llvm.org/D21681 llvm-svn: 274002
* [ELF][MIPS] Support MIPS TLS relocationsSimon Atanasyan2016-06-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | The patch adds one more partition to the MIPS GOT. This time it is for TLS related GOT entries. Such entries are located after 'local' and 'global' ones. We cannot get a final offset for these entries at the time of creation because we do not know size of 'local' and 'global' partitions. So we have to adjust the offset later using `getMipsTlsOffset()` method. All MIPS TLS relocations which need GOT entries operates MIPS style GOT offset - 'offset from the GOT's beginning' - MipsGPOffset constant. That is why I add new types of relocation expressions. One more difference from othe ABIs is that the MIPS ABI does not support any TLS relocation relaxations. I decided to make a separate function `handleMipsTlsRelocation` and put MIPS TLS relocation handling code there. It is similar to `handleTlsRelocation` routine and duplicates its code. But it allows to make the code cleaner and prevent pollution of the `handleTlsRelocation` by MIPS 'if' statements. Differential Revision: http://reviews.llvm.org/D21606 llvm-svn: 273569
* Implement --trace-symbol=symbol option.Rui Ueyama2016-06-232-0/+26
| | | | | | | | | | | | | | | Patch by Shridhar Joshi. This option provides names of all the link time modules which define and reference symbols requested by user. This helps to speed up application development by detecting references causing undefined symbols. It also helps in detecting symbols being resolved to wrong (unintended) definitions in case of applications containing multiple definitions for same symbols with different types, bindings. Implements PR28226. llvm-svn: 273536
* Don't go on an infinite loop on a missing ";".Rafael Espindola2016-06-201-0/+4
| | | | | | Thanks to Will Dietz for reporting the issue. llvm-svn: 273157
* [ELF] - Recommit r273143("[ELF] - Basic versioned symbols support implemented.")George Rimar2016-06-201-0/+6
| | | | | | | | | | | | | | | | | | With fix: -soname flag was not set in testcase. Hash calculated for base def was different on local and bot machines because filename fos used for calculating. Initial commit message: Patch implements basic support of versioned symbols. There is no wildcards patterns matching except local: *; There is no support for hierarchies. There is no support for symbols overrides (@ vs @@ not handled). This patch allows programs that using simple scripts to link and run. Differential revision: http://reviews.llvm.org/D21018 llvm-svn: 273152
* Revert r273143 "[ELF] - Basic versioned symbols support implemented."George Rimar2016-06-201-6/+0
| | | | | | | It broke buildbot: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast llvm-svn: 273146
* [ELF] - Basic versioned symbols support implemented.George Rimar2016-06-201-0/+6
| | | | | | | | | | | | | Patch implements basic support of versioned symbols. There is no wildcards patterns matching except local: *; There is no support for hierarchies. There is no support for symbols overrides (@ vs @@ not handled). This patch allows programs that using simple scripts to link and run. Differential revision: http://reviews.llvm.org/D21018 llvm-svn: 273143
* Don't confuse input and output section offsets.Rafael Espindola2016-06-171-0/+7
| | | | llvm-svn: 273006
* Add initial support for Thumb for ARMv7aPeter Smith2016-06-164-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the R_ARM_THM relocations used in the objects present in arm-linux-gnueabihf-gcc. These are: R_ARM_THM_CALL R_ARM_THM_JUMP11 R_ARM_THM_JUMP19 R_ARM_THM_JUMP24 R_ARM_THM_MOVT_ABS R_ARM_THM_MOVW_ABS_NC Interworking between ARM and Thumb is partially supported with BLX. The R_ARM_CALL relocation for ARM instructions and R_ARM_THM_CALL relocation for Thumb instructions will write out a BL or BLX depending on the state of the Target. Assumptions: - Availability of BLX and extended range of Thumb 4-byte Branch instructions. - In relocateOne if (Val & 0x1) == 1 target is Thumb, 0 is ARM. This will hold for objects that comply with the ABI for the ARM architecture. This is sufficient for hello world to work with a recent arm-linux-gnueabihf distribution. Limitations: No interworking for R_ARM_JUMP24, R_ARM_THM_JUMP24, R_ARM_THM_JUMP19 and the deprecated R_ARM_PLT32 and R_ARM_PC24 instructions as these cannot be written out as a BLX and need a state change thunk. No range extension thunks. The R_ARM_JUMP24 and R_ARM_THM_CALL have a range of 16Mb llvm-svn: 272881
OpenPOWER on IntegriCloud