hanchenye-llvm-project/lld/ELF
Simon Atanasyan 09b3e3685f [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support
Some MIPS relocations including `R_MIPS_HI16/R_MIPS_LO16` use combined
addends. Such addend is calculated using addends of both paired relocations.
Each `R_MIPS_HI16` relocation is paired with the next `R_MIPS_LO16`
relocation. ABI requires to compute such combined addend in case of REL
relocation record format only.

For details see p. 4-17 at
ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf

This patch implements lookup of the next paired relocation suing new
`InputSectionBase::findPairedRelocLocation` method. The primary
disadvantage of this approach is that we put MIPS specific logic into
the common code. The next disadvantage is that we lookup `R_MIPS_LO16`
for each `R_MIPS_HI16` relocation, while in fact multiple `R_MIPS_HI16`
might be paired with the single `R_MIPS_LO16`. From the other side
this way allows us to keep `MipsTargetInfo` class stateless and implement
later relocation handling in parallel.

This patch does not support `R_MIPS_HI16/R_MIPS_LO16` relocations against
`_gp_disp` symbol. In that case the relocations use a special formula for
the calculation. That will be implemented later.

Differential Revision: http://reviews.llvm.org/D15112

llvm-svn: 254461
2015-12-01 21:24:45 +00:00
..
CMakeLists.txt ELF2: Implement --gc-sections. 2015-10-22 18:49:53 +00:00
Config.h Revert "ELF: Make .note.GNU-stack more compatible with traditional linkers." 2015-11-24 18:48:16 +00:00
Driver.cpp ELF: Improve error handling of unknown emulation names. 2015-11-24 18:55:36 +00:00
Driver.h Simplify the InputFile type hierarchy. 2015-10-12 01:55:32 +00:00
DriverUtils.cpp Update lld to match llvm r250901. OptTable constructor now takes an ArrayRef. NFC 2015-10-21 16:31:56 +00:00
Error.cpp [ELF2] Output of all unknown arguments instead of only one. 2015-09-24 18:55:33 +00:00
Error.h [ELF2] Output of all unknown arguments instead of only one. 2015-09-24 18:55:33 +00:00
InputFiles.cpp Revert "ELF: Make .note.GNU-stack more compatible with traditional linkers." 2015-11-24 18:48:16 +00:00
InputFiles.h Make a function out-of-line. 2015-11-20 02:10:52 +00:00
InputSection.cpp [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support 2015-12-01 21:24:45 +00:00
InputSection.h [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support 2015-12-01 21:24:45 +00:00
LinkerScript.cpp [ELF] Lookup INPUT argument in the current directory 2015-11-26 20:23:46 +00:00
MarkLive.cpp Early continue. NFC. 2015-11-12 19:45:58 +00:00
Options.td Define -E as an alias for --export-dynamic. 2015-11-20 21:22:53 +00:00
OutputSections.cpp [ELF] - Fixed bug leading to miss of tls relocation when @tlsgd and @gottpoff relocations were used at the same time. 2015-12-01 19:20:26 +00:00
OutputSections.h [ELF] - Fixed bug leading to miss of tls relocation when @tlsgd and @gottpoff relocations were used at the same time. 2015-12-01 19:20:26 +00:00
README.md ELF2: Add a note about performance. 2015-10-13 21:28:02 +00:00
SymbolTable.cpp [ELF] Prevent SEGFAULT in case of conflict with an internally defined symbol. 2015-11-19 19:08:45 +00:00
SymbolTable.h [ELF2] Add GOT section for MIPS target. 2015-11-06 07:43:03 +00:00
Symbols.cpp [ELF] Define symbols "_end" and "end" if referenced. 2015-11-20 02:32:35 +00:00
Symbols.h [ELF] - Fixed bug leading to miss of tls relocation when @tlsgd and @gottpoff relocations were used at the same time. 2015-12-01 19:20:26 +00:00
Target.cpp [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support 2015-12-01 21:24:45 +00:00
Target.h [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support 2015-12-01 21:24:45 +00:00
Writer.cpp [ELF] - Fixed bug leading to miss of tls relocation when @tlsgd and @gottpoff relocations were used at the same time. 2015-12-01 19:20:26 +00:00
Writer.h ELF2: Implement --gc-sections. 2015-10-22 18:49:53 +00:00

README.md

The New ELF Linker

This directory contains a port of the new PE/COFF linker for ELF.

Overall Design

See COFF/README.md for details on the design. Note that unlike COFF, we do not distinguish chunks from input sections; they are merged together.

Capabilities

This linker can link LLVM and Clang on Linux/x86-64 or FreeBSD/x86-64 with -LLVM_ENABLE_THREADS=OFF. "Hello world" can be linked on Linux/PPC64.

Performance

Achieving good performance is one of our goals. It's too early to reach a conclusion, but we are optimistic about that as it currently seems to be faster than GNU gold. It will be interesting to compare when we are close to feature parity.