[all-commits] [llvm/llvm-project] 9d55e4: Make explicit -fno-semantic-interposition (in -fpi...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon May 25 20:50:41 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9d55e4ee1367b440bb8402ce3a33d5a8b99aee06
      https://github.com/llvm/llvm-project/commit/9d55e4ee1367b440bb8402ce3a33d5a8b99aee06
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-05-25 (Mon, 25 May 2020)

  Changed paths:
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/test/CodeGen/semantic-interposition.c
    M clang/test/Driver/fsemantic-interposition.c
    M llvm/include/llvm/IR/GlobalValue.h
    M llvm/include/llvm/IR/Module.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/IR/Globals.cpp
    M llvm/lib/IR/Module.cpp
    M llvm/lib/Target/TargetMachine.cpp
    A llvm/test/CodeGen/X86/semantic-interposition-infer-dsolocal.ll

  Log Message:
  -----------
  Make explicit -fno-semantic-interposition (in -fpic mode) infer dso_local

-fno-semantic-interposition is currently the CC1 default. (The opposite
disables some interprocedural optimizations.) However, it does not infer
dso_local: on most targets accesses to ExternalLinkage functions/variables
defined in the current module still need PLT/GOT.

This patch makes explicit -fno-semantic-interposition infer dso_local,
so that PLT/GOT can be eliminated if targets implement local aliases
for AsmPrinter::getSymbolPreferLocal (currently only x86).

Currently we check whether the module flag "SemanticInterposition" is 0.
If yes, infer dso_local. In the future, we can infer dso_local unless
"SemanticInterposition" is 1: frontends other than clang will also
benefit from the optimization if they don't bother setting the flag.
(There will be risks if they do want ELF interposition: they need to set
"SemanticInterposition" to 1.)




More information about the All-commits mailing list