summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF
Commit message (Collapse)AuthorAgeFilesLines
* [ELF] Fix the file look up algorithm used in the linker script GROUP command.Simon Atanasyan2014-05-011-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | In general the linker scripts's GROUP command works like a pair of command line options --start-group/--end-group. But there is a difference in the files look up algorithm. The --start-group/--end-group commands use a trivial approach: a) If the path has '-l' prefix, add 'lib' prefix and '.a'/'.so' suffix and search the path through library search directories. b) Otherwise, use the path 'as-is'. The GROUP command implements more compicated approach: a) If the path has '-l' prefix, add 'lib' prefix and '.a'/'.so' suffix and search the path through library search directories. b) If the path does not have '-l' prefix, and sysroot is configured, and the path starts with the / character, and the script being processed is located inside the sysroot, search the path under the sysroot. Otherwise, try to open the path in the current directory. If it is not found, search through library search directories. https://www.sourceware.org/binutils/docs-2.24/ld/File-Commands.html The patch reviewed by Shankar Easwaran, Rui Ueyama. llvm-svn: 207769
* [ELF] Return result from the function ASAP.Simon Atanasyan2014-04-301-16/+6
| | | | | | No functional changes. llvm-svn: 207690
* [ELF] Factor out the code builds a library search directory pathSimon Atanasyan2014-04-301-14/+12
| | | | | | | | into the separate function. No functional changes. llvm-svn: 207689
* [Mips] Re-order include headers.Simon Atanasyan2014-04-291-3/+1
| | | | llvm-svn: 207495
* [Mips] Implement emitting of R_MIPS_REL32 relocations:Simon Atanasyan2014-04-297-25/+269
| | | | | | | | | | | | | 1. Re-implement PLT entries and dynamic relocations emitting to keep PLT and relocations table in a consistent state. 2. Initialize st_value and st_other fields for dynamic symbols table entry if this entry corresponds to an external function which address is taken in a non-PIC executable. In that case the st_value field holds an address of the function's PLT entry. Also set STO_MIPS_PLT bit in the st_other field. llvm-svn: 207494
* [Mips] 80 column.Simon Atanasyan2014-04-291-2/+6
| | | | llvm-svn: 207493
* [Mips] Convert MipsDynamicSymbolTable to the class template.Simon Atanasyan2014-04-283-10/+14
| | | | llvm-svn: 207435
* [Mips] Add the 'const' qualifier to the couple RelocationPass classSimon Atanasyan2014-04-281-4/+4
| | | | | | member functions. llvm-svn: 207434
* [ELF] Fix GNU_RELRO section name.Rui Ueyama2014-04-181-1/+1
| | | | llvm-svn: 206560
* [ELF] Support --defsym=<symbol>=<symbol>.Rui Ueyama2014-04-161-0/+75
| | | | | | | | | | | | | | | | | | | | | Currently LLD supports --defsym only in the form of --defsym=<symbol>=<integer>, where the integer is interpreted as the absolute address of the symbol. This patch extends it to allow other symbol name to be given as an RHS value. If a RHS value is a symbol name, the LHS symbol will be defined as an alias for the RHS symbol. Internally, a LHS symbol is represented as a zero-size defined atom who has an LayoutAfter reference to an undefined atom, whose name is the RHS value. Everything else is already implemented -- Resolver will resolve the undefined symbol, and the layout pass will layout the two atoms at the same location. Looks like it's working fine. Note that GNU LD supports --defsym=<symbol>=<symbol>+<addend>. That feature is out of scope of this patch. Differential Revision: http://reviews.llvm.org/D3332 llvm-svn: 206417
* [Mips] Emit PLT entries for more static relocations.Simon Atanasyan2014-04-161-6/+18
| | | | llvm-svn: 206358
* [ELF] Regroup code creates ELF relocations references ELFReference intoSimon Atanasyan2014-04-123-118/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a couple of new virtual functions. Follow-up to the rL203408. Two virtual functions `createRelocationReference()` responsible for creation of `ELFReference` have been replaced by a couple of new virtual functions `createRelocationReferences()` (plural). Each former function creates a //single// ELFReference for a specified `Elf_Rela` or `Elf_Rel` relocation records. The new functions responsible for creation of //all// relocation references for provided symbol. For all targets except MIPS there are no functional changes. MIPS ABI has a notion of //paired// relocations. An effective addend of such relocations are calculated using addends of both pair's members. Each `R_MIPS_HI16` and `R_MIPS_GOT16` (for local symbols) relocations must have an associated `R_MIPS_LO16` entry immediately following it in the list of relocations. Immediately does not mean "next record" in relocations section but "next record referenced the same symbol". Moreover a single `R_MIPS_LO16` relocation can be paired with multiple preceding `R_MIPS_HI16/R_MIPS_GOT16` relocations. The paired relocation can have offsets belong to the different symbols. That is why we need to have access to list of all relocations during construction of `ELFReference` for MIPS target. The patch reviewed by Shankar Easwaran. llvm-svn: 206102
* [Mips] Factor out MIPS relocation addend reading to the separateSimon Atanasyan2014-04-111-8/+12
| | | | | | | | function. No functional changes. llvm-svn: 206023
* [ELF] Remove redundant conversion of section content from ArrayRef toSimon Atanasyan2014-04-111-8/+3
| | | | | | | | | StringRef before calling the createSectionAtom() method and reverse conversion inside the method. No functional changes. llvm-svn: 206022
* [Mips] R_MIPS_PC32 relocation support.Simon Atanasyan2014-04-114-0/+12
| | | | llvm-svn: 206018
* [ELF] Use typedefs to make class field declarations shorter.Simon Atanasyan2014-04-061-7/+4
| | | | | | No functional changes. llvm-svn: 205692
* [X86-64] Add missing relocation.Michael J. Spencer2014-04-041-1/+1
| | | | llvm-svn: 205645
* This is yet another case clang-modernize failed to add "override".Rui Ueyama2014-04-041-6/+3
| | | | llvm-svn: 205644
* Fix comments.Rui Ueyama2014-04-034-5/+5
| | | | llvm-svn: 205568
* [ELF] Add "override" and remove "virtual".Rui Ueyama2014-03-2818-281/+224
| | | | llvm-svn: 205056
* Attempt to unbreak buildbots.Rui Ueyama2014-03-281-1/+1
| | | | llvm-svn: 205034
* [ELF] Support --defsym option to define an absolute symbol.Rui Ueyama2014-03-281-1/+30
| | | | | | | | | | | | | | | | | This patch is to support --defsym option for ELF file format/GNU-compatible driver. Currently it takes a symbol name followed by '=' and a number. If such option is given, the driver sets up an absolute symbol with the specified address. You can specify multiple --defsym options to define multiple symbols. GNU LD's --defsym provides many more features. For example, it allows users to specify another symbol name instead of a number to define a symbol alias, or it even allows a symbol plus an offset (e.g. --defsym=foo+3) to define symbol- relative alias. This patch does not support that, but will be supported in subsequent patches. Differential Revision: http://llvm-reviews.chandlerc.com/D3208 llvm-svn: 205029
* Fix format.Rui Ueyama2014-03-281-1/+1
| | | | llvm-svn: 204989
* [ELF] Remove class declarations that do nothing.Rui Ueyama2014-03-281-76/+0
| | | | | | | These classes are declared in a .cpp file but not used in the same compliation unit. They seems to have been copy-and-pasted from ELFReader.h. llvm-svn: 204988
* Make anonymous namespace as small as possible.Rui Ueyama2014-03-272-27/+22
| | | | llvm-svn: 204982
* [Mips] Fix formatting.Simon Atanasyan2014-03-241-1/+1
| | | | llvm-svn: 204607
* [Mips] Sort R_MIPS_LO16 / R_MIPS_HI16 / R_MIPS_GOT16 before findingSimon Atanasyan2014-03-241-9/+29
| | | | | | pairs and calculate AHL addend. llvm-svn: 204606
* [Mips] Emit LA25 MIPS stubs to call pic code from non-pic routines.Simon Atanasyan2014-03-212-22/+137
| | | | llvm-svn: 204503
* [Mips] Fix source code formatting. No functional changes.Simon Atanasyan2014-03-211-11/+11
| | | | llvm-svn: 204472
* [Mips] Reduce the number of 'const' casts.Simon Atanasyan2014-03-201-14/+14
| | | | llvm-svn: 204355
* [Mips] Join two for loops over defined atoms into the single one.Simon Atanasyan2014-03-201-4/+3
| | | | llvm-svn: 204354
* [Mips] Remove the dead code.Simon Atanasyan2014-03-201-4/+0
| | | | llvm-svn: 204353
* [Mips] Remove unused member function argument.Simon Atanasyan2014-03-201-4/+3
| | | | llvm-svn: 204352
* Revert "[ELF] Order DT_NEEDED entries by command line order."Rui Ueyama2014-03-201-22/+5
| | | | | | This reverts commit r204291 because it broke buildbots. llvm-svn: 204317
* [ELF] Order DT_NEEDED entries by command line order.Michael J. Spencer2014-03-201-5/+22
| | | | | | With this all test-suite tests pass with lld on x86-64 Linux. llvm-svn: 204291
* [Mips] Remove unused function.Simon Atanasyan2014-03-191-7/+0
| | | | llvm-svn: 204248
* [Mips] Fix handling of R_MIPS_GOT16 relocation and building local partSimon Atanasyan2014-03-195-9/+29
| | | | | | | | | of GOT. * Read addend for R_MIPS_GOT16 relocation. * Put only high 16 bits of symbol + addend into GOT entries for locally visible symbols. llvm-svn: 204247
* [Mips] Handle R_MIPS_GOT16 relocation for external and local symbols inSimon Atanasyan2014-03-194-9/+0
| | | | | | a uniform way. llvm-svn: 204246
* [Mips] Factor out the code creates GOT entry atoms into the twoSimon Atanasyan2014-03-191-16/+36
| | | | | | | functions. The first one is for local GOT entries. The second one is for global GOT entries. llvm-svn: 204245
* [Mips] Add 'const' qualifier to the function.Simon Atanasyan2014-03-191-2/+2
| | | | llvm-svn: 204244
* [Mips] Move AHL addends calculation to the RelocationPass class.Simon Atanasyan2014-03-193-67/+46
| | | | llvm-svn: 204243
* [Mips] Move RelocationPass class member function definitions out of theSimon Atanasyan2014-03-191-197/+215
| | | | | | class. llvm-svn: 204242
* [ELF] Remove unused fields (linking context references).Simon Atanasyan2014-03-195-15/+9
| | | | llvm-svn: 204222
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-135-5/+7
| | | | | | | | This results in some simplifications to the code where an OwningPtr had to be used with the previous api and then ownership moved to a unique_ptr for the rest of lld. llvm-svn: 203809
* [docs] Add some more information on missing relocations.Michael J. Spencer2014-03-131-7/+30
| | | | llvm-svn: 203744
* [ELF] Fix MSVC warning on conversion from enum to bool.Rui Ueyama2014-03-121-2/+1
| | | | | | | This function returns a boolean value, so returning STT_COMMON does not make sense. llvm-svn: 203731
* [Cleanup] Sort includes.Ahmed Charles2014-03-122-5/+5
| | | | llvm-svn: 203666
* [Mips] Fix addendum reading for R_MIPS_26 relocation.Simon Atanasyan2014-03-091-1/+1
| | | | llvm-svn: 203412
* [Mips] Fix addendum reading for R_MIPS_32 relocation.Simon Atanasyan2014-03-091-3/+13
| | | | llvm-svn: 203411
* [Mips] Fix addendum reading for R_MIPS_HI16 / R_MIPS_LO16 relocations.Simon Atanasyan2014-03-091-0/+17
| | | | llvm-svn: 203410
OpenPOWER on IntegriCloud