- Oct 11, 2017
-
-
Rui Ueyama authored
llvm-svn: 315404
-
Rui Ueyama authored
ScriptConfiguration was a class to contain parsed results of linker scripts. LinkerScript is a class to interpret it. That ditinction was needed because we haven't instantiated LinkerScript early (because, IIRC, LinkerScript class was a ELFT template function). So, when we parse linker scripts, we couldn't directly store the result to a LinkerScript instance. Now, that limitation is gone. We instantiate LinkerScript at the very beginning of our main function. We can directly store parse results to a LinkerScript instance. llvm-svn: 315403
-
Rui Ueyama authored
Because addRegular's functionality is tightly coupled with addSymbol, and the former is called only once, it makes sense to merge the two functions. This patch also adds comments. llvm-svn: 315401
-
Rui Ueyama authored
I think three ctors are too many for this simple class. llvm-svn: 315394
-
- Oct 10, 2017
-
-
James Henderson authored
When parsing linker scripts, LLD previously started with a '.' value of 0, regardless of the internal default image base for the target, and regardless of switches such as --image-base. It seems reasonable to use a different image base value when using linker scripts and --image-base is specified, since otherwise the switch has no effect. This change does this, as well as removing unnecessary initialisation of Dot where it is not used. The default image base should not be used when processing linker scripts, because this will change the behaviour for existing linker script users, and potentially result in invalid output being produced, as a subsequent assignment to Dot could move the location counter backwards. Instead, we maintain the existing behaviour of starting from 0 if --image-base is not specified. Reviewers: ruiu Differential Revision: https://reviews.llvm.org/D38360 llvm-svn: 315293
-
- Oct 08, 2017
-
-
Rui Ueyama authored
This should improve consistency. Also added comment. llvm-svn: 315169
-
Rui Ueyama authored
llvm-svn: 315168
-
Rui Ueyama authored
llvm-svn: 315167
-
Rui Ueyama authored
llvm-svn: 315166
-
Rui Ueyama authored
llvm-svn: 315164
-
- Oct 07, 2017
-
-
Rui Ueyama authored
I feel it is easier to understand without this function. llvm-svn: 315140
-
Rui Ueyama authored
Previously, when we added an input section to an output section, we called `OutputSectionFactory::addInputSec`. This isn't a good design because, a factory class is intended to create a new object and return it, but in this use case, it will never create a new object. This patch fixes the design flaw. llvm-svn: 315138
-
Rui Ueyama authored
llvm-svn: 315133
-
Rui Ueyama authored
Factory::addInputSec added an output section to Script->Opt.Commands, but that is too subtle. This patch makes it explicit so that it is easy to see when a new element is added to Script->Opt.Commands. llvm-svn: 315129
-
Rui Ueyama authored
This patch moves a std::find to a new function. It also removes the following piece of code. I believe it should be fine because all tests still pass. unsigned Index = std::distance(Opt.Commands.begin(), I); assert(Sec->SectionIndex == INT_MAX || Sec->SectionIndex == Index); Sec->SectionIndex = Index; llvm-svn: 315125
-
Rui Ueyama authored
addSection function was hard to read because it behaves differently depending on its arguments but what exactly it does is not clear. Now it should be better. Still, it is not clear (not what but) why it does what it does, but I'll take a look at it later. llvm-svn: 315124
-
- Oct 02, 2017
-
-
George Rimar authored
That makes code a bit more consistent. Instead of removing sections there we can just mark them as dead. So that removeEmptyCommands() will handle the rest. Differential revision: https://reviews.llvm.org/D38393 llvm-svn: 314654
-
- Sep 28, 2017
-
-
Rafael Espindola authored
We were not subtracting its size, causing it to overlap with section data. Fixes PR34750. llvm-svn: 314440
-
- Sep 25, 2017
-
-
Rui Ueyama authored
llvm-svn: 314126
-
Rui Ueyama authored
llvm-svn: 314120
-
George Rimar authored
When -verbose is specified, patch outputs names of each input orphan section assigned to output. Differential revision: https://reviews.llvm.org/D37517 llvm-svn: 314098
-
- Sep 20, 2017
-
-
Rafael Espindola authored
The previous logic was to try to detect if a linker script defined _gp by checking !ElfSym::MipsGp->Value. That doesn't work in all cases as the assigned value can be 0. We now just always defined it Writer.cpp and always overwrite it afterwards if needed. llvm-svn: 313788
-
Rafael Espindola authored
Normally to find the offset of a value in a section, we have to compute the value since the alignment is defined on the final address. If the alignment is trivial, we can skip the value computation. This allows us to know the offset even in cases where we cannot yet know the value. llvm-svn: 313777
-
Rafael Espindola authored
We try to evaluate expressions early when possible, but it is not possible to evaluate them early if they are based on a section. Before we would get this wrong on ABSOLUTE expressions. llvm-svn: 313764
-
- Sep 19, 2017
-
-
George Rimar authored
This patch removes lot of static Instances arrays from different input file classes and introduces global arrays for access instead. Similar to arrays we have for InputSections/OutputSectionCommands. It allows to iterate over input files in a non-templated code. Differential revision: https://reviews.llvm.org/D35987 llvm-svn: 313619
-
- Sep 18, 2017
-
-
George Rimar authored
Does not seem we need to set SectionIndex here. It is set in finalizeSections() later. Differential revision: https://reviews.llvm.org/D37815 llvm-svn: 313522
-
- Sep 12, 2017
-
-
Rafael Espindola authored
It is not needed since it is always 0. llvm-svn: 313076
-
Rafael Espindola authored
This fixes two more cases where we were aligning the offset in a section, instead of the final address. llvm-svn: 312983
-
Rafael Espindola authored
When given foobar = ALIGN(., 0x100); my expectation from what the manual says is that the final address of foobar will be aligned. It seems that bfd aligns the offset in the section, which causes some odd results if the section is not 0x100 aligned. Gold aligns the address. This changes lld to align the final address. llvm-svn: 312979
-
- Sep 08, 2017
-
-
Dmitry Mikulin authored
to separate commons based on file name patterns. The following linker script construct does not work because commons are allocated before section placement is done and the only synthesized BssSection that holds all commons has no file associated with it: SECTIONS { .common_0 : { *file0.o(COMMON) }} This patch changes the allocation of commons to create a section per common symbol and let the section logic do the layout. Differential revision: https://reviews.llvm.org/D37489 llvm-svn: 312796
-
George Rimar authored
REGION_ALIAS(alias, region) Alias names can be added to existing memory regions created with the MEMORY command. Each name corresponds to at most one memory region. Differential revision: https://reviews.llvm.org/D37477 llvm-svn: 312777
-
- Sep 07, 2017
-
-
George Rimar authored
As was suggested in D34956 thread. llvm-svn: 312712
-
George Rimar authored
It is a bit more convinent and helps to simplify logic of program headers allocation a little. Differential revision: https://reviews.llvm.org/D34956 llvm-svn: 312711
-
- Sep 06, 2017
-
-
George Rimar authored
Previously LLD did not calculate LMAOffset correctly when AT and MEMORY were used together. Patch fixes PR34407. Differential revision: https://reviews.llvm.org/D37469 llvm-svn: 312625
-
- Aug 28, 2017
-
-
George Rimar authored
llvm-svn: 311878
-
- Aug 25, 2017
-
-
Dmitry Mikulin authored
linker script SECTION rules. This patch extends it to use a fully specified file name as it appears in --trace output to match agains, i.e, "<path>/<objname>.o" or "<path>/<libname>.a(<objname>.o)". Differential Revision: https://reviews.llvm.org/D37031 llvm-svn: 311713
-
- Aug 23, 2017
-
-
Petr Hosek authored
Currently, LLD checks whether there's enough space for headers by checking if headers fit below the address of the first allocated section. However, that's always thue if the binary doesn't start at zero which means that LLD always emits a segment for headers, even if no other sections belong to that segment. This is a problem in cases when linker script is being used with a non-zero start address when we don't want to make the headers visible by not leaving enough space for them. This pattern is common in embedded programming but doesn't work in LLD. This patch changes the behavior of LLD in case when linker script is being to match the behavior of BFD ld and gold, which is to only place headers into a segment when they're covered by some output section. Differential Revision: https://reviews.llvm.org/D36256 llvm-svn: 311586
-
- Aug 21, 2017
-
-
George Rimar authored
[ELF] - Do not segfault when doing logical and/or operations on symbols that have no output sections. Previously we would crash on samples from testcase, because were trying to access zero pointer to output section. Differential revision: https://reviews.llvm.org/D36145 llvm-svn: 311311
-
- Aug 17, 2017
-
-
George Rimar authored
We would previously crash on next script: MEMORY { name : ORIGIN = .; } Patch fixes that. Differential revision: https://reviews.llvm.org/D36138 llvm-svn: 311073
-
- Aug 10, 2017
-
-
George Rimar authored
This patch restricts following construction: /DISCARD/ : { *(COMMON) } Previously LLD would crash. Differential revision: https://reviews.llvm.org/D36468 llvm-svn: 310554
-