summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
* [ELF] - implemented @indntpoff (x86) relocation and its optimization.George Rimar2015-12-177-31/+256
| | | | | | | | | | @indntpoff is similar to @gotntpoff, but for use in position dependent code. While @gotntpoff resolves to GOT slot address relative to the start of the GOT in the movl or addl instructions, @indntpoff resolves to the absolute GOT slot address. ("ELF Handling For Thread-Local Storage", Ulrich Drepper). Differential revision: http://reviews.llvm.org/D15494 llvm-svn: 255884
* [ELF] - implement support of extended length field for CIE/FDE records of ↵George Rimar2015-12-176-7/+71
| | | | | | | | | | | | eh_frame. Ian Lance Taylor writes: "Read 4 bytes. If they are not 0xffffffff, they are the length of the CIE or FDE record. Otherwise the next 64 bits holds the length, and this is a 64-bit DWARF format. This is like .debug_frame." (http://www.airs.com/blog/archives/460), that also consistent with spec (https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html). Patch implements support of described extended length field and also adds few more checks for safety. Differential revision: http://reviews.llvm.org/D15532 llvm-svn: 255883
* ELF: Avoid string concatenation if there's no error.Rui Ueyama2015-12-171-6/+8
| | | | llvm-svn: 255870
* ELF: Rename relocNeedsCopy -> needsCopyRelRui Ueyama2015-12-175-14/+12
| | | | | | Just "copy" was a bit too ambiguous to say about copy relocations. llvm-svn: 255866
* ELF: Separate NeedsCopy and OffsetInBSS.Rui Ueyama2015-12-173-8/+9
| | | | | | | | | | Previously, OffsetInBSS is -1 if it has no information about copy relocation, 0 if it needs a copy relocation, and >0 if its offset in BSS has been assigned. These flags were too subtle. This patch adds a new flag, NeedsCopy, to carry information about whether a shared symbol needs a copy relocation or not. llvm-svn: 255865
* Add comment about DefinedSynthetic class.Rui Ueyama2015-12-171-0/+4
| | | | llvm-svn: 255861
* ELF: Remove accessors that don't hide anything.Rui Ueyama2015-12-172-14/+9
| | | | llvm-svn: 255857
* ELF: Rename IsTLS -> IsTls for consistency with other identifiers containing ↵Rui Ueyama2015-12-172-8/+8
| | | | | | 'TLS'. llvm-svn: 255856
* ELF: Rename isTLS -> isTls for consistency.Rui Ueyama2015-12-176-9/+9
| | | | llvm-svn: 255855
* ELF: Remove a dumb constructor.Rui Ueyama2015-12-172-2/+1
| | | | | | Symbol is a struct and can be initialized using an initializer. llvm-svn: 255854
* Typedef uintX_t at beginning of a function just like others.Rui Ueyama2015-12-161-4/+4
| | | | llvm-svn: 255853
* ELF: Move shouldUseRela to Writer.cpp.Rui Ueyama2015-12-163-8/+6
| | | | | | | The function was used only in Writer.cpp and did not depend on SymbolTable. There is no reason to have that function in SymbolTable.cpp. llvm-svn: 255850
* ELF: Make checkCompatibility a non-member function.Rui Ueyama2015-12-162-16/+15
| | | | | | Because the function does not use any member of SymbolTable class. llvm-svn: 255849
* Simplify. NFC.Rui Ueyama2015-12-161-4/+1
| | | | llvm-svn: 255846
* ELF: Remove duplicate code.Rui Ueyama2015-12-162-36/+31
| | | | | | | We had duplicate code that were called before addMemberFile. This patch makes them to be called at beginning of addMemberFile. llvm-svn: 255845
* ELF: Remove SymbolTable::addELFFile.Rui Ueyama2015-12-162-30/+24
| | | | | | | | addELFFile was called only from addFile, and what it did was actually just adding a file to the symbol table. There seems to be no reason to separate the two. llvm-svn: 255839
* Fix negDelta32 relocatable fixups for arm64 in mach-o.Pete Cooper2015-12-162-1/+125
| | | | | | | | | | | negDelta32 is only ever implicitly generated as the FDE->CIE reference. We therefore don't emit a relocation for it in the object file in -r mode. The value we write in to the FDE location therefore needs to point to the final target address of the CIE, and not the inAtomAddress as it was currently doing. llvm-svn: 255835
* Do not omit * from auto.Rui Ueyama2015-12-161-3/+3
| | | | | | We don't do that in other places in the same file. llvm-svn: 255833
* ELF: Drop 'Sym' suffix from member function names for consistency.Rui Ueyama2015-12-164-23/+23
| | | | | | | Since the functions are members of SymbolTable class, it is obvious that they are adding symbols. llvm-svn: 255832
* ELF: Factor out common code. NFC.Rui Ueyama2015-12-161-12/+17
| | | | llvm-svn: 255830
* ELF: Separate error message generation from call of error() or warning().Rui Ueyama2015-12-162-19/+16
| | | | | | | Previously reportConflict returned only when the third argument is false. Now it always returns a value. llvm-svn: 255829
* Add more debugging output to MachO lld. NFC.Pete Cooper2015-12-163-5/+49
| | | | | | | In debug builds there's now a dump method on Section and improved printing of atoms. llvm-svn: 255826
* Merge two `if`s for MIPS. NFC.Rui Ueyama2015-12-161-10/+10
| | | | llvm-svn: 255823
* Fix DarwinLdDriverTest.cpp to pass real llvm options.Pete Cooper2015-12-161-3/+3
| | | | | | | | | | | After r255819, parse() actually parses what you pass it. This test was failing because it passed '--debug-only' which isn't in release builds, but also 'foo' which isn't an option at all. We now pass -enable-tbaa and -enable-misched which are real options. llvm-svn: 255822
* Move parsing of LLVM options to parse() method.Pete Cooper2015-12-165-2/+18
| | | | | | | | | We used to parse the LLVM options in Driver::link. However, that is after parse() where we load files. By moving the LLVM option handling earlier, we can add DEBUG() to code such as MachONormalizedFileToAtoms.cpp and have it enabled correctly by '-mllvm --debug'. llvm-svn: 255819
* Added some DEBUG() prints to make it clearer what the mach-o passes are ↵Pete Cooper2015-12-162-2/+27
| | | | | | | | | | | | doing. NFC. We had some DEBUG prints these passes, but add more so that its clear where we are dumping things, and what state we are in when we do so. I'll be adding more and more DEBUG printing to try make it easier to observe whats going on without having to attach a debugger. llvm-svn: 255805
* [ELF][MIPS] Handle R_MIPS_HI16/LO16 relocations against _gp_disp symbolSimon Atanasyan2015-12-166-2/+57
| | | | | | | | | | | | The `_gp_disp` is a magic symbol designates offset between start of function and gp pointer into GOT. Only `R_MIPS_HI16` and `R_MIPS_LO16` relocations are permitted with `_gp_disp`. The patch adds the `_gp_disp` as an ignored symbol and adjusts symbol value before call the `relocateOne` for `R_MIPS_HI16/LO16` relocations. Differential Revision: http://reviews.llvm.org/D15480 llvm-svn: 255768
* Fixed mistype in comment. NFC.George Rimar2015-12-151-1/+1
| | | | llvm-svn: 255646
* Reapply fixed r255626 that broke buildbot:George Rimar2015-12-151-15/+13
| | | | | | | | | | | | | [ELF] - refactor of code in RelocationSection<ELFT>::writeTo() Just a little reformat of 'if' conditions, NFC. Differential revision: http://reviews.llvm.org/D15453 Fix was: * Renamed unsigned Rel; to unsigned Reloc; llvm-svn: 255631
* Revert of r255626 "[ELF] - refactor of code in ↵George Rimar2015-12-151-13/+15
| | | | | | | | | | | | | | | RelocationSection<ELFT>::writeTo()" as it broke buildbot: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/17836/steps/build_Lld/logs/stdio /Users/buildslave/as-bldslv9/lld-x86_64-darwin13/llvm.src/tools/lld/ELF/OutputSections.cpp:268:14: error: redefinition of 'Rel' unsigned Rel; ^ /Users/buildslave/as-bldslv9/lld-x86_64-darwin13/llvm.src/tools/lld/ELF/OutputSections.cpp:241:34: note: previous definition is here for (const DynamicReloc<ELFT> &Rel : Relocs) { That compiles fine on my MSVS 2015 thought. llvm-svn: 255628
* [ELF] - refactor of code in RelocationSection<ELFT>::writeTo()George Rimar2015-12-151-15/+13
| | | | | | | | Just a little reformat of 'if' conditions, NFC. Differential revision: http://reviews.llvm.org/D15453 llvm-svn: 255626
* [ELF][MIPS] Remove applying the redundant bit-maskSimon Atanasyan2015-12-151-1/+1
| | | | | | | The `mipsHigh` return type is `uint16_t` so we do not need to extract low 16-bits from return value explicitly. llvm-svn: 255622
* [ELF][MIPS] Ignore R_MIPS_JALR relocation for nowSimon Atanasyan2015-12-132-0/+50
| | | | | | | | | | The `R_MIPS_JALR` is a relocation generated by gcc and gas. This relocation points to the `jalr` instruction which might be optimized and converted to the `b` instruction under some conditions. Now we just ignore this relocation and keep instructions unchanged. llvm-svn: 255453
* [ELF][MIPS] Match paired relocation using relocation type and symbol indexSimon Atanasyan2015-12-133-5/+14
| | | | | | | If we have R_MIPS_HI16 relocation, the paired relocation is the next R_MIPS_LO16 relocation with the same symbol as a target. llvm-svn: 255452
* [ELF][MIPS] Fix calculation of the R_MIPS_HI16 relocationSimon Atanasyan2015-12-132-4/+6
| | | | llvm-svn: 255451
* [lld][MachO] Recognize __thread_bss sections as zero-fill and set all theLang Hames2015-12-118-19/+55
| | | | | | | | | appropriate bits. This fixes the remaining clang regression test failures when linking clang with lld on Darwin. llvm-svn: 255390
* [lld] Watch out for tool names inside paths when substituting tool-paths in lit.Lang Hames2015-12-111-3/+3
| | | | | | | If we don't filter these out we can end up, generating bogus paths, for example: /home/user/lld/build/bin -> /home/user/home/user/lld/build/bin/lld/build/bin. llvm-svn: 255378
* Treat unnamed symbols as locals.Rafael Espindola2015-12-113-1/+17
| | | | | | | There is work under way in llvm to avoid creating unnecessary names for symbols. This makes lld capable of handling that. llvm-svn: 255357
* Discard local symbols from SHF_MERGE sections.Rafael Espindola2015-12-112-3/+38
| | | | | | This matches the behavior of both gold and bfd ld. llvm-svn: 255355
* ELF: Allow -e <entry> with -sharedEd Maste2015-12-112-5/+10
| | | | | | | | | | | | It is reasonable to specify an entry point for shared objects - for example, for the FreeBSD rtld ld-elf.so.1. Unlike GNU ld we leave the entry address as 0 if -shared is specified without -e. Differential Revision: http://reviews.llvm.org/D15454 llvm-svn: 255349
* Test that -e <symbol> worksEd Maste2015-12-111-1/+2
| | | | llvm-svn: 255347
* [ELF] - R_X86_64_SIZE64/R_X86_64_SIZE32 relocations implemented.George Rimar2015-12-116-15/+257
| | | | | | | | | | | | R_X86_64_SIZE64/R_X86_64_SIZE32 relocations were introduced in 0.98v of "System V Application Binary Interface x86-64" (http://www.x86-64.org/documentation/abi.pdf). Calculation for them is Z + A, where: Z - Represents the size of the symbol whose index resides in the relocation entry. A - Represents the addend used to compute the value of the relocatable field. Differential revision: http://reviews.llvm.org/D15335 llvm-svn: 255332
* Fix alignment computation for copy relocs.Rafael Espindola2015-12-103-3/+44
| | | | | | | | Fixes PR25798. Thanks to Ed Maste for the bug report and suggested fix. llvm-svn: 255307
* Simplify. NFC.Rui Ueyama2015-12-101-6/+3
| | | | llvm-svn: 255284
* Make commands printed by llvm-lit include the build path in lit.cfg.Pete Cooper2015-12-101-0/+40
| | | | | | | | | | | | When llvm-lit prints a failure, you'll see something like 'lld *command*' However, you can't then take this, paste it in to a terminal and run it, because it's not got the absolute path of lld. llvm and clang's lit.cfg files contain lists of commands to look for which are substituted by their full paths. So now you'd see something like '*build dir*/bin/lld *command*'. This patch adds the same capability to lld's lit.cfg Reviewed by Rafael Espíndola llvm-svn: 255283
* Simplify an expression. NFC.Rui Ueyama2015-12-101-2/+4
| | | | llvm-svn: 255282
* Verify that macho-o delta64 relocs have the same offset.Pete Cooper2015-12-103-21/+115
| | | | | | | | | | The delta64 relocation is represented as the pair ARM64_RELOC_SUBTRACTOR and ARM64_RELOC_UNSIGNED. Those should always have the same offset, so this adds a check and tests to ensure this is the case. Also updated the error printing in this case to shows both relocs when erroring on pair. llvm-svn: 255274
* Add --version-script= alias for --version-scriptEd Maste2015-12-101-0/+3
| | | | llvm-svn: 255249
* [ELF] - Implemented --print-gc-sections command line argument.George Rimar2015-12-105-1/+41
| | | | | | | | List all sections removed by garbage collection. This option is only effective if garbage collection has been enabled via the `--gc-sections' option. Differential revision: http://reviews.llvm.org/D15327 llvm-svn: 255235
* [ELF] - Resolve R_386_PLT32 statically in some cases.George Rimar2015-12-102-35/+51
| | | | | | | | | If R_386_PLT32 relocation is applied against symbol that can not be preempted then it can be resolved statically. Patch implements it for x86 target. Differential revision: http://reviews.llvm.org/D15376 llvm-svn: 255233
OpenPOWER on IntegriCloud