hanchenye-llvm-project/lld
Ali Tamur 63830b2794 Introduce a flag to warn when ifunc symbols are used with text relocations.
Summary:
This patch adds a new flag, --warn-ifunc-textrel, to work around a glibc bug. When a code with ifunc symbols is used to produce an object file with text relocations, lld always succeeds. However, if that object file is linked using an old version of glibc, the resultant binary just crashes with segmentation fault when it is run (The bug is going to be corrected as of glibc 2.19).

Since there is no way to tell beforehand what library the object file will be linked against in the future, there does not seem to be a fool-proof way for lld to give an error only in cases where the binary will crash. So, with this change (dated 2018-09-25), lld starts to give a warning, contingent on a new command line flag that does not have a gnu counter part. The default value for --warn-ifunc-textrel is false, so lld behaviour will not change unless the user explicitly asks lld to give a warning. Users that link with a glibc library with version 2.19 or newer, or does not use ifunc symbols, or does not generate object files with text relocations do not need to take any action. Other users may consider to start passing warn-ifunc-textrel to lld to get early warnings.

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: grimar, MaskRay, markj, emaste, arichardson, llvm-commits

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

llvm-svn: 343628
2018-10-02 20:30:22 +00:00
..
COFF [COFF] In MinGW mode, ignore relocations against a discarded section 2018-09-30 18:31:03 +00:00
Common Allow later -z name=<int> args to override earlier args 2018-09-26 20:50:39 +00:00
ELF Introduce a flag to warn when ifunc symbols are used with text relocations. 2018-10-02 20:30:22 +00:00
MinGW [MinGW] Hook up the --require-defined option to -include: 2018-09-10 17:41:40 +00:00
cmake/modules [CMake] Properly conditionalize installation of lld libraries 2018-03-09 13:09:36 +00:00
docs Introduce a flag to warn when ifunc symbols are used with text relocations. 2018-10-02 20:30:22 +00:00
include/lld Add paretntheses around a C macro parameter. 2018-09-20 18:24:19 +00:00
lib MachO: Change getString16() back to inline function 2018-09-07 15:51:52 +00:00
test Introduce a flag to warn when ifunc symbols are used with text relocations. 2018-10-02 20:30:22 +00:00
tools/lld Fix typo in error message. NFC. 2018-09-13 15:37:13 +00:00
unittests [Darwin] Use errorHandler from liblldCommon 2018-06-12 02:34:04 +00:00
utils
wasm [WebAssembly] Preserve function signatures during LTO 2018-09-28 16:50:14 +00:00
.arcconfig [lld] Set up .arcconfig to point to new Diffusion LLD repository 2017-12-06 20:56:23 +00:00
.clang-format
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
LICENSE.TXT Update copyright year to 2018. 2018-06-18 12:22:17 +00:00
README.md Note that the test .tar.xz has been updated. 2017-12-22 19:37:32 +00:00

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.