summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* [Mips] Fix the bug -- symbol referred by the R_MIPS_TLS_GD relocationSimon Atanasyan2014-06-111-1/+1
| | | | | | does not get an entry in the dynamic symbol table. llvm-svn: 210648
* [ELF] Fix typo in the type name of the range-based loop item.Simon Atanasyan2014-06-101-1/+1
| | | | | | No functional changes. llvm-svn: 210531
* [Mips] Handle Mips TLS relocations R_MIPS_TLS_GOTTPREL / R_MIPS_TLS_GD / ↵Simon Atanasyan2014-06-077-27/+168
| | | | | | R_MIPS_TLS_LDM etc. llvm-svn: 210394
* Initial set of MakefilesIain Sandoe2014-06-046-0/+97
| | | | | | | | This provides support for the autoconfing & make build style. The format, style and implementation follows that used within the llvm and clang projects. TODO: implement out-of-source documentation builds. llvm-svn: 210177
* [Mips] Implement .{ctors,dtors}.<priority> sections ordering.Simon Atanasyan2014-06-015-0/+119
| | | | | | | | | | | | | Arrange .ctors/.dtors sections in the following order: .ctors from crtbegin.o or crtbegin?.o .ctors from regular object files .ctors.* (sorted) from regular object files .ctors from crtend.o or crtend?.o This order is specific for MIPS traget. For example, on X86 the .ctors.* sections are merged into the .init_array section. llvm-svn: 209987
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-3118-38/+38
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209948
* [ELF] Fix incorrect sorting of .init_array / .fini_array sections.Simon Atanasyan2014-05-301-15/+29
| | | | | | | | | | | | | | | | | | | | | | The main problem is in the predicate passed to the `std::stable_sort()`. This predicate always returns false if **both** section's names do not start with `.init_array` or `.fini_array` prefixes. In short, it does not define a strict weak orderng. Suppose we have the following sections: .A .init_array.1 .init_array.2 The predicate states that: not .init_array.1 < .A not .A < .init_array.2 but .init_array.1 < .init_array.2 !!! The second problem is that `.init_array` section without number should go last in the list. Not it has the lowest priority '0' and goes first. The patch fixes both of the problems. llvm-svn: 209875
* [Mips] Do not mix _gp and _gp_disp symbols in relocation handling.Simon Atanasyan2014-05-282-14/+22
| | | | | | No functional changes. llvm-svn: 209709
* [Mips] Handle relocations against __gnu_local_gp symbol.Simon Atanasyan2014-05-271-0/+2
| | | | llvm-svn: 209644
* [Mips] Do not count global GOT entries using the separate variable. UseSimon Atanasyan2014-05-261-10/+4
| | | | | | size of global GOT entries map for that. llvm-svn: 209616
* [Mips] Reduce code duplication. Join relocation handling functions whichSimon Atanasyan2014-05-251-15/+6
| | | | | | perform calculations for R_MIPS_GOT16 and R_MIPS_CALL16 relocations. llvm-svn: 209594
* [Mips] Factor out the code assign a value to the absolute atom into theSimon Atanasyan2014-05-251-11/+9
| | | | | | separate function. llvm-svn: 209593
* [Mips] Factor out the code create Mips specific runtime file intoSimon Atanasyan2014-05-253-28/+13
| | | | | | the MipsELFWriters member function. llvm-svn: 209592
* [Mips] Remove unused class member declaration.Simon Atanasyan2014-05-251-3/+0
| | | | llvm-svn: 209591
* [Mips] Reduce code duplication. Join relocation handling functions whichSimon Atanasyan2014-05-251-18/+8
| | | | | | perform similar calculations. llvm-svn: 209590
* [Mips] Handle R_MIPS_TLS_TPREL_HI16 / R_MIPS_TLS_TPREL_LO16 relocations.Simon Atanasyan2014-05-244-20/+64
| | | | llvm-svn: 209582
* Move alias symbols from ELFLinkingContext to LinkingContext.Rui Ueyama2014-05-221-75/+0
| | | | | | | | | | Alias symbols are SimpleDefinedAtoms and are platform neutral. They don't have to belong ELF. This patch is to make it available to all platforms. No functionality change intended. Differential Revision: http://reviews.llvm.org/D3862 llvm-svn: 209475
* [Mips] Simplify handling of R_MIPS_LO16 / R_MIPS_HI16 relocationsSimon Atanasyan2014-05-211-8/+8
| | | | | | against _gp_disp symbol. llvm-svn: 209315
* Fix typosAlp Toker2014-05-201-1/+1
| | | | llvm-svn: 209213
* [Mips] Show warning if the linker cannot find a pair for a R_MIPS_HI16Simon Atanasyan2014-05-191-4/+6
| | | | | | | relocation. In fact this case violates ABI but sometimes compilers might produce such code. llvm-svn: 209153
* [Mips] Fix calculation of initial GOT entry value when this entry isSimon Atanasyan2014-05-171-1/+1
| | | | | | referenced by a local symbol. llvm-svn: 209063
* [ELF] Emit DT_TEXTREL dynamic table flag.Simon Atanasyan2014-05-131-0/+16
| | | | | | | | | | | | | | If one or more dynamic relocation might modify a read-only section, dynamic table should contain DT_TEXTREL tag. The patch introduces new `RelocationTable::canModifyReadonlySection()` method. This method checks through the relocations to see if any modifies a read-only section. The DynamicTable class calls this method and emits the DT_TEXTREL tag if necessary. The patch reviewed by Rui Ueyama and Shankar Easwaran. llvm-svn: 208670
* Re-submit r207884: Remove dead codeRui Ueyama2014-05-051-7/+0
| | | | | | Differential Revision: http://reviews.llvm.org/D3599 llvm-svn: 207989
* [ELF] Use a range based access to the ELFFile's sections collection.Simon Atanasyan2014-05-052-24/+19
| | | | | | No functional changes. llvm-svn: 207953
* [Mips] R_MIPS_GPREL32 relocation support.Simon Atanasyan2014-05-054-5/+103
| | | | llvm-svn: 207949
* Revert "Remove dead code."Rui Ueyama2014-05-021-0/+7
| | | | | | This reverts commit r207884 which was prematurely committed by accident. llvm-svn: 207886
* Remove dead code.Rui Ueyama2014-05-021-7/+0
| | | | | | | | | | | | | | | isAlias always returns false and no one is using it. It was originally added Atom to query if an atom is an alias for another atom, assuming that alias atoms are different from normal atoms. We now support atom aliasing, but the way that's implemented is in a different way than what isAlias assumed. An alias atom is just a regular defined atom with no content, and it has a layout- before edge to alias-to atom so that they are layed out at the same location in the result. So this is dead code, and it doesn't make much sense to keep it. llvm-svn: 207884
* [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
OpenPOWER on IntegriCloud