- Nov 23, 2016
-
-
Rui Ueyama authored
We have different functions to stringize objects to construct error messages. For InputFile, we have getFilename, and for InputSection, we have getName. You had to memorize them. I think this is the case where the function overloading comes in handy. This patch defines toString() functions that are overloaded for all these types, so that you just call it in error(). Differential Revision: https://reviews.llvm.org/D27030 llvm-svn: 287787
-
Rui Ueyama authored
So that we have less number of overloaded functions. llvm-svn: 287745
-
Rui Ueyama authored
Previously, we stored offsets in string tables to symbols, so you needed to pass a string table to get a symbol name. This patch stores const char pointers instead to eliminate the need to pass a string table. llvm-svn: 287737
-
- Nov 22, 2016
-
-
Rafael Espindola authored
llvm-svn: 287701
-
Rui Ueyama authored
We cannot have MipsRldMap class and In<ELFT>::MipsRldMap. Renamed the class. llvm-svn: 287683
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26958 llvm-svn: 287675
-
Rui Ueyama authored
llvm-svn: 287617
-
Rui Ueyama authored
llvm-svn: 287615
-
Rui Ueyama authored
llvm-svn: 287614
-
Rui Ueyama authored
llvm-svn: 287613
-
Rui Ueyama authored
We had five different BuildId subclasses for five different types of build-ids. They can simply be merged to a single class. llvm-svn: 287603
-
- Nov 21, 2016
-
-
Rafael Espindola authored
If the linker script has SECTIONS, the address computation is now always done in LinkerScript::assignAddresses, like for any other section. Before fixHeaders would do a tentative computation that assignAddresses would sometimes override. This patch also splits the cases where assignAddresses needs to add the headers to the first PT_LOAD and the address computation. The net effect is that we no longer create an empty page for no reason in the included test case, which matches bfd behavior. llvm-svn: 287565
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26918 llvm-svn: 287554
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26906 llvm-svn: 287549
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26854 llvm-svn: 287526
-
Rui Ueyama authored
This patch rearranges code a bit to make it easy to explain. llvm-svn: 287515
-
- Nov 18, 2016
-
-
Rafael Espindola authored
It seems a lot simpler to just sort the sections and let the relocations do the rest. llvm-svn: 287365
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26842 llvm-svn: 287346
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26834 llvm-svn: 287326
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26792 llvm-svn: 287322
-
Rui Ueyama authored
MergeOutputSection class was a bit hard to use because it provdes a series of finalize functions that have to be called in a right way at a right time. It also intereacted with MergeInputSection, and the logic was somewhat entangled between the two classes. This patch simplifies it by providing only one finalize function. Now, all you have to do is to call MergeOutputSection::finalize when you have added all sections to the output section. Then, it internally merges strings and initliazes StringPiece objects. I think this is much easier to understand. This patch also adds comments. llvm-svn: 287314
-
- Nov 17, 2016
-
-
Rafael Espindola authored
I hit an internal linker script that was defining _DYNAMIC instead of letting the linker do it. It turns out that both bfd and gold allow that. This is pretty easy to implement, just make the linker defined symbol weak. This should have no impact in the case where there is no user defined symbol: The visibility is hidden, which causes the output to still be local. llvm-svn: 287260
-
Rafael Espindola authored
llvm-svn: 287231
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26740 llvm-svn: 287216
-
- Nov 16, 2016
-
-
Simon Atanasyan authored
MIPS GOT handling is very different from other targets so it is better to keep the code in the separatre section class MipsGotSection. This patch introduces the new section and moves all MIPS specific code from GotSection to the new class. I did not rename fields and methods in the MipsGotSection class to reduce the diff and plan to do that by the separate commit. Differential revision: https://reviews.llvm.org/D26733 llvm-svn: 287150
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26669 llvm-svn: 287092
-
- Nov 15, 2016
-
-
Eugene Leviant authored
llvm-svn: 286955
-
Eugene Leviant authored
This patch introduces the following changes: - DynamicSection now inherits InputSection<ELFT> and was moved to SyntheticSections.h/.cpp. - Link and Entsize fields of DynamicSection are propagated to its output section - In<ELFT>::SyntheticSections was removed. - Finalization of synthetic sections was removed from OutputSection<ELFT>::finalize. Now finalizeSyntheticSections is used instead. Differential revision: https://reviews.llvm.org/D26603 llvm-svn: 286950
-
George Rimar authored
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
-
George Rimar authored
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
-
- Nov 14, 2016
-
-
Rafael Espindola authored
Propagate program headers by walking the commands, not the sections. This allows us to propagate program headers even from sections that don't end up in the output. Fixes pr30997. llvm-svn: 286837
-
George Rimar authored
llvm-svn: 286805
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26549 llvm-svn: 286799
-
- Nov 11, 2016
-
-
Rafael Espindola authored
Unlike gold, bfd, gas or MC we were putting exidx sections first since they are ro. The spec doesn't explicitly say that they must come after, but it is definitely more convenient for the consumer, matches other producers and matches other areas in ELF (like SHT_GROUP) where sections are ordered in a natural way. llvm-svn: 286659
-
Rafael Espindola authored
We would create a MergeInputSection for the synthetic .comment and crash trying to add it to a regular output section. With this we just don't add the synthetic section with -r. That is consistent with gold that doesn't create .note.gnu.gold-version with -r. llvm-svn: 286635
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26498 llvm-svn: 286580
-
- Nov 10, 2016
-
-
Rui Ueyama authored
Summary: This patch adds a ".comment" section to an output. The comment section contains the linker's version string. You can now find out whether a binary is created by LLD or not using objdump command like this. $ objdump -s -j .comment foo foo: file format elf64-x86-64 Contents of section .comment: 0000 00474343 3a202855 62756e74 7520342e .GCC: (Ubuntu 4. 0010 382e342d 32756275 6e747531 7e31342e 8.4-2ubuntu1~14. ... 00c0 766d2f74 72756e6b 20323835 38343629 vm/trunk 285846) 00d0 004c696e 6b65723a 204c4c44 20342e30 .Linker: LLD 4.0 00e0 2e302028 7472756e 6b203238 36343036 .0 (trunk 286406 00f0 2900 ). Compilers emits .comment section as well, so the output contains both compiler and linker information. Alternative considered: I first tried to add a SHT_NOTE section because GNU gold does that. A NOTE section starts with a header which contains content type. It turned out that ld.gold sets type NT_GNU_GOLD_VERSION to their NOTE section. So the NOTE type is only for GNU gold (surprise!) Next, I tried to create ".linker-version" section. However, it seems that reusing the existing ".comment" section is better because 1) other tools already know about .comment section and is able to strip it and 2) the result contans not only linker info but also compiler info. Differential Revision: https://reviews.llvm.org/D26487 llvm-svn: 286496
-
Rafael Espindola authored
Relocations are the last thing that we wore storing a raw section pointer to and parsing on demand. With this patch we parse it only once and store a pointer to the actual data. The patch also changes where we store it. It is now in InputSectionBase. Not all sections have relocations, but most do and this simplifies the logic. It also means that we now only support one relocation section per section. Given that that constraint is maintained even with -r with gold bfd and lld, I think it is OK. llvm-svn: 286459
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26349 llvm-svn: 286443
-
George Rimar authored
Patch allows to pass a symbols file to linker. LLD will map symbols to sections and sort sections in output according to symbol ordering file. That can help to reduce the startup time and/or amount of pagefaults during startup. Also, interesting benchmark result was produced by Rafael Espíndola. After applying the symbols file for clang he timed compiling X86MCTargetDesc.ii to an object file. The page faults went from just 56,988 to 56,946 since most faults are not in the binary. Running time went from 4.403053515 to 4.178112244. The speedup seems to be because of better cache locality. Differential revision: https://reviews.llvm.org/D26130 llvm-svn: 286440
-