summaryrefslogtreecommitdiffstats
path: root/lld/ELF/SymbolTable.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ELF: Make checkCompatibility a non-member function.Rui Ueyama2015-12-161-15/+15
| | | | | | Because the function does not use any member of SymbolTable class. llvm-svn: 255849
* Simplify. NFC.Rui Ueyama2015-12-161-4/+1
| | | | llvm-svn: 255846
* ELF: Remove duplicate code.Rui Ueyama2015-12-161-34/+27
| | | | | | | We had duplicate code that were called before addMemberFile. This patch makes them to be called at beginning of addMemberFile. llvm-svn: 255845
* ELF: Remove SymbolTable::addELFFile.Rui Ueyama2015-12-161-29/+24
| | | | | | | | addELFFile was called only from addFile, and what it did was actually just adding a file to the symbol table. There seems to be no reason to separate the two. llvm-svn: 255839
* Do not omit * from auto.Rui Ueyama2015-12-161-3/+3
| | | | | | We don't do that in other places in the same file. llvm-svn: 255833
* ELF: Drop 'Sym' suffix from member function names for consistency.Rui Ueyama2015-12-161-6/+6
| | | | | | | Since the functions are members of SymbolTable class, it is obvious that they are adding symbols. llvm-svn: 255832
* ELF: Factor out common code. NFC.Rui Ueyama2015-12-161-12/+17
| | | | llvm-svn: 255830
* ELF: Separate error message generation from call of error() or warning().Rui Ueyama2015-12-161-17/+15
| | | | | | | Previously reportConflict returned only when the third argument is false. Now it always returns a value. llvm-svn: 255829
* [ELF][MIPS] Handle R_MIPS_HI16/LO16 relocations against _gp_disp symbolSimon Atanasyan2015-12-161-1/+3
| | | | | | | | | | | | The `_gp_disp` is a magic symbol designates offset between start of function and gp pointer into GOT. Only `R_MIPS_HI16` and `R_MIPS_LO16` relocations are permitted with `_gp_disp`. The patch adds the `_gp_disp` as an ignored symbol and adjusts symbol value before call the `relocateOne` for `R_MIPS_HI16/LO16` relocations. Differential Revision: http://reviews.llvm.org/D15480 llvm-svn: 255768
* [ELF] Prevent SEGFAULT in case of conflict with an internally defined symbol.Igor Kudrin2015-11-191-1/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D14832 llvm-svn: 253588
* [ELF2] Add GOT section for MIPS target.Igor Kudrin2015-11-061-0/+6
| | | | | | | | | | | | | | | This patch implements R_MIPS_GOT16 relocation for global symbols in order to generate some entries in GOT. Only reserved and global entries are supported for now. For the detailed description about GOT in MIPS, see "Global Offset Table" in Chapter 5 in the followin document: ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf In addition, the platform specific symbol "_gp" is added, see "Global Data Symbols" in Chapter 6 in the aforementioned document. Differential revision: http://reviews.llvm.org/D14211 llvm-svn: 252275
* ELF2: Use ELFT to template OutputSections.Rui Ueyama2015-10-151-3/+3
| | | | | | | | | | | | This patch is to use ELFT instead of Is64Bits to template OutputSection and its subclasses. This increases code size slightly because it creates two identical functions for some classes, but that's only 20 KB out of 33 MB, so it's negligible. This is as per discussion with Rafael. He's not fan of the idea but OK with this. We'll revisit later to this topic. llvm-svn: 250466
* ELF2: Implement __start_SECNAME and __stop_SECNAME.Rui Ueyama2015-10-151-0/+6
| | | | | | | | | | If a section name is valid as a C identifier (which is rare because of the leading '.'), linkers are expected to define __start_<secname> and __stop_<secname> symbols. They are at beginning and end of the section, respectively. This is not requested by the ELF standard, but GNU ld and gold provide this feature. llvm-svn: 250432
* Use OutputSectionBase in a few cases where we don't need a OutputSection.Rafael Espindola2015-10-151-3/+3
| | | | | | | NFC. This is just preparation for adding a new OutputSection dedicated to SHF_MERGE input sections. llvm-svn: 250419
* Simplify.Rui Ueyama2015-10-141-6/+2
| | | | llvm-svn: 250337
* ELF2: Add comments.Rui Ueyama2015-10-131-0/+7
| | | | llvm-svn: 250215
* ELF2: Avoid using "finalize" as a function name.Rui Ueyama2015-10-131-7/+8
| | | | | | | | | "finalize" does not give a hint about what that function is actually going to do. This patch make it more specific by renaming scanShlibUndefined. Also add a comment that we basically ignore undefined symbols in DSOs except this function. llvm-svn: 250191
* ELF2: Fix BSD's __progname symbol issue.Rui Ueyama2015-10-131-0/+21
| | | | | | | | | | | | | 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/+1
| | | | | | ELFKind as a type name and ElfKind is a variable name was too subtle. llvm-svn: 250172
* ELF2: Split SymbolTable::addFile(). NFC.Rui Ueyama2015-10-121-11/+17
| | | | llvm-svn: 250073
* Delete getFirstELF.Rafael Espindola2015-10-121-1/+1
| | | | llvm-svn: 250030
* Simplify the InputFile type hierarchy by removing unnecessary middle classses.Rafael Espindola2015-10-121-3/+3
| | | | llvm-svn: 250006
* Simplify the InputFile type hierarchy.Rafael Espindola2015-10-121-8/+9
| | | | | | | Now that the SymbolTable is templated, we don't need the ELFData class or multiple inheritance. llvm-svn: 250005
* Handle a crash in conflict detection with archive members.Rafael Espindola2015-10-111-1/+1
| | | | llvm-svn: 249996
* Detect incompatible files when one of them comes from an archive.Rafael Espindola2015-10-111-0/+12
| | | | llvm-svn: 249968
* ELF2: Move Target and entry initialization from SymbolTable to Driver.Rui Ueyama2015-10-091-49/+10
| | | | | | | | SymbolTable was not a right place for initialization. We had to do that because Driver didn't know what type of ELF objects are being handled. We taught Driver that, so we can now move this code to Driver. llvm-svn: 249904
* ELF2: Make SymbolTable a template class.Rui Ueyama2015-10-091-95/+39
| | | | | | | | | | | | | | | | | | | | | | | SymbolTable was not a template class. Instead we had switch-case-based type dispatch to call desired functions. We had to do that because SymbolTable was created before we know what ELF type objects had been passed. Every time I tried to add a new function to the symbol table, I had to define a dispatcher which consist of a single switch statement. It also brought an restriction what the driver can do. For example, we cannot add undefined symbols before any files are added to the symbol table. That's because no symbols can be added until the symbol table knows the ELF type, but when it knows about that, it's too late. In this patch, the driver makes a decision on what ELF type objects are being handled. Then the driver creates a SymbolTable object for an appropriate ELF type. http://reviews.llvm.org/D13544 llvm-svn: 249902
* Add support for comdats.Rafael Espindola2015-10-091-1/+3
| | | | | | The implementation is a direct translation to c++ of the rules in the ELF spec. llvm-svn: 249881
* [ELF2] Check for TLS mismatch in symbol resolution.Igor Kudrin2015-10-091-4/+10
| | | | | | | | | | | The linker should generate an error if a TLS symbol is resolved for a non-TLS reference and vice versa. The patch addresses PR24244 (https://llvm.org/bugs/show_bug.cgi?id=24244) Differential Revision: http://reviews.llvm.org/D13550 llvm-svn: 249817
* ELF2: Inititalize other symbols only once as well.Rui Ueyama2015-10-081-2/+0
| | | | llvm-svn: 249645
* ELF2: Make member variable names shorter.Rui Ueyama2015-10-081-3/+2
| | | | | | | I'm going to use them in other patches, and the names feel too long despite their narrow scope. llvm-svn: 249642
* ELF2: Initialize SyntheticOptional only once.Rui Ueyama2015-10-071-1/+0
| | | | llvm-svn: 249636
* ELF2: Rename dupError() -> reportConflict().Rui Ueyama2015-10-071-2/+2
| | | | llvm-svn: 249622
* [ELF2] Handle -m optionDenis Protivensky2015-10-071-3/+4
| | | | | | | | | 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
* Create linker generated symbols earlier.Rafael Espindola2015-10-071-0/+1
| | | | | | We were incorrectly deciding that a dynamic relocation was needed for them. llvm-svn: 249512
* [elf2] Correctly determine if we should ignore missing __tls_get_addr.Michael J. Spencer2015-10-061-7/+0
| | | | llvm-svn: 249462
* Never fetch members for weak undefined symbols.Rafael Espindola2015-10-061-0/+6
| | | | | | | | | We were still fetching them when the archive was seen first. We should experiment with just letting lazy symbols get to compare, it might be cleaner for ELF. llvm-svn: 249417
* Avoid recursive calls to init (we would crash).Rafael Espindola2015-10-061-7/+10
| | | | llvm-svn: 249412
* Handle strong undefined symbols fetching members after a weak undefined.Rafael Espindola2015-10-061-1/+14
| | | | | | | | | | This is a case that requires --start-group --end-group with regular ELF linkers. Fortunately it is still possible to handle it with lazy symbols without taking a second look at archives. Thanks to Michael Spencer for the bug report. llvm-svn: 249406
* [elf2] Ignore __tls_get_addr when static linking.Michael J. Spencer2015-10-061-0/+7
| | | | llvm-svn: 249365
* [ELF2] Add --undefined optionDenis Protivensky2015-10-051-1/+24
| | | | | | | | | Add symbol specified with -u as undefined which may cause additional object files from archives to be linked into the resulting binary. Differential Revision: http://reviews.llvm.org/D13345 llvm-svn: 249295
* Weak undefined symbols should not fetch archive members.Rafael Espindola2015-10-021-1/+1
| | | | llvm-svn: 249160
* Still define __init_array_(start|end) if there is no .init_array.Rafael Espindola2015-10-011-4/+13
| | | | | | | This matches the behavior of other linkers and seems necessary to link in some older systems. llvm-svn: 249077
* Simplify instantiation. NFC.Rafael Espindola2015-10-011-12/+8
| | | | llvm-svn: 249074
* Don't include shared libraries multiple times.Rafael Espindola2015-10-011-0/+5
| | | | llvm-svn: 249061
* [ELF2] Add --[no-]whole-archive command line switchesIgor Kudrin2015-10-011-4/+10
| | | | | | | | | | | | | | | | | 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
* [ELF2] Implemented --entry flag.Rui Ueyama2015-09-291-2/+3
| | | | | | Patch from George Rimar! llvm-svn: 248806
* [ELF2] Add initial MIPS supportSimon Atanasyan2015-09-291-1/+4
| | | | | | | | | | Besides a trivial MIPS support the patch introduces new TargetInfo class member getDefaultEntry() to override default name of the entry symbol. MIPS uses __start for that. Differential Revision: http://reviews.llvm.org/D13227 llvm-svn: 248779
* Implement --allow-multiple-definition.Rafael Espindola2015-09-281-2/+7
| | | | | | Patch by George Rimar! llvm-svn: 248733
* [ELF] Sort a list of cases alphabetically for consistency/clarity. NFC.Davide Italiano2015-09-271-6/+6
| | | | llvm-svn: 248680
OpenPOWER on IntegriCloud