- Jul 05, 2017
-
-
Peter Smith authored
This change permits there to be more than one thunk to be associated with a symbol. For interworking thunks we only require one thunk, but range extension thunks may require more than one. Differential Revision: https://reviews.llvm.org/D34037 llvm-svn: 307136
-
Peter Smith authored
On ARM the interworking thunks are only produced for branch instructions that can't be changed into a blx instruction so only Thumb callers would call Thumb thunks and only ARM callers would call ARM thunks. With range extension thunks branch and link instructions may need a Thunk. These instructions can be rewritten as a blx and can use either ARM or Thumb thunks. We introduce an isCompatibleWith() function so that a caller can check if an existing Thunk is compatible before reusing it. Differential Revision: https://reviews.llvm.org/D34035 llvm-svn: 307132
-
Peter Smith authored
The allocateHeaders() function is called at the end of assignAddresses(), it decides whether the ELF header and program header table can be allocated to a PT_LOAD program header. As the function alters state, it prevents assignAddresses() from being called multiple times. This change splits out the call to allocateHeaders() from assignAddresses() this will permit assignAddresses() to be called while processing range extension thunks without trying to allocateHeaders(). Differential Revision: https://reviews.llvm.org/D34344 llvm-svn: 307131
-
Rafael Espindola authored
This is a semantic revert of r306036. We have to change the names, otherwise dynamic relocations will point to the wrong name. llvm-svn: 307110
-
- Jul 04, 2017
-
-
Rafael Espindola authored
This is finally getting to the point where output sections are constructed. createOrphanCommands and fabricateDefaultCommands are moved out so they can be merged with existing code in followup commits. llvm-svn: 307107
-
Rafael Espindola authored
Now addSectionSymbols operates on the linker script. llvm-svn: 307102
-
Rafael Espindola authored
Now all of finalizeSections works on the linker script. llvm-svn: 307101
-
Rafael Espindola authored
Now addPredefinedSections operates only on the linker script. llvm-svn: 307100
-
Tom Stellard authored
Summary: If the output file is a character file (e.g. /dev/null) unlinking it could potentially destabilize the user's system. For example, unlinking causes `lld %input -o /dev/null` to replace /dev/null with a regular file, which will lead to unexpected behavior in other programs that read from /dev/null, and worse than expected peformance for programs that write to /dev/null. This makes it possible to run the test-release.sh script as root. Prior to this patch, the ELF/basic.s test would replace /dev/null with a regular file, which would cause crashes in llvm test-suite programs that piped /dev/null to stdin. For example, if you run the test-relase.sh script as root, Reviewers: ruiu Reviewed By: ruiu Subscribers: emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D34917 llvm-svn: 307092
-
Rafael Espindola authored
Before we would sometimes not mention that the relocation was in a ro area before. llvm-svn: 307089
-
Simon Atanasyan authored
llvm-svn: 307083
-
George Rimar authored
This is PR28414. Previously LLD was unable to link following: (failed with undefined symbol bar) Version script: SOME_VERSION { global: *; }; .global _start .global bar .symver _start, bar@@SOME_VERSION _start: jmp bar Manual has next description: .symver name, name2@@nodename In this case, the symbol name must exist and be defined within the file being assembled. It is similar to name2@nodename. The difference is name2@@nodename will also be used to resolve references to name2 by the linker https://sourceware.org/binutils/docs/as/Symver.html Patch implements that. If we have name@@ver symbol and name is undefined, name@@ver is used to resolve references to name. If name is defined then multiple definition error is emited, that is consistent with what bfd do. Differential revision: https://reviews.llvm.org/D33680 llvm-svn: 307077
-
George Rimar authored
Two more places. llvm-svn: 307076
-
- Jul 03, 2017
-
-
Rafael Espindola authored
llvm-svn: 307044
-
Rafael Espindola authored
Now removeUnusedSyntheticSections operates entirely on the linker script. llvm-svn: 307043
-
George Rimar authored
* Return type changed to void, because it was unused. * std::find_if -> llvm::find_if llvm-svn: 307039
-
Petr Hosek authored
Script commands are processed before unused synthetic sections are removed. Therefore, if a linker script matches one of these sections it'll get emitted as an empty output section because the logic for removing unused synthetic sections ignores script commands which could have already matched and captured one of these sections. This patch fixes that by also removing the unused synthetic sections from the script commands. Differential Revision: https://reviews.llvm.org/D34800 llvm-svn: 307037
-
Andrew Ng authored
This patch makes changes to allow sections without the SHF_ALLOC bit to be assigned to segments in a linker script. The assignment of output sections to segments is performed in LinkerScript::createPhdrs. Previously, this function would bail as soon as it encountered an output section which did not have the SHF_ALLOC bit set, thus preventing any output section without SHF_ALLOC from being assigned to a segment. This restriction has now been removed from LinkerScript::createPhdrs and instead a check for SHF_ALLOC has been added to LinkerScript::adjustSectionsAfterSorting to not propagate program headers to sections without SHF_ALLOC which matches the behaviour of bfd linker scripts. Differential Revision: https://reviews.llvm.org/D34204 llvm-svn: 307013
-
Rui Ueyama authored
This reverts commit r306813 because it broke linking of the FreeBSD base system. llvm-svn: 306996
-
- Jun 30, 2017
-
-
George Rimar authored
This is PR28414. Previously LLD was unable to link following: (failed with undefined symbol bar) ``` Version script: SOME_VERSION { global: *; }; .global _start .global bar .symver _start, bar@@SOME_VERSION _start: jmp bar ``` Manual has next description: // .symver name, name2@@nodename In this case, the symbol name must exist and be defined within the file being assembled. It is similar to name2@nodename. **The difference is name2@@nodename will also be used to resolve references to name2 by the linker** https://sourceware.org/binutils/docs/as/Symver.html // Patch implements that. If we have name@@ver symbol and name is undefined, name@@ver is used to resolve references to name. Differential revision: https://reviews.llvm.org/D33680 llvm-svn: 306813
-
Sam Clegg authored
Differential Revision: https://reviews.llvm.org/D34852 llvm-svn: 306772
-
- Jun 29, 2017
-
-
Paul Robinson authored
llvm-svn: 306700
-
Rafael Espindola authored
Now that _GLOBAL_OFFSET_TABLE_ is defined, we can just use R_PC for it if needed. llvm-svn: 306614
-
Rafael Espindola authored
llvm-svn: 306609
-
- Jun 28, 2017
-
-
Rui Ueyama authored
We could have add this function either Symbol or SymbolBody. I added it to Symbol at first. But I noticed that if I've added it to SymbolBody, we could've removed SymbolBody::setName(). So I'll do that in this patch. llvm-svn: 306590
-
Rui Ueyama authored
This patch adds a utility function to Symbol. This function should be useful in https://reviews.llvm.org/D33680 too. llvm-svn: 306587
-
Rui Ueyama authored
Add support for the most common SPARC relocations. Make DT_PLTGOT point to the PLT on SPARC. Mark the PLT as executable on SPARC. This adds a basic test that creates a SPARV9 executable that invokes the exit system call on OpenBSD. Patch by Mark Kettenis. Differential Revision: https://reviews.llvm.org/D34618 llvm-svn: 306565
-
George Rimar authored
This is PR33596. Previously LLD would crash because BYTE command synthesized output section, but it was not assigned to Sec member of OutputSectionCommand. Behaviour of -script and -r combination is not well defined, but it seems after this change LLD naturally inherits behavior of GNU linkers - creates output section requested in script and does not crash anymore. Differential revision: https://reviews.llvm.org/D34676 llvm-svn: 306527
-
George Rimar authored
This fixes PR33598. Size field for undefined symbols is not significant. Setting it to fixed value, like zero, may be useful though. For example when we have 2 DSO's, like in this PR, if lower level DSO may change slightly (in part of some symbol's st_size) and higher-level DSO is rebuilt, then tools that monitoring checksum of high level DSO file can notice it and trigger cascade of some other unnecessary actions. If we set st_size to zero, that can be avoided. Differential revision: https://reviews.llvm.org/D34673 llvm-svn: 306526
-
Peter Smith authored
When -ffunction-sections and ARM C++ exceptions are used each .text.suffix section will have at least one .ARM.exidx.suffix section and may have an additional .ARM.extab.suffix section if the unwinding instructions are too large to inline into the .ARM.exidx table entry. For a large program without a linker script this can lead to a large number of section header table entries that can increase the size of the ELF file. This change introduces a default rule for .ARM.extab.* to be placed in a single output section called .ARM.extab . This follows the behavior of ld.gold and ld.bfd. fixes pr33407 Differential Revision: https://reviews.llvm.org/D34678 llvm-svn: 306522
-
- Jun 26, 2017
-
-
Rui Ueyama authored
This patch fills holes in executable sections with 0xd4 (ARM) or 0xef (MIPS). These trap instructions were suggested by Theo de Raadt. llvm-svn: 306322
-
Rui Ueyama authored
llvm-svn: 306308
-
Rui Ueyama authored
`addInputSec` returns void. Even though it is syntactically correct, the use of `return` here is just confusing. llvm-svn: 306307
-
Rui Ueyama authored
Most "reserved" symbols are in ElfSym and it looks like there's no reason to not do the same thing for _GLOBAL_OFFSET_TABLE_. This should help https://reviews.llvm.org/D34618 too. llvm-svn: 306292
-
Peter Smith authored
On many architectures gcc and clang will recognize _GLOBAL_OFFSET_TABLE_ - . and produce a relocation that can be processed without needing to know the value of _GLOBAL_OFFSET_TABLE_. This is not always the case; for example ARM gcc produces R_ARM_BASE_PREL but clang produces the more general R_ARM_REL32 to _GLOBAL_OFFSET_TABLE_. To evaluate this relocation correctly _GLOBAL_OFFSET_TABLE_ must be defined to be the either the base of the GOT or end of the GOT dependent on architecture.. If/when llvm-mc is changed to recognize _GLOBAL_OFFSET_TABLE_ - . this change will not be necessary for new objects. However there may still be old objects and versions of clang. Differential Revision: https://reviews.llvm.org/D34355 llvm-svn: 306282
-
- Jun 22, 2017
-
-
Rui Ueyama authored
Previously, when symbol A is renamed B, both A and B end up having the same name. This is because name is a symbol's attribute, and we memcpy symbols for symbol renaming. This pathc saves the original symbol name and restore it after memcpy to keep the original name. This patch shouldn't change program's meaning, but names in symbol tables make more sense than before. llvm-svn: 306036
-
Igor Kudrin authored
Differential Revision: https://reviews.llvm.org/D34442 llvm-svn: 305983
-
- Jun 21, 2017
-
-
Peter Collingbourne authored
This is unnecessary because --gc-sections runs before ICF. Differential Revision: https://reviews.llvm.org/D34465 llvm-svn: 305954
-
Rui Ueyama authored
The --exclude-libs option is not a popular option, but at least some programs in Android depend on it, so it's worth to support it. Differential Revision: https://reviews.llvm.org/D34422 llvm-svn: 305920
-
Rui Ueyama authored
llvm-svn: 305877
-