summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-06-14 02:14:53 +0000
committerFangrui Song <maskray@google.com>2019-06-14 02:14:53 +0000
commit5b4285d82ded14b5f486df39fbef6aacdfbd8659 (patch)
tree958e3bddde8e08f49d826bce76db284ffb803391 /clang/lib/CodeGen/CGDecl.cpp
parentd54d4f990592bfcc9d6cdccc2eb086c83bfbaa3a (diff)
downloadbcm5719-llvm-5b4285d82ded14b5f486df39fbef6aacdfbd8659.tar.gz
bcm5719-llvm-5b4285d82ded14b5f486df39fbef6aacdfbd8659.zip
[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
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud