summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ELF2: Fix BSD's __progname symbol issue.Rui Ueyama2015-10-131-4/+4
| | | | | | | | | | | | | 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
* ELF2: Rename ElfKind -> EKind.Rui Ueyama2015-10-131-2/+2
| | | | | | ELFKind as a type name and ElfKind is a variable name was too subtle. llvm-svn: 250172
* Remove the EKind member variable.Rafael Espindola2015-10-131-4/+4
| | | | | | Now that the base class is templated, it is redundant with the type. llvm-svn: 250139
* Remove explicit Twine instantiation if possible.Rui Ueyama2015-10-121-6/+4
| | | | llvm-svn: 250055
* Early return.Rui Ueyama2015-10-121-13/+13
| | | | llvm-svn: 250054
* ELF2: Move createELFFile() from .h to .cpp.Rui Ueyama2015-10-121-0/+40
| | | | llvm-svn: 250051
* Remove redundant namespace specifiers.Rui Ueyama2015-10-121-9/+9
| | | | llvm-svn: 250050
* Make getStaticELFKind a member function now that we can.Rafael Espindola2015-10-121-2/+2
| | | | llvm-svn: 250031
* Simplify the InputFile type hierarchy by removing unnecessary middle classses.Rafael Espindola2015-10-121-2/+4
| | | | llvm-svn: 250006
* Simplify the InputFile type hierarchy.Rafael Espindola2015-10-121-40/+23
| | | | | | | Now that the SymbolTable is templated, we don't need the ELFData class or multiple inheritance. llvm-svn: 250005
* ELF2: Implement --as-needed.Rui Ueyama2015-10-111-1/+1
| | | | | | | | | | | | | | 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
* Add support for comdats.Rafael Espindola2015-10-091-7/+56
| | | | | | The implementation is a direct translation to c++ of the rules in the ELF spec. llvm-svn: 249881
* Make this test a bit stricter.Rafael Espindola2015-10-081-1/+1
| | | | | | | The only way for SecIndex to be zero in here is for an extended section number to be zero, which would be an error. llvm-svn: 249736
* Add a convenience variable. NFC.Rafael Espindola2015-10-081-3/+3
| | | | llvm-svn: 249682
* [ELF2] Handle -m optionDenis Protivensky2015-10-071-6/+2
| | | | | | | | | 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
* [elf2] Add STB_GNU_UNIQUE support.Michael J. Spencer2015-10-021-0/+1
| | | | llvm-svn: 249193
* Don't crash on files with no symbol table.Rafael Espindola2015-10-011-0/+2
| | | | | | Thanks to Roman Divacky for the test. llvm-svn: 249066
* Don't include shared libraries multiple times.Rafael Espindola2015-10-011-7/+11
| | | | llvm-svn: 249061
* [ELF2] Add --[no-]whole-archive command line switchesIgor Kudrin2015-10-011-2/+20
| | | | | | | | | | | | | | | | | 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
* Copy DT_SONAME to DT_NEEDED.Rafael Espindola2015-10-011-4/+29
| | | | | | | | | 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
* ELF2: Define Driver::addFile() as a one-stop place to open a file.Rui Ueyama2015-10-011-9/+0
| | | | | | | | | | | | | | 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
* ELF2: Add basic linker script support.Rui Ueyama2015-09-301-0/+10
| | | | | | | | | | | | | | | | 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
* Expand `auto` whose real type is not obvious from context.Rui Ueyama2015-09-301-1/+1
| | | | llvm-svn: 248876
* Remove `else` after `return`.Rui Ueyama2015-09-301-4/+3
| | | | llvm-svn: 248875
* Simplify memory management by having ELFData contain a ELFObj.Rafael Espindola2015-09-241-17/+27
| | | | llvm-svn: 248502
* Expose ELFFileBase::getEMachine. NFC.Rafael Espindola2015-09-221-8/+7
| | | | | | I will use it in a followup patch. llvm-svn: 248287
* Remove the Chunk terminology from ELF.Rafael Espindola2015-09-221-8/+7
| | | | llvm-svn: 248229
* Rename Chunks.(h|cpp) to InputSection.(h|cpp). NFC.Rafael Espindola2015-09-221-1/+1
| | | | llvm-svn: 248226
* Rename SectionChunk to InputSection.Rafael Espindola2015-09-211-2/+2
| | | | | | | | 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
* [ELF2] Initial support for local symbols.Davide Italiano2015-09-161-7/+23
| | | | | | | | | | 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
* [lld][elf2] Fix style.Michael J. Spencer2015-09-081-2/+2
| | | | llvm-svn: 247064
* Start adding support for symbols in shared libraries.Rafael Espindola2015-09-081-16/+48
| | | | llvm-svn: 247019
* [elf2] Add basic archive file support.Michael J. Spencer2015-09-041-0/+31
| | | | llvm-svn: 246886
* Avoid gcc warning.Rafael Espindola2015-09-031-0/+1
| | | | llvm-svn: 246811
* [ELF2] Don't allocate more SymbolBodies than needed.Davide Italiano2015-09-031-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D12605 llvm-svn: 246802
* Start adding support for shared libraries.Rafael Espindola2015-09-031-13/+45
| | | | | | | This just adds the types and enough support to detect incompatibilities among shared libraries and object files. llvm-svn: 246797
* Split out the ELF kind from the InputFile Kind.Rafael Espindola2015-09-021-1/+1
| | | | | | | | | There were at least two issues with having them together: * For compatibility checks, we only want to look at the ELF kind. * Adding support for shared libraries should introduce one InputFile kind, not 4. llvm-svn: 246707
* Start adding support for common symbols.Rafael Espindola2015-08-281-5/+9
| | | | | | For now this just recognizes the special section number. llvm-svn: 246332
* Add support for weak absolute symbols.Rafael Espindola2015-08-281-4/+1
| | | | | | | On ELF being weak is independent of what we call the kind of the symbol. So this also makes the code simpler. llvm-svn: 246326
* [elf2] Add basic relocation support for x86-64.Michael J. Spencer2015-08-271-2/+11
| | | | | | | | This currently doesn't handle local symbols. Differential Revision: http://reviews.llvm.org/D11612 llvm-svn: 246234
* Start adding support for absolute symbols.Rafael Espindola2015-08-271-0/+3
| | | | llvm-svn: 246147
* Diagnose symbols with invalid section indexes.Rafael Espindola2015-08-241-0/+4
| | | | llvm-svn: 245884
* Add support for reading files with more than 0xff00 sections.Rafael Espindola2015-08-241-1/+11
| | | | llvm-svn: 245880
* Start recording the section of symbols in the symbol table.Rafael Espindola2015-08-241-5/+7
| | | | | | Support for more than 64 K sections to follow shortly. llvm-svn: 245868
* ELF: Also record the type of undefined symbols.Rafael Espindola2015-08-141-2/+2
| | | | | | | Tested with a weak undefined. Testing with a plain undefined will have to wait for support for -shared. llvm-svn: 245069
* Add the type of the symbols to the symbol table.Rafael Espindola2015-08-141-2/+2
| | | | | | | For now only defined symbols are covered. I will add undefined ones in the next patch. llvm-svn: 245057
* Include non-alloca sections in the link.Rafael Espindola2015-08-131-4/+10
| | | | llvm-svn: 244895
* Fix mismatched sign comparisonReid Kleckner2015-08-111-1/+1
| | | | llvm-svn: 244653
* Add support for weak undefined symbols.Rafael Espindola2015-08-111-1/+2
| | | | llvm-svn: 244640
* Remove unused templating.Rafael Espindola2015-08-111-2/+2
| | | | llvm-svn: 244639
OpenPOWER on IntegriCloud