aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2021-01-09 16:31:55 -0800
committerFangrui Song <i@maskray.me>2021-01-09 16:31:56 -0800
commite2e82c9983f0dff671dd47d3e256d80faa40e892 (patch)
tree5d4676c40214c489b5711b175bf725c72c254b1d /llvm/lib/CodeGen/MachineBasicBlock.cpp
parentb02eab9058e58782fca32dd8b1e53c27ed93f866 (diff)
downloadllvm-e2e82c9983f0dff671dd47d3e256d80faa40e892.zip
llvm-e2e82c9983f0dff671dd47d3e256d80faa40e892.tar.gz
llvm-e2e82c9983f0dff671dd47d3e256d80faa40e892.tar.bz2
[CodeGenModule] Drop dso_local on function declarations for ELF -fno-pic -fno-direct-access-external-data
ELF -fno-pic sets dso_local on a function declaration to allow direct accesses when taking its address (similar to a data symbol). The emitted code follows the traditional GCC/Clang -fno-pic behavior: an absolute relocation is produced. If the function is not defined in the executable, a canonical PLT entry will be needed at link time. This is similar to a copy relocation and is incompatible with (-Bsymbolic or --dynamic-list linked shared objects / protected symbols in a shared object). This patch gives -fno-pic code a way to avoid such a canonical PLT entry. The FIXME was about a generalization for -fpie -mpie-copy-relocations (now -fpie -fdirect-access-external-data). While we could set dso_local to avoid GOT when taking the address of a function declaration (there is an ignorable difference about R_386_PC32 vs R_386_PLT32 on i386), it likely does not provide any benefit and can just cause trouble, so we don't make the generalization.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions