[PATCH] D63132: [ELF][RISCV] Set st_shndx of __global_pointer$ to 1 if .sdata does not exist
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 11 07:29:01 PDT 2019
MaskRay marked an inline comment as done.
MaskRay added inline comments.
================
Comment at: test/ELF/riscv-gp.s:14
+
+# SYM0: {{0*}}00000800 0 NOTYPE LOCAL HIDDEN 1 __global_pointer$
+
----------------
jrtc27 wrote:
> Should be GLOBAL DEFAULT to match GNU ld.
glibc/musl Scrt1.o:
```
.option push
.option norelax
lla gp, __global_pointer$ # R_RISCV_PCREL_HI20+R_RISCV_PCREL_LO12_I
.option pop
```
Do you know why `__global_pointer$` is STB_GLOBAL STV_DEFAULT in ld.bfd?
If a shared object can have .sdata and __global_pointer$, and it does the similar `lla` (pc relative) to load gp, I think a hidden symbol makes more sense.
In a shared object, STB_GLOBAL STV_DEFAULT symbols are preemptable by default. The usage of `lla` will imply the symbols are non-preemptable, thus hidden visibility will make more sense.
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63132/new/
https://reviews.llvm.org/D63132
More information about the llvm-commits
mailing list