aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2021-02-17 19:22:25 -0800
committerFangrui Song <i@maskray.me>2021-02-17 19:22:25 -0800
commit58ecfccd0dd3a064a11b1f2eb164cbff7d60faf5 (patch)
tree288bc0f2e7cdbdea27f0a50a2440f842cbc5e26a /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parentc3a3d200932347837283019a3870f185734f702d (diff)
downloadllvm-58ecfccd0dd3a064a11b1f2eb164cbff7d60faf5.zip
llvm-58ecfccd0dd3a064a11b1f2eb164cbff7d60faf5.tar.gz
llvm-58ecfccd0dd3a064a11b1f2eb164cbff7d60faf5.tar.bz2
[profile] Add __attribute__((used)) to zero size dummy sections
D14468 added these dummy sections. This patch adds `__attribute__((used))` so that when compiled by GCC>=11 or (expected, D96838) Clang>=13 on some ELF platforms, these sections will get SHF_GNU_RETAIN to make sure they will not be discarded by ld --gc-sections. We are trying to get rid of LLD's "__start_/__stop_ references retain C identifier name sections" rule. If LLD drops the rule in the future (we will retain compatibility for `__llvm_prf_*` for a while), `__llvm_prf_*` will need to have the SHF_GNU_RETAIN flag, otherwise: ``` // __llvm_prf_cnts/__llvm_prf_data usually exist, but {names,vnds} may not exist. // Such diagnostics will happen with {cnts,data} as well if no input object file is instrumented. % clang++ -fprofile-generate a.cc -fuse-ld=lld -Wl,--gc-sections ld.lld: error: undefined hidden symbol: __start___llvm_prf_names >>> referenced by InstrProfilingPlatformLinux.c >>> InstrProfilingPlatformLinux.c.o:(__llvm_profile_begin_names) in archive /tmp/RelA/lib/clang/13.0.0/lib/linux/libclang_rt.profile-x86_64.a ... ``` Differential Revision: https://reviews.llvm.org/D96902
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
0 files changed, 0 insertions, 0 deletions