- Jan 10, 2017
-
-
Rafael Espindola authored
We were already dropping them from the dynamic symbol table, but the regular symbol table was still listing them as globals. llvm-svn: 291573
-
Peter Collingbourne authored
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
-
- Jan 06, 2017
-
-
Rafael Espindola authored
In order to keep symbol lookup a simple name lookup this patch adds versioned symbols with an explicit @ to the symbol table. llvm-svn: 291293
-
Rui Ueyama authored
The two overloaded functions hid each other. This patch merges them. llvm-svn: 291222
-
- Jan 04, 2017
-
-
Peter Smith authored
In a shared library an undefined symbol is implicitly imported. If the symbol is called as a function a PLT entry is generated for it. When the caller is a Thumb b.w a thunk to the PLT entry is needed as all PLT entries are in ARM state. This change allows undefined symbols to have thunks in the same way that shared symbols may have thunks. llvm-svn: 290951
-
- Dec 21, 2016
-
-
Rui Ueyama authored
DefinedSynthetic is not created for a real ELF object, so it doesn't have to be a template function. It has a virtual st_value, which is either 32 bit or 64 bit, but we can simply use 64 bit. llvm-svn: 290241
-
- Dec 19, 2016
-
-
Rafael Espindola authored
llvm-svn: 290115
-
- Dec 15, 2016
-
-
Sean Silva authored
`SC` didn't make much sense. We don't seem to have a clear convention, but `IS` sounds good here because it emphasizes that it is an input section (this is one place in the code where we are dealing with both input sections and output sections at the same time so that extra emphasis makes it a bit clearer). llvm-svn: 289748
-
- Dec 08, 2016
-
-
Peter Smith authored
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
-
Rui Ueyama authored
llvm-svn: 288993
-
- Dec 05, 2016
-
-
Rui Ueyama authored
llvm-svn: 288686
-
- Nov 29, 2016
-
-
Rui Ueyama authored
StringRefZ is a class to represent a null-terminated string. String length is computed lazily, so it's more efficient than StringRef to represent strings in string table. The motivation of defining this new class is to merge functions that only differ in string types; we have many constructors that takes `const char *` or `StringRef`. With StringRefZ, we can merge them. Differential Revision: https://reviews.llvm.org/D27037 llvm-svn: 288172
-
- Nov 24, 2016
-
-
Rui Ueyama authored
Differential Revision: https://reviews.llvm.org/D27065 llvm-svn: 287899
-
- 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
There are two ways to set symbol versions. One way is to use symbol definition file, and the other is to embed version names to symbol names. In the latter way, symbol name is in the form of `foo@version1` where `foo` is a real name and `version1` is a version. We were parsing symbol names in insert(). That seems unnecessarily too early. We can do it later after we resolve all symbols. Doing it lazily is a good thing because it makes code easier to read (because now we have a separate pass to parse symbol names). Also it could slightly improve performance because if two identical symbols have versions, we now parse them only once. llvm-svn: 287741
-
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 18, 2016
-
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26842 llvm-svn: 287346
-
- Nov 16, 2016
-
-
Eugene Leviant authored
This allows making symbols containing ADDR(section) synthetic, and defining synthetic symbols outside SECTIONS block. Differential revision: https://reviews.llvm.org/D25441 llvm-svn: 287090
-
- Nov 11, 2016
-
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D26498 llvm-svn: 286580
-
- Nov 10, 2016
-
-
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
-
Rafael Espindola authored
The disadvantage is that we use uint64_t instad of uint32_t for some value in 32 bit files. The advantage is a substantially simpler code, faster builds and less code duplication. llvm-svn: 286414
-
- Nov 09, 2016
-
-
Rafael Espindola authored
This is similar to what was done for InputSection. With this the various fields are stored in host order and only converted to target order when writing. llvm-svn: 286327
-
- Nov 06, 2016
-
-
Rui Ueyama authored
A CommonInputSection is a section containing all common symbols. That was an input section but was abstracted in a different way than the synthetic input sections because it was written before the synthetic input section was invented. This patch rewrites CommonInputSection as a synthetic input section so that it behaves better with other sections. llvm-svn: 286053
-
- Oct 28, 2016
-
-
Rui Ueyama authored
Previously, we have a lot of BumpPtrAllocators, but all these allocators virtually have the same lifetime because they are not freed until the linker finishes its job. This patch aggregates them into a single allocator. Differential revision: https://reviews.llvm.org/D26042 llvm-svn: 285452
-
- Oct 26, 2016
-
-
Rafael Espindola authored
We used to have one allocator per file, which reduces the advantage of using an allocator in the first place. This is a small speed up is most cases. The largest speedup was in 1.014X in chromium no-gc. The largest slowdown was scylla at 1.003X. llvm-svn: 285205
-
Rafael Espindola authored
Instead of storing a pointer, store the members we need. The reason for doing this is that it makes it far easier to create synthetic sections. It also avoids reading data from files multiple times., which might help with cross endian linking and host architectures with slow unaligned access. There are obvious compacting opportunities, but this already has mixed results even on native x86_64 linking. There is also the possibility of better refactoring the code for handling common symbols, but this already shows that a custom class is not necessary. llvm-svn: 285148
-
- Oct 21, 2016
-
-
Simon Atanasyan authored
Some MIPS relocations used to access GOT entries are able to manipulate 16-bit index. The other ones like R_MIPS_CALL_HI16/LO16 can handle 32-bit indexes. 16-bit relocations are generated by default. The 32-bit relocations are generated by -mxgot flag passed to compiler. Usually these relocation are not mixed in the same code but files like crt*.o contain 16-bit relocations so even if all "user's" code compiled with -mxgot flag a few 16-bit relocations might come to the linking phase. Now LLD does not differentiate local GOT entries accessed via a 16-bit and 32-bit indexes. That might lead to relocation's overflow if 16-bit entries are allocated to far from the beginning of the GOT. The patch introduces new "part" of MIPS GOT dedicated to the local GOT entries accessed by 32-bit relocations. That allows to put local GOT entries accessed via a 16-bit index first and escape relocation's overflow. Differential revision: https://reviews.llvm.org/D25833 llvm-svn: 284809
-
- Oct 12, 2016
-
-
Davide Italiano authored
This fixes PR30665. Differential Revision: https://reviews.llvm.org/D25495 llvm-svn: 284034
-
Eugene Leviant authored
r283984 introduced a problem of too many warning messages being shown when -ffunction-sections and -fdata-sections were used in conjunction with --gc-sections linker flag and debugging information present. This happens because lot of relocations from .debug_line section may become invalid in such case. The newer fix doesn't show any warning message but zeroes OutSec pointer in createInputSectionList() to avoid crash, when relocations are written llvm-svn: 284010
-
Eugene Leviant authored
Differential revision: https://reviews.llvm.org/D25433 llvm-svn: 283984
-
- Oct 04, 2016
-
-
George Rimar authored
id_000021,sig_11,src_000002,op_flip1,pos_92 from PR30540 does not have TLS sections, but type of one of the symbol is broken and set to STT_TLS, what resulted in a crash. Patch fixes crash. DIfferential revision: https://reviews.llvm.org/D25083 llvm-svn: 283198
-
- Sep 29, 2016
-
-
Simon Atanasyan authored
In case of linking PIC and non-PIC code together and generation of a relocatable object, all PIC symbols should have STO_MIPS_PIC flag in the symbol table of the ouput file. llvm-svn: 282714
-
- Sep 14, 2016
-
-
Simon Atanasyan authored
When the linker generates a relocatable object there is no TLS program header and we should not adjust TLS symbols value. llvm-svn: 281494
-
Rui Ueyama authored
Previously, all input files were owned by the symbol table. Files were created at various places, such as the Driver, the lazy symbols, or the bitcode compiler, and the ownership of new files was transferred to the symbol table using std::unique_ptr. All input files were then free'd when the symbol table is freed which is on program exit. I think we don't have to transfer ownership just to free all instance at once on exit. In this patch, all instances are automatically collected to a vector and freed on exit. In this way, we no longer have to use std::unique_ptr. Differential Revision: https://reviews.llvm.org/D24493 llvm-svn: 281425
-
- Aug 31, 2016
-
-
Rafael Espindola authored
llvm-svn: 280237
-
Rafael Espindola authored
Given that we almost always want to handle it as DefinedRegular, just use DefinedRegular. llvm-svn: 280226
-
- Aug 11, 2016
-
-
Eugene Leviant authored
llvm-svn: 278322
-
- Aug 02, 2016
-
-
Rui Ueyama authored
Since CommonInputSection is a singleton class, we don't need to store pointers to all DefinedCommon symbols. llvm-svn: 277410
-
- Jul 28, 2016
-
-
Eugene Leviant authored
llvm-svn: 277023
-