hanchenye-llvm-project/lld
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
..
COFF Update documents. 2015-11-20 22:47:42 +00:00
ELF [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support 2015-12-01 21:24:45 +00:00
cmake/modules
docs Update documents. 2015-11-20 22:47:42 +00:00
include/lld [lld][Darwin] Add support for the -sectcreate option. 2015-10-24 08:20:51 +00:00
lib Rename ld.lld2 to ld.lld since it is the default. 2015-11-18 06:11:01 +00:00
test [ELF] MIPS paired R_MIPS_HI16/LO16 relocations support 2015-12-01 21:24:45 +00:00
tools Rename ld.lld2 to ld.lld since it is the default. 2015-11-18 06:11:01 +00:00
unittests Make ELF2 the default. 2015-11-17 07:19:44 +00:00
.arcconfig
.clang-format
.gitignore
CMakeLists.txt [CMake] Don't include the lld test directory if LLVM_INCLUDE_TESTS is Off 2015-10-01 18:17:47 +00:00
CODE_OWNERS.TXT Add initial CODE_OWNERS.TXT file 2015-07-25 00:44:37 +00:00
LICENSE.TXT Update copyright year to 2015. 2015-03-12 20:14:35 +00:00
README.md

README.md

LLVM Linker (lld)

This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.

lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.