- Jul 04, 2017
-
-
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
-
- Jun 20, 2017
-
-
Sam Clegg authored
The option numbers in the macro were off by one which leads to some confusion. There are actually 12 arguments to this macro. Differential Revision: https://reviews.llvm.org/D34413 llvm-svn: 305823
-
Yuka Takahashi authored
This is patch for GSoC project, bash-completion for clang. To use this on bash, please run `source clang/utils/bash-autocomplete.sh`. bash-autocomplete.sh is code for bash-completion. In this patch, Options.td was mainly changed in order to add value class in Options.inc. llvm-svn: 305805
-
Rafael Espindola authored
I found this while trying to build u-boot. It uses -Ttext in combination with linker scripts. My first reaction was to change the linker scripts to have the correct value, but I found that it is actually quite convenient to have -Ttext take precedence. By having just .text : { *(.text) } In the script, they can define the text address in a single Makefile and pass it to ld with -Ttext and for the C code with -DFoo=value. Doing the same with linker scripts would require them to be generated during the build. llvm-svn: 305766
-
- Jun 19, 2017
-
-
Konstantin Zhuravlyov authored
Differential Revision: https://reviews.llvm.org/D34358 llvm-svn: 305742
-
Andrew Ng authored
This patch adds support for segment NONE in linker scripts which enables the specification that a section should not be assigned to any segment. Note that GNU ld does not disallow the definition of a segment named NONE, which if defined, effectively overrides the behaviour described above. This feature has been copied. Differential Revision: https://reviews.llvm.org/D34203 llvm-svn: 305700
-
James Henderson authored
In r305364, Rui changed the mechanism that parses -z option values slightly. This caused a bug, as demonstrated by this test, which now fails: --- # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o # RUN: ld.lld %t.o -o %t -z max-page-size .global _start _start: nop --- Before, the link succeeded and set the max-page-size to the target default. After we get the following two error messages: "invalid max-page-size: " "max-page-size: value isn't a power of 2" The latter error is because an uninitialised variable ends up being passed back to getMaxPageSize). This change ensures we only get the first error. Reviewers: ruiu Differential Revision: https://reviews.llvm.org/D34234 llvm-svn: 305679
-
Peter Smith authored
The get{ARM,AArch64}UndefinedRelativeWeakVA() functions should only be called for PC-relative relocations. Complete the supported pc-relative relocations in the switch statement and make the default case unreachable. The R_ARM_TARGET relocation can be evaluated as R_ARM_REL32 but it is only used in the context of exception tables, and is never output with respect to a weak reference so it does not appear in the switch statement. Differential Revision: https://reviews.llvm.org/D34138 llvm-svn: 305673
-
- Jun 17, 2017
-
-
Rafael Espindola authored
We would crash before. llvm-svn: 305615
-
Rafael Espindola authored
We would crash instead before. llvm-svn: 305614
-
Rafael Espindola authored
We would crash instead before. llvm-svn: 305613
-