llvm-project/lld
Fangrui Song 5b4285d82d [ELF][RISCV] Create dummy .sdata for __global_pointer$ if .sdata does not exist
If .sdata is absent, linker synthesized __global_pointer$ gets a section index of SHN_ABS.
(ld.bfd has a similar issue: binutils PR24678)

Scrt1.o may use `lla gp, __global_pointer$` to reference the symbol PC
relatively. In -pie/-shared mode, lld complains if a PC relative
relocation references an absolute symbol (SHN_ABS) but ld.bfd doesn't:

    ld.lld: error: relocation R_RISCV_PCREL_HI20 cannot refer to lute symbol: __global_pointer$

Let the reference of __global_pointer$ to force creation of .sdata to
fix the problem. This is similar to _GLOBAL_OFFSET_TABLE_, which forces
creation of .got or .got.plt .

Also, change the visibility from STV_HIDDEN to STV_DEFAULT and don't
define the symbol for -shared. This matches ld.bfd, though I don't
understand why it uses STV_DEFAULT.

Reviewed By: ruiu, jrtc27

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

llvm-svn: 363351
2019-06-14 02:14:53 +00:00
..
COFF [lld] Fix type server merging with PDBs without IPI stream 2019-06-12 22:33:16 +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][RISCV] Create dummy .sdata for __global_pointer$ if .sdata does not exist 2019-06-14 02:14:53 +00:00
MinGW [Driver] Look for -m in response files as well 2019-06-10 20:10:10 +00:00
cmake/modules [CMake] Properly conditionalize installation of lld libraries 2018-03-09 13:09:36 +00:00
docs docs: Update partitioning docs now that the feature is fully landed. 2019-06-07 19:23:19 +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][RISCV] Create dummy .sdata for __global_pointer$ if .sdata does not exist 2019-06-14 02:14:53 +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 [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 Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +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.