hanchenye-llvm-project/lld
Fangrui Song 249fde8583 [ELF][ARM][AARCH64][MIPS][PPC] Simplify the logic to create R_*_RELATIVE for absolute relocation types in writable sections
Summary:
Our rule to create R_*_RELATIVE for absolute relocation types were
loose. D63121 made it stricter but it failed to create R_*_RELATIVE for
R_ARM_TARGET1 and R_PPC64_TOC. rLLD363236 worked around that by
reinstating the original behavior for ARM and PPC64.

This patch is an attempt to simplify the logic.

Note, in ld.bfd, R_ARM_TARGET2 --target2=abs also creates
R_ARM_RELATIVE. This seems a very uncommon scenario (moreover,
--target2=got-rel is the default), so I do not implement any logic
related to it.

Also, delete R_AARCH64_ABS32 from AArch64::getDynRel. We don't have
working ILP32 support yet. Allowing it would create an incorrect
R_AARCH64_RELATIVE.

For MIPS, the (if SymbolRel, then RelativeRel) code is to keep its
behavior unchanged.

Note, in ppc64-abs64-dyn.s, R_PPC64_TOC gets an incorrect addend because
computeAddend() doesn't compute the correct address. We seem to have the
wrong behavior for a long time. The important thing seems that a dynamic
relocation R_PPC64_TOC should not be created as the dynamic loader will
error R_PPC64_TOC is not supported.

Reviewers: atanasyan, grimar, peter.smith, ruiu, sfertile, espindola

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D63383

llvm-svn: 363928
2019-06-20 14:00:08 +00:00
..
COFF [PDB] Ignore .debug$S subsections with high bit set 2019-06-18 19:41:25 +00:00
Common [lld] Allow args::getInterger to parse args larger than 2^31-1 2019-06-07 06:05:26 +00:00
ELF [ELF][ARM][AARCH64][MIPS][PPC] Simplify the logic to create R_*_RELATIVE for absolute relocation types in writable sections 2019-06-20 14:00:08 +00:00
MinGW [MinGW] Support the --subsystem=val option in joined form 2019-06-14 17:50:39 +00:00
cmake/modules
docs Add --undefined-glob which is an --undefined with wildcard pattern match 2019-06-14 14:00:59 +00:00
include/lld [lld] Allow args::getInterger to parse args larger than 2^31-1 2019-06-07 06:05:26 +00:00
lib Use llvm::stable_sort 2019-04-23 02:42:06 +00:00
test [ELF][ARM][AARCH64][MIPS][PPC] Simplify the logic to create R_*_RELATIVE for absolute relocation types in writable sections 2019-06-20 14:00:08 +00:00
tools/lld Fix -DBUILD_SHARED_LIBS=on build after r362977 2019-06-11 01:50:58 +00:00
unittests Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
utils Python 2/3 compatibility 2019-03-20 07:42:13 +00:00
wasm [WebAssembly] Fix for discarded init functions 2019-06-07 06:00:46 +00:00
.arcconfig
.clang-format
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +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.

Benchmarking

In order to make sure various developers can evaluate patches over the same tests, we create a collection of self contained programs.

It is hosted at https://s3-us-west-2.amazonaws.com/linker-tests/lld-speed-test.tar.xz

The current sha256 is 10eec685463d5a8bbf08d77f4ca96282161d396c65bd97dc99dbde644a31610f.