| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
llvm-svn: 256894
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we handle archive files with --whole-archive this way:
create instances of ArchiveFile, call getMembers to obtain memory
buffers of archive members, and create ObjectFiles for the members.
We didn't call anything except getMembers if --whole-archive was
specified.
I noticed that we didn't actually have to create ArchiveFile instaces
at all for that case. All we need is to get a list of memory buffers
for members, which can be done by a non-member function.
This patch removes getMembers member function from ArchiveFile.
Also removed unnecessary code for memory management.
llvm-svn: 256893
|
|
|
|
|
|
|
| |
createELFFile looked complex because of its use of template,
so I want to keep it private within this file.
llvm-svn: 256880
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations use the following
expressions for calculations:
```
local symbol: S + A + GP0 - GP
global symbol: S + A - GP
GP - Represents the final gp value, i.e. _gp symbol
GP0 - Represents the gp value used to create the relocatable object
```
The GP0 value is taken from the .reginfo data section defined by an object
file. To implement that I keep a reference to `MipsReginfoInputSection`
in the `ObjectFile` class. This reference is used by the
`ObjectFile::getMipsGp0` method to return the GP0 value.
Differential Revision: http://reviews.llvm.org/D15760
llvm-svn: 256416
|
|
|
|
| |
llvm-svn: 256369
|
|
|
|
|
|
| |
We no longer need an explicit delete or a polymorphic destructor.
llvm-svn: 256333
|
|
|
|
| |
llvm-svn: 256316
|
|
|
|
| |
llvm-svn: 256311
|
|
|
|
|
|
|
| |
We were leaking InputFile subclasses data.
UndefinedElf was missing a classof.
llvm-svn: 256309
|
|
|
|
|
|
| |
There's no need to write it in a .h file.
llvm-svn: 253633
|
|
|
|
|
|
|
| |
* We can determine the alignment requirement.
* We have to update the bss alignment with it.
llvm-svn: 251914
|
|
|
|
| |
llvm-svn: 251908
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Section garbage collection is a feature to remove unused sections
from outputs. Unused sections are sections that cannot be reachable
from known GC-root symbols or sections. Naturally the feature is
implemented as a mark-sweep garbage collector.
In this patch, I added Live bit to InputSectionBase. If and only
if Live bit is on, the section will be written to the output.
Starting from GC-root symbols or sections, a new function, markLive(),
visits all reachable sections and sets their Live bits. Writer then
ignores sections whose Live bit is off, so that such sections are
excluded from the output.
This change has small negative impact on performance if you use
the feature because making sections means more work. The time to
link Clang changes from 0.356s to 0.386s, or +8%.
It reduces Clang size from 57,764,984 bytes to 55,296,600 bytes.
That is 4.3% reduction.
http://reviews.llvm.org/D13950
llvm-svn: 251043
|
|
|
|
|
|
| |
For now SHF_STRINGS are not supported.
llvm-svn: 250737
|
|
|
|
| |
llvm-svn: 250519
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BSD's DSO files have undefined symbol "__progname" which is defined
in crt1.o. On that system, both user programs and system shared
libraries depend on each other.
In general, we need to put symbols defined by user programs which are
referenced by shared libraries to user program's .dynsym.
http://reviews.llvm.org/D13637
llvm-svn: 250176
|
|
|
|
|
|
| |
Now that the base class is templated, it is redundant with the type.
llvm-svn: 250139
|
|
|
|
| |
llvm-svn: 250051
|
|
|
|
| |
llvm-svn: 250047
|
|
|
|
| |
llvm-svn: 250031
|
|
|
|
| |
llvm-svn: 250028
|
|
|
|
| |
llvm-svn: 250006
|
|
|
|
|
|
|
| |
Now that the SymbolTable is templated, we don't need the ELFData class or
multiple inheritance.
llvm-svn: 250005
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds AsNeeded and IsUsed bool fields to SharedFile. AsNeeded bit
is set if the DSO is enclosed with --as-needed and --no-as-needed. IsUsed
bit is off by default. When we adds a symbol to the symbol table for dynamic
linking, we set its SharedFile's IsUsed bit.
If AsNeeded is set but IsUsed is not set, we don't want to write that
file's SO name to DT_NEEDED field.
http://reviews.llvm.org/D13579
llvm-svn: 249998
|
|
|
|
| |
llvm-svn: 249996
|
|
|
|
| |
llvm-svn: 249968
|
|
|
|
|
|
| |
The implementation is a direct translation to c++ of the rules in the ELF spec.
llvm-svn: 249881
|
|
|
|
| |
llvm-svn: 249635
|
|
|
|
|
|
|
|
|
| |
Parse and apply emulation given with -m option.
Check input files to match ELF type and machine architecture provided with -m.
Differential Revision: http://reviews.llvm.org/D13055
llvm-svn: 249529
|
|
|
|
| |
llvm-svn: 249061
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
If --whole-archive is used, all symbols from the following archives are added to the output. --no-whole-archive restores default behavior. These switches can be used multiple times.
NB. We have to keep an ArchiveFile instance within SymbolTable even if --whole-archive mode is active since it can be a thin archive which contains just names of external files. In that case actual memory buffers for the archive members will be stored within the File member of ArchiveFile class.
Reviewers: rafael, ruiu
Subscribers: grimar, llvm-commits
Projects: #lld
Differential Revision: http://reviews.llvm.org/D13286
llvm-svn: 249045
|
|
|
|
|
|
|
|
|
| |
If a shared library has a DT_SONAME entry, that is what should be included
in the DT_NEEDED of a program using it.
We don't implement -soname yet, so check in a .so for now.
llvm-svn: 249025
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Opening a file and dispatching to readLinkerScript() or createFile()
is a common operation. We want to use that at least from Driver and
from LinkerScript. In COFF, we had the same problem. This patch
resolves the problem in the same way as we did for COFF.
Now, if you have a path that you want to open, just call
Driver->addFile(StringRef). That function opens the file and handles
that as if that were given by command line. This function is the
only place we call identify_magic().
llvm-svn: 249023
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This linker script parser and evaluator is powerful enough to read
Linux's libc.so, which is (despite its name) a linker script that
contains OUTPUT_FORMAT, GROUP and AS_NEEDED directives.
The parser implemented in this patch is a recursive-descendent one.
It does *not* construct an AST but consumes directives in place and
sets the results to Symtab object, like what Driver is doing.
This should be very fast since less objects are allocated, and
this is also more readable.
http://reviews.llvm.org/D13232
llvm-svn: 248918
|
|
|
|
| |
llvm-svn: 248873
|
|
|
|
| |
llvm-svn: 248724
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since FreeBSD 4.1, the kernel expects binaries to be marked with
ELFOSABI_FREEBSD in the ELF header to exec() them. LLD unconditionally
sets OSABI to ELF_OSABINONE, and everything linked with it won't run
on FreeBSD (unless explicitly rebranded).
Example:
% ./aarch64-hello
ELF binary type "0" not known.
zsh: exec format error: ./aarch64-hello
FreeBSD could be modified to accept ELF_OSABINONE, but that would break all
existing binaries, so the kernel needs to support both ABINONE and ABIFREEBSD.
I plan to push this change in FreeBSD one day, which, unfortunately, is
not today. This code patches lld so it sets the header field correctly.
For completeness, the rationale of this change is explained in the FreeBSD
commit message, and it's apparently to pleasee binutils maintainers at the time.
https://svnweb.freebsd.org/base?view=revision&revision=59342
Differential Revision: http://reviews.llvm.org/D13140
llvm-svn: 248554
|
|
|
|
| |
llvm-svn: 248502
|
|
|
|
|
|
| |
I will use it in a followup patch.
llvm-svn: 248287
|
|
|
|
| |
llvm-svn: 248229
|
|
|
|
| |
llvm-svn: 248226
|
|
|
|
|
|
|
|
| |
This is more consistent with OutputSection. This is also part of removing
the "Chunk" term from the ELF linker, since we just have input/output sections
and program headers.
llvm-svn: 248183
|
|
|
|
| |
llvm-svn: 248019
|
|
|
|
|
|
|
|
| |
With this a program can call into a shared library with
jmp *foo@GOTPCREL(%rip)
llvm-svn: 247992
|
|
|
|
|
|
| |
Differential Revision: http://reviews.llvm.org/D12944
llvm-svn: 247960
|
|
|
|
|
|
|
|
|
|
| |
Symbol table is now populated correctly, but some fields are missing,
they'll be added in the future. This patch also adds --discard-all
flag, which was the default behavior until now.
Differential Revision: http://reviews.llvm.org/D12874
llvm-svn: 247849
|
|
|
|
|
|
| |
For now we don't create got/plt and only Elf_Rela is supported.
llvm-svn: 247811
|
|
|
|
| |
llvm-svn: 247019
|
|
|
|
| |
llvm-svn: 246886
|
|
|
|
|
|
|
| |
This just adds the types and enough support to detect incompatibilities among
shared libraries and object files.
llvm-svn: 246797
|