summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
* Temporarily disable this test on ↵Sean Silva2016-05-031-0/+5
| | | | | | | | | | | | | | llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast `REQUIRES: shell` is not appropriate because that would mean that there are no windows bots testing this, and that is precisely where it needs the most testing. Rafael or Rui are working on generating an archive directly, which should avoid this issue. We can try to move the bot to a shorter build directory path. llvm-svn: 268345
* Pass all buffers to BuildId hash function at once. NFC.Rui Ueyama2016-05-023-42/+28
| | | | | | | | | This change simplifies the BuildId classes by removing a few member functions and variables from them. It should also make it easy to parallelize hash computation in future because now each BuildId object see all inputs rather than one at a time. llvm-svn: 268333
* Simplify. NFC.Rafael Espindola2016-05-021-2/+1
| | | | llvm-svn: 268324
* Teach Undefined symbols from which file they are created from.Rui Ueyama2016-05-024-19/+31
| | | | | | | | | This patch increases the size of Undefined by the size of a pointer, but it wouldn't actually increase the size of memory that LLD uses because we are not allocating the exact size but the size of the largest SymbolBody. llvm-svn: 268310
* Revert "Temporary hack to see what is going on on a windows bot."Rafael Espindola2016-05-021-1/+0
| | | | | | This reverts commit r268302. llvm-svn: 268308
* Temporary hack to see what is going on on a windows bot.Rafael Espindola2016-05-021-0/+1
| | | | llvm-svn: 268302
* Remove unnecessary namespace specifiers.Rui Ueyama2016-05-022-4/+4
| | | | llvm-svn: 268292
* Do not pass Symtab to markLive/doICF since Symtab is globally accessible.Rui Ueyama2016-05-025-31/+27
| | | | llvm-svn: 268286
* Remove unnecessary namespace specifiers.Rui Ueyama2016-05-021-8/+8
| | | | llvm-svn: 268278
* Attempt to fix Windows bots.Rui Ueyama2016-05-022-3/+3
| | | | llvm-svn: 268275
* Fix --reproduce for --export-dynamic-symbol.Rui Ueyama2016-05-022-3/+6
| | | | | | --export-dynamic-symbol doesn't take path. llvm-svn: 268273
* Quote arguments for --reproduce.Rui Ueyama2016-05-022-2/+7
| | | | llvm-svn: 268258
* Force llvm-ar to use the gnu format.Rafael Espindola2016-05-021-1/+1
| | | | | | Should fix the bots. Otherwise we try to create a thin bsd anchive. llvm-svn: 268240
* Don't include the output dir in the response file.Rafael Espindola2016-05-022-2/+3
| | | | | | | | With this it is possible to use chroot/fakechroot to have a completely reproducible link even when thin archives or linker scripts have absolute paths. llvm-svn: 268231
* Copy thin archive members with --reproduce.Rafael Espindola2016-05-022-0/+17
| | | | llvm-svn: 268229
* [ELF] - keep alive all non-text sections referenced by .eh_frameGeorge Rimar2016-05-022-15/+56
| | | | | | | | | | | | | | | Patch implements one of suggestions from Rafael Ávila de Espíndola, to fix segfault after section that contains personality being garbage collected. Suggestion was just to keep alive all non executable sections referenced by .eh_frame. This fixes PR27529. Differential revision: http://reviews.llvm.org/D19656 llvm-svn: 268228
* Don't quote "--hash-style gnu".Rafael Espindola2016-05-022-3/+4
| | | | | | Otherwise lld fails to use the response file. llvm-svn: 268225
* Replace non-ascii character.Simon Atanasyan2016-05-021-1/+1
| | | | llvm-svn: 268218
* Should fix all remaining MSVC problems.Peter Collingbourne2016-05-011-5/+5
| | | | llvm-svn: 268187
* Further MSVC appeasement.Peter Collingbourne2016-05-012-6/+6
| | | | llvm-svn: 268185
* Try to fix MSVC build.Peter Collingbourne2016-05-011-1/+2
| | | | llvm-svn: 268182
* ELF: New symbol table design.Peter Collingbourne2016-05-0114-504/+632
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements a new design for the symbol table that stores SymbolBodies within a memory region of the Symbol object. Symbols are mutated by constructing SymbolBodies in place over existing SymbolBodies, rather than by mutating pointers. As mentioned in the initial proposal [1], this memory layout helps reduce the cache miss rate by improving memory locality. Performance numbers: old(s) new(s) Without debug info: chrome 7.178 6.432 (-11.5%) LLVMgold.so 0.505 0.502 (-0.5%) clang 0.954 0.827 (-15.4%) llvm-as 0.052 0.045 (-15.5%) With debug info: scylla 5.695 5.613 (-1.5%) clang 14.396 14.143 (-1.8%) Performance counter results show that the fewer required indirections is indeed the cause of the improved performance. For example, when linking chrome, stalled cycles decreases from 14,556,444,002 to 12,959,238,310, and instructions per cycle increases from 0.78 to 0.83. We are also executing many fewer instructions (15,516,401,933 down to 15,002,434,310), probably because we spend less time allocating SymbolBodies. The new mechanism by which symbols are added to the symbol table is by calling add* functions on the SymbolTable. In this patch, I handle local symbols by storing them inside "unparented" SymbolBodies. This is suboptimal, but if we do want to try to avoid allocating these SymbolBodies, we can probably do that separately. I also removed a few members from the SymbolBody class that were only being used to pass information from the input file to the symbol table. This patch implements the new design for the ELF linker only. I intend to prepare a similar patch for the COFF linker. [1] http://lists.llvm.org/pipermail/llvm-dev/2016-April/098832.html Differential Revision: http://reviews.llvm.org/D19752 llvm-svn: 268178
* ELF: --reproduce: quote pathnames for -L and other options.Rui Ueyama2016-04-302-14/+23
| | | | | | Previously, arguments for options that take pathnames were not rewritten. llvm-svn: 268172
* ELF: --reproduce: Copy files referenced by linker scripts.Rui Ueyama2016-04-304-11/+35
| | | | | | Previuosly, only files appeared on the command line were copied. llvm-svn: 268171
* Attempt to fix Windows buildbots.Rui Ueyama2016-04-301-2/+2
| | | | llvm-svn: 268170
* ELF: Make --reproduce to produce a response file.Rui Ueyama2016-04-304-45/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aim of this patch is to make it easy to re-run the command without updating paths in the command line. Here is a use case. Assume that Alice is having an issue with lld and is reporting the issue to developer Bob. Alice's current directly is /home/alice/work and her command line is "ld.lld -o foo foo.o ../bar.o". She adds "--reproduce repro" to the command line and re-run. Then the following text will be produced as response.txt (notice that the paths are rewritten so that they are relative to /home/alice/work/repro.) -o home/alice/work/foo home/alice/work/foo.o home/alice/bar.o The command also produces the following files by copying inputs. /home/alice/repro/home/alice/work/foo.o /home/alice/repro/home/alice/bar.o Alice zips the directory and send it to Bob. Bob get an archive from Alice and extract it to his home directory as /home/bob/repro. Now his directory have the following files. /home/bob/repro/response.txt /home/bob/repro/home/alice/work/foo.o /home/bob/repro/home/alice/bar.o Bob then re-run the command with these files by the following commands. cd /home/bob/repro ld.lld @response.txt This command will run the linker with the same command line options and the same input files as Alice's, so it is very likely that Bob will see the same issue as Alice saw. Differential Revision: http://reviews.llvm.org/D19737 llvm-svn: 268169
* Don't create dynamic relocations to ro segments.Rafael Espindola2016-04-3011-108/+152
| | | | | | | | | | | | | These would just crash at runtime. If we ever decide to support rw text segments this should make it easier to implement as there is now a single point where we notice the problem. I have tested this with a freebsd buildworld. It found a non pic assembly file being linked into a .so,. With that fixed, buildworld finished. llvm-svn: 268149
* Don't depend on lld creating relocations in ro segments.Rafael Espindola2016-04-3015-154/+163
| | | | | | | | | | | | | | | We currently don't do a good job of diagnosing inputs that would require dynamic relocations to be applied to read only segments. I am about to improve lld in that area, but unfortunately we developed tests that depend on the current behavior. To make clear what is actually changing, this first patch just updates tests to not depend on the current behavior. In most cases this just means using a rw section instead of a ro one, but that unfortunately changes many addresses. llvm-svn: 268145
* Document how to recreate a binary.Rafael Espindola2016-04-291-0/+21
| | | | llvm-svn: 268136
* Document how to recreate a binary.Rafael Espindola2016-04-291-0/+16
| | | | llvm-svn: 268134
* Use simpler types. NFC.Rafael Espindola2016-04-291-2/+2
| | | | llvm-svn: 268133
* [ELF] Ignore -d option (and aliases).Davide Italiano2016-04-291-0/+4
| | | | | | | The linker already allocates common symbols by default. Discussed with Rafael. llvm-svn: 268117
* Fix some Include What You Use warnings; other minor fixes.Eugene Zelenko2016-04-293-19/+53
| | | | | | Differential revision: http://reviews.llvm.org/D19735 llvm-svn: 268093
* Fix typo in test.Rui Ueyama2016-04-291-1/+1
| | | | llvm-svn: 268080
* Be sure to always increment the Versym pointer.Rafael Espindola2016-04-293-3/+27
| | | | | | | It was getting out of sync if we had undefined symbols at the start of the symbol table. llvm-svn: 268077
* Fix the alignment of the version info.Rafael Espindola2016-04-292-4/+8
| | | | llvm-svn: 268070
* Fix producing undefined reference to __progname.Rafael Espindola2016-04-293-5/+10
| | | | | | We were not producing them if the library had version info. llvm-svn: 268060
* ELF: Add -O0 (produce output as fast as possible) mode.Rui Ueyama2016-04-293-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | This patch redefines the default optimization level as 1 and adds new level 0. In the command line, it is -O0. The flag disables costly but optional features so that the linker produces semantically correct but larger output quickly. Currently it only disables section merging. This flag is not intended to be used for final production linking. It is intended to be used in compile-link-test cycle. Time to link clang with debug info is about 2x faster with the flag. Head: 13.24 seconds Output size: 1227189664 bytes With this patch: 7.41 seconds Output size: 2490281784 bytes Differential Revision: http://reviews.llvm.org/D19705 llvm-svn: 268056
* [ELF] Fixed warning. NFC.George Rimar2016-04-291-1/+1
| | | | | | | | SymbolTable.cpp:298:36: warning: enumeral and non-enumeral type in conditional expression [-Wextra] Sym->Binding = New->isShared() ? STB_GLOBAL : New->Binding; ^ llvm-svn: 268040
* [mips] Update tests to account for section size rounding change in r268036.Daniel Sanders2016-04-293-22/+25
| | | | llvm-svn: 268039
* [ELF][MIPS] Accept MIPS 64-bit binariesSimon Atanasyan2016-04-295-3/+73
| | | | | | | LLD accepts MIPS 64-bit binaries, supports corresponding eulation (-m) arguments and emits 64-bit specific ELF flags. llvm-svn: 268024
* Do not produce broken debug info.Rui Ueyama2016-04-292-5/+14
| | | | | | | r267917 produces corrupted debug info because it didn't apply relocations to right offsets. llvm-svn: 267979
* Delete dead variable.Rafael Espindola2016-04-281-1/+0
| | | | llvm-svn: 267935
* Use a single context for lto.Rafael Espindola2016-04-286-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using multiple context used to be a really big memory saving because we could free memory from each file while the linker proceeded with the symbol resolution. We are getting lazier about reading data from the bitcode, so I was curious if this was still a good tradeoff. One thing that is a bit annoying is that we still have to copy the symbol names. The problem is that the names are stored in the Module and get freed when we move the module bits during linking. Long term I think the solution is to add a symbol table to the bitcode. That way IRObject file will not need to use a Module or a Context and we can drop it while still keeping a StringRef to the names. This patch is still be an interesting medium term improvement. When linking llvm-as without debug info this patch is a small speedup: master: 29.861877513 seconds patch: 29.814533787 seconds With debug info the numbers are master: 34.765181469 seconds patch: 34.563351584 seconds The peak memory usage when linking llvm-as with debug info was master: 599.10MB patch: 600.13MB llvm-svn: 267921
* Skip scanRelocs for non-alloc sections.Rui Ueyama2016-04-284-20/+56
| | | | | | | | | | | | | | | | | | | | | | | Relocations against sections with no SHF_ALLOC bit are R_ABS relocations. Currently we are creating Relocations vector for them, but that is wasteful. This patch is to skip vector construction and to directly apply relocations in place. This patch seems to be pretty effective for large executables with debug info. r266158 (Rafael's patch to change the way how we apply relocations) caused a temporary performance degradation for such executables, but this patch makes it even faster than before. Time to link clang with debug info (output size is 1070 MB): before r266158: 15.312 seconds (0%) r266158: 17.301 seconds (+13.0%) Head: 16.484 seconds (+7.7%) w/patch: 13.166 seconds (-14.0%) Differential Revision: http://reviews.llvm.org/D19645 llvm-svn: 267917
* Rename isRelRelativeRafael Espindola2016-04-283-12/+12
| | | | | | It was never a particularly good name and is now completely out of date. llvm-svn: 267886
* Add a test showing that we can gc parts of .eh_frame.Rafael Espindola2016-04-281-0/+13
| | | | llvm-svn: 267884
* Fixed mistype in comment. NFC.George Rimar2016-04-281-1/+1
| | | | llvm-svn: 267878
* Add comment.Rui Ueyama2016-04-281-0/+12
| | | | llvm-svn: 267847
* Do not call hasArg and getLastArg for the same option.Rui Ueyama2016-04-282-8/+7
| | | | llvm-svn: 267839
OpenPOWER on IntegriCloud