summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
...
* [WebAssembly] Support creation and import of shared memoriesDerek Schuff2018-11-066-2/+39
| | | | | | | | | Used for WebAssembly threads proposal. Add a flag --shared-memory which sets the IS_SHARED bit in WasmLimits Differential Revision: https://reviews.llvm.org/D54130 llvm-svn: 346248
* [lld][NFC] Update tests to use -S instead of -s when using llvm-readelf.Jordan Rupprecht2018-11-0513-15/+15
| | | | | | | | | | | | | | Summary: llvm-readobj/readelf accepts both -s and -S as aliases for --sections. However with GNU readelf only -S means --section, and -s means --symbols. I would like to make llvm-readelf more compatible. Reviewers: MaskRay, espindola Reviewed By: MaskRay Subscribers: emaste, arichardson, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D54118 llvm-svn: 346164
* Disable precomp test on Linux until I fix it.Alexandre Ganea2018-11-051-0/+2
| | | | llvm-svn: 346163
* Fix build breakerage on GCC 5.4:Alexandre Ganea2018-11-051-1/+1
| | | | | | | | | | /home/buildslave/slave_as-bldslv8/lld-perf-testsuite/llvm/tools/lld/COFF/PDB.cpp:365:51: error: 'auto' not allowed in lambda parameter auto DbgIt = find_if(File->getDebugChunks(), [](auto &C) { ^~~~ http://lab.llvm.org:8011/builders/lld-perf-testsuite/builds/8717/steps/build-bin%2Flld/logs/stdio llvm-svn: 346160
* [COFF][LLD] Add link support for Microsoft precompiled headers OBJsAlexandre Ganea2018-11-057-36/+300
| | | | | | | | | | | This change allows for link-time merging of debugging information from Microsoft precompiled types OBJs compiled with cl.exe /Z7 /Yc and /Yu. This fixes llvm.org/PR34278 Differential Revision: https://reviews.llvm.org/D45213 llvm-svn: 346154
* Handle OUTPUT_FORMAT arguments in quotation marksGalina Kistanova2018-11-032-1/+7
| | | | llvm-svn: 346068
* [DWARF] Fix typo, .gnu_index -> .gdb_indexFangrui Song2018-11-023-3/+3
| | | | llvm-svn: 346040
* Reland "Change the timestamp of llvmcache-foo file to meet the thinLTO ↵Fangrui Song2018-11-022-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | prune policy" Summary: It is difficult to touch a file with a relative mtime across different OSes as POSIX touch -d is rigid. While we may construct relative timestamps with `date`, POSIX date is inadequate to do so as various OSes' date do not agree on a common format (OpenBSD uses `date -r seconds`, FreeBSD uses `date -v-2M` while GNU accepts `-d '-2 min'`) Just use python os.utime() Original description: The case may randomly fail if we test it with command " while llvm-lit tools/lld/test/ELF/lto/cache.ll; do true; done". It is because the llvmcache-foo file is younger than llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6. But due to timestamp precision reason their timestamp is the same. Given the same timestamp, the file prune policy is to remove bigger size file first, so mostly foo file is removed for its bigger size. And the files size is under threshold after deleting foo file. That's what test case expect. However sometimes, the precision is enough to measure that timestamp of llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are smaller than foo, so llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are deleted first. Since the files size is still above the file size threshold after deleting the 2 files, the foo file is also deleted. And then the test case fails, because it expect only one file should be deleted instead of 3. The fix is to change the timestamp of llvmcache-foo file to meet the thinLTO prune policy. The same fix is applied to llvm code at https://reviews.llvm.org/D52452. Patch by Luo Yuanke. Reviewers: ruiu, craig.topper, smaslov, Jianping, espindola, LuoYuanke, tejohnson Reviewed By: tejohnson Subscribers: sbc100, krytarowski, aheejin, llvm-commits, dexonsmith, steven_wu, arichardson, inglorion, emaste, bjope, rupprecht Differential Revision: https://reviews.llvm.org/D54039 llvm-svn: 346006
* Revert "Change the timestamp of llvmcache-foo file to meet the thinLTO ↵Teresa Johnson2018-11-022-8/+0
| | | | | | | | | | | | | | | prune policy" This reverts commit r345977. A few bots failing because the invocation of "touch" is not accepted on a couple other OSes. Specifically the -d argument is not accepted or requires a different format. http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27103/steps/test_lld/logs/stdio http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/24974/steps/test_lld/logs/stdio llvm-svn: 345980
* Change the timestamp of llvmcache-foo file to meet the thinLTO prune policyTeresa Johnson2018-11-022-0/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: The case may randomly fail if we test it with command " while llvm-lit tools/lld/test/ELF/lto/cache.ll; do true; done". It is because the llvmcache-foo file is younger than llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6. But due to timestamp precision reason their timestamp is the same. Given the same timestamp, the file prune policy is to remove bigger size file first, so mostly foo file is removed for its bigger size. And the files size is under threshold after deleting foo file. That's what test case expect. However sometimes, the precision is enough to measure that timestamp of llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are smaller than foo, so llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are deleted first. Since the files size is still above the file size threshold after deleting the 2 files, the foo file is also deleted. And then the test case fails, because it expect only one file should be deleted instead of 3. The fix is to change the timestamp of llvmcache-foo file to meet the thinLTO prune policy. The same fix is applied to llvm code at https://reviews.llvm.org/D52452. Patch by Luo Yuanke. Reviewers: ruiu, craig.topper, smaslov, Jianping, espindola, LuoYuanke Subscribers: rupprecht, bjope, emaste, inglorion, arichardson, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D53123 llvm-svn: 345977
* [ELF] Change sh_link of .rel{,a}.plt to make GNU strip happyFangrui Song2018-11-014-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | Summary: D52830 sets sh_link to .symtab in static link, which breaks executable stripped by GNU strip. It may also be odd that .rela.plt (SHF_ALLOC) points to .symtab (non-SHF_ALLOC). Change the logic on pcc's suggestion. Before: % clang -fuse-ld=lld -static -xc =(printf 'int main(){}') # or gcc % strip a.out; ./a.out unexpected reloc type in static binary[1] 61634 segmentation fault ./a.out Reviewers: ruiu, grimar, emaste, espindola Reviewed By: ruiu Subscribers: pcc, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D53993 llvm-svn: 345899
* Omit "virtual" if overridden.Rui Ueyama2018-11-011-1/+1
| | | | llvm-svn: 345886
* Use llvm_unreachable for unreachable code.Rui Ueyama2018-11-011-2/+2
| | | | llvm-svn: 345885
* Set MAttrs in LTO modeFangrui Song2018-11-015-0/+6
| | | | | | | | | | | | | | | | Summary: Without this patch, MAttrs are not set. Patch by Yin Ma Reviewers: espindola, MaskRay, ruiu, pcc Reviewed By: MaskRay, pcc Subscribers: pcc, emaste, sbc100, inglorion, arichardson, aheejin, steven_wu, llvm-commits Differential Revision: https://reviews.llvm.org/D53446 llvm-svn: 345884
* Fix clang -Wimplicit-fallthrough warnings across llvm, NFCReid Kleckner2018-11-012-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch should not introduce any behavior changes. It consists of mostly one of two changes: 1. Replacing fall through comments with the LLVM_FALLTHROUGH macro 2. Inserting 'break' before falling through into a case block consisting of only 'break'. We were already using this warning with GCC, but its warning behaves slightly differently. In this patch, the following differences are relevant: 1. GCC recognizes comments that say "fall through" as annotations, clang doesn't 2. GCC doesn't warn on "case N: foo(); default: break;", clang does 3. GCC doesn't warn when the case contains a switch, but falls through the outer case. I will enable the warning separately in a follow-up patch so that it can be cleanly reverted if necessary. Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu Differential Revision: https://reviews.llvm.org/D53950 llvm-svn: 345882
* [ELF] - Do not crash when -r output uses linker script with `/DISCARD/`George Rimar2018-11-013-5/+34
| | | | | | | | | | | | This is https://bugs.llvm.org/show_bug.cgi?id=39493. We crashed previously because did not handle /DISCARD/ properly when -r was used. I think it is uncommon to use scripts with -r, though I see nothing wrong to handle the /DISCARD/ so that we will not crash at least. Differential revision: https://reviews.llvm.org/D53864 llvm-svn: 345819
* [WebAssembly] Remove duplicate function. NFC.Sam Clegg2018-11-014-28/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D53963 llvm-svn: 345806
* [ELF] Refactor per-target TLS layout configuration. NFC.Ryan Prichard2018-10-315-34/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There are really three different kinds of TLS layouts: * A fixed TLS-to-TP offset. On architectures like PowerPC, MIPS, and RISC-V, the thread pointer points to a fixed offset from the start of the executable's TLS segment. The offset is 0x7000 for PowerPC and MIPS, which allows a signed 16-bit offset to reach 0x1000 of per-thread implementation data and 0xf000 of the application's TLS segment. The size and layout of the TCB isn't relevant to the static linker and might not be known. * A fixed TCB size. This is the format documented as "variant 1" in Ulrich Drepper's TLS spec. The thread pointer points to a 2-word TCB followed by the executable's TLS segment. The first word is always the DTV pointer. Used on ARM. The thread pointer must be aligned to the TLS segment's alignment, possibly creating alignment padding. * Variant 2. This format predates variant 1 and is also documented in Drepper's TLS spec. It allocates the executable's TLS segment before the thread pointer, apparently for backwards-compatibility. It's used on x86 and SPARC. Factor out an lld::elf::getTlsTpOffset() function for use in a follow-up patch for Android. The TcbSize/TlsTpOffset fields are only used in getTlsTpOffset, so replace them with a switch on Config->EMachine. Reviewers: espindola, ruiu, PkmX, jrtc27 Reviewed By: ruiu, PkmX, jrtc27 Subscribers: jyknight, emaste, sdardis, nemanjai, javed.absar, arichardson, kristof.beyls, kbarton, fedor.sergeev, atanasyan, PkmX, jsji, llvm-commits Differential Revision: https://reviews.llvm.org/D53905 llvm-svn: 345775
* [WedAssembly] Add -s and -S alias for --strip-all and --strip-debugSam Clegg2018-10-313-0/+16
| | | | llvm-svn: 345767
* [ELF] Fallback to sh_link=0 if neither .dynsym nor .symtab existsFangrui Song2018-10-302-12/+18
| | | | | | | | | | | | | | Summary: .rela.plt may only contain R_*_{,I}RELATIVE relocations and not need a symbol table link. bfd/gold fallbacks to sh_link=0 in this case. Without this patch, ld.lld --strip-all caused lld to dereference a null pointer. Reviewers: ruiu, grimar, espindola Reviewed By: ruiu Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D53881 llvm-svn: 345648
* [PPC64] Handle powerpc64 in OUTPUT_FORMAT.Sean Fertile2018-10-302-0/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D53652 llvm-svn: 345604
* [FIX][AArch64] lld test changeDiogo N. Sampaio2018-10-301-9/+9
| | | | | | | | Adding AArch64 UDF, in rL345581, breaks some lld test files, due different decoding llvm-svn: 345592
* [ELF][PPC64]Workaround bogus Visual Studio build warningJames Henderson2018-10-301-1/+2
| | | | | | | | | | | | | | | | | Visual Studio has a bug where it converts the integer literal 2147483648 into an unsigned int instead of a long long (i.e. it follows C89 rules). The bug has been reported as: https://developercommunity.visualstudio.com/content/problem/141813/-2147483648-c4146-error.html. Because of this bug, we were getting a signed/unsigned comparison warning in VS2015 from the old code (the subsequent unary negation had no effect on the type). Reviewed by: sfertile Differential Revision: https://reviews.llvm.org/D53821 llvm-svn: 345579
* AMDGPU: Switch some lld tests to v2Konstantin Zhuravlyov2018-10-293-5/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D53526 llvm-svn: 345530
* Rename warnUnorderableSymbol maybeWarnUnorderableSymbol because the function ↵Rui Ueyama2018-10-264-4/+4
| | | | | | doesn't always emit a warning. llvm-svn: 345393
* Refactor readCallGraph() and readCallGraphFromObjectFiles(). NFC.Rui Ueyama2018-10-261-21/+28
| | | | llvm-svn: 345392
* [ELF] Add --{,no-}call-graph-profile-sort (enabled by default)Fangrui Song2018-10-254-15/+27
| | | | | | | | | | | | | | Summary: Add an option to disable sorting sections with call graph profile Reviewers: ruiu, Bigcheese, espindola Reviewed By: Bigcheese Subscribers: grimar, emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D53683 llvm-svn: 345332
* [ELF] Don't check if symbols in .llvm.call-graph-profile are unorderableFangrui Song2018-10-252-50/+0
| | | | | | | | | | | | | | Summary: There are too many reasonable cases that would be considered unorderable. Reviewers: ruiu, espindola, Bigcheese Reviewed By: ruiu Subscribers: grimar, emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D53669 llvm-svn: 345322
* Remove full stops from error messages for consistency.Rui Ueyama2018-10-255-8/+8
| | | | llvm-svn: 345294
* Do not call computeIsPreemptible() if its result is discarded. NFC.Rui Ueyama2018-10-241-1/+3
| | | | llvm-svn: 345208
* Add more blank lines so that code doesn't look too dense. NFC.Rui Ueyama2018-10-241-13/+31
| | | | llvm-svn: 345205
* Add a comment for PPC64 .toc and GNU relro.Rui Ueyama2018-10-241-0/+5
| | | | llvm-svn: 345204
* Include input section name and output section name in an error message.Rui Ueyama2018-10-242-2/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D53645 llvm-svn: 345172
* Refactor assignFileOffsets. NFC.Rui Ueyama2018-10-241-30/+29
| | | | llvm-svn: 345154
* Split a function. NFC.Rui Ueyama2018-10-241-11/+17
| | | | llvm-svn: 345143
* Add parenthese around a bitand.Rui Ueyama2018-10-241-1/+1
| | | | llvm-svn: 345139
* Make a local variable scope narrower. NFC.Rui Ueyama2018-10-241-3/+3
| | | | llvm-svn: 345138
* [MinGW] Support for multiarch runtimes layoutMartin Storsjo2018-10-241-0/+1
| | | | | | Patch by Peiyuan Song! llvm-svn: 345117
* [ELF] Remove a superfluous semicolon, fixing warnings. NFC.Martin Storsjo2018-10-241-1/+1
| | | | llvm-svn: 345116
* Move forward declarations to the top of the file and sort.Rui Ueyama2018-10-231-4/+4
| | | | llvm-svn: 345094
* Move a function out of a class because it doesn't depend on any class ↵Rui Ueyama2018-10-232-18/+14
| | | | | | member. NFC. llvm-svn: 345093
* Factor out code to a new function. NFC.Rui Ueyama2018-10-231-27/+52
| | | | llvm-svn: 345088
* Simplify. NFC.Rui Ueyama2018-10-231-34/+29
| | | | | | A higher order function `applySyntehtic` can be replaced with a simpler function. llvm-svn: 345081
* Remove a global variable that is set but not used.Rui Ueyama2018-10-233-11/+3
| | | | llvm-svn: 345080
* Add a comment.Rui Ueyama2018-10-231-0/+4
| | | | llvm-svn: 345062
* Remove a global variable that we can live without.Rui Ueyama2018-10-235-4/+9
| | | | | | | | | | Out::DebugInfo was used only by GdbIndex class to determine if we need to create a .gdb_index section, but we can do the same check without it. Added a test that this patch doesn't change the existing behavior. llvm-svn: 345058
* Don't mess up RelIplt symbols during relocatable processingDimitry Andric2018-10-232-1/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: During upgrading of the FreeBSD source tree with lld 7.0.0, I noticed that it started complaining about `crt1.o` having an "index past the end of the symbol table". Such a symbol table looks approximately like this, viewed with `readelf -s` (note the `Ndx` field being messed up): ``` Symbol table '.symtab' contains 4 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 SECTION LOCAL DEFAULT 1 2: 00000000 0 NOTYPE WEAK HIDDEN RSV[0xffff] __rel_iplt_end 3: 00000000 0 NOTYPE WEAK HIDDEN RSV[0xffff] __rel_iplt_start ``` At first, it seemed that recent ifunc relocation work had caused this: <https://reviews.freebsd.org/rS339351>, but it turned out that it was due to incorrect processing of the object files by lld, when using `-r` (a.k.a. --relocatable). Bisecting showed that rL324421 ("Convert a use of Config->Static") was the commit where this new behavior began. Simply reverting it solved the issue, and the `__rel_iplt` symbols had an index of `UND` again. Looking at Rafael's commit message, I think he simply missed the possibility of `--relocatable` being in effect, so I have added an additional check for it. I also added a simple regression test case. Reviewers: grimar, ruiu, emaste, espindola Reviewed By: ruiu Subscribers: arichardson, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D53515 llvm-svn: 345002
* [ELF] Split up emulation.s per backendShoaib Meenai2018-10-236-436/+448
| | | | | | | | | | | | emulation.s is testing multiple architectures, which means it needs all the corresponding backends enabled, which might not be true for all developers (for example, I don't have PPC or MIPS enabled). Rather than marking the entire test as unsupported for such developers, split it up per backend to get better testing granularity. Differential Revision: https://reviews.llvm.org/D53544 llvm-svn: 344986
* [ELF] Actually fix test from r344976Shoaib Meenai2018-10-231-6/+1
| | | | | | | I don't think the offsets and flags are particularly relevant to the test; the machine type is what matters. llvm-svn: 344984
* [ELF] Fix test from r344976Shoaib Meenai2018-10-231-1/+1
| | | | | | | | | Turns out I wasn't actually running this test locally, since I don't build the PPC and MIPS backends. Whoops. Perhaps this test should be split up per-architecture? llvm-svn: 344980
OpenPOWER on IntegriCloud