- Oct 11, 2017
-
-
Rui Ueyama authored
"Commands" was ambiguous because in the linker script, everything is a command. We used to handle only SECTIONS commands, and at the time, it might make sense to call them the commands, but it is no longer the case. We handle not only SECTIONS but also MEMORY, PHDRS, VERSION, etc., and they are all commands. llvm-svn: 315409
-
Rui Ueyama authored
HasSections is true if there is at least one SECTIONS linker script command, and it is not directly related to whether we have section objects or not. So I think the new name is better. llvm-svn: 315405
-
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
-
Peter Collingbourne authored
Fixes PR34306. This is because it usually results in more compact code, and because there are also known code generation bugs when using the PIC model (see bug). Based on a patch by Carlo Kok. Differential Revision: https://reviews.llvm.org/D38769 llvm-svn: 315400
-
Rui Ueyama authored
I think three ctors are too many for this simple class. llvm-svn: 315394
-
Rui Ueyama authored
llvm-svn: 315393
-
Rui Ueyama authored
llvm-svn: 315386
-
Rui Ueyama authored
The condition whether a section is alive or not by default is becoming increasingly complex, so the decision of garbage collection is spreading over InputSection.h and MarkLive.cpp, which is not a good state. This moves the code to MarkLive.cpp, to keep the file the central place to make decisions about garbage collection. llvm-svn: 315384
-
Rafael Espindola authored
llvm-svn: 315377
-
- Oct 10, 2017
-
-
Rafael Espindola authored
We just don't need one with the current setup. We only error on undefined references that are used by some relocation. If we managed to relax all uses of __tls_get_addr, no relocation uses it and we don't produce an error. This is less code and fixes the case were we fail to relax. Before we would produce a broken output, but now we produce an error. llvm-svn: 315334
-
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
-
Andrew Ng authored
When findOrphanPos does the reverse search to find the OutputSection preceding the orphan's insertion point, look for a live OutputSection and ignore "dead" OutputSection's. This matches the behaviour of the forward search performed earlier in this function. Added test which without the above fix fails as a result of an orphan executable section being incorrectly placed in a non-executable segment. Differential Review: https://reviews.llvm.org/D38690 llvm-svn: 315292
-
George Rimar authored
It did not contain information about relocation type and symbol. Differential revision: https://reviews.llvm.org/D38623 llvm-svn: 315280
-
Martin Storsjö authored
This allows linking code with dwarf exception handling. Differential Revision: https://reviews.llvm.org/D38681 llvm-svn: 315273
-
Rui Ueyama authored
llvm-svn: 315271
-
Rui Ueyama authored
llvm-svn: 315270
-
Rui Ueyama authored
llvm-svn: 315269
-
Rui Ueyama authored
llvm-svn: 315268
-
Rui Ueyama authored
llvm-svn: 315267
-
Rui Ueyama authored
This patch also moves declarations so that related declarations next to each other. llvm-svn: 315266
-
Rui Ueyama authored
llvm-svn: 315265
-
- 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
This patch also make its return type to `void` because it always returns a given value as-is. llvm-svn: 315165
-
Rui Ueyama authored
llvm-svn: 315164
-
Rui Ueyama authored
llvm-svn: 315163
-
Rui Ueyama authored
llvm-svn: 315158
-
- Oct 07, 2017
-
-
Rafael Espindola authored
llvm-svn: 315141
-
Rui Ueyama authored
I feel it is easier to understand without this function. llvm-svn: 315140
-
Rui Ueyama authored
llvm-svn: 315139
-
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: 315137
-
Rui Ueyama authored
llvm-svn: 315133
-
Rui Ueyama authored
I believe the reason why we used warn() instead of error() to report undefined symbols is because the older implementation of error() exitted immediately. Here, we want to find as many undefined symbols as we can, so I chose to use warn() instead of error(). Now error() does not exit immediately, so it doesn't make sense to keep them as warnings. Differential Revision: https://reviews.llvm.org/D38652 llvm-svn: 315131
-
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
-