[PATCH] D73865: [CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition

Peter Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 3 04:14:51 PST 2020


peter.smith added a comment.

If I've understood correctly this would make LLVM more aggressive for PIC relocation models, but perhaps more honest in an inter procedural optimisation context? The code changes look fine to me, I'm wondering if we've discussed this widely enough with the community to work out how to proceed here. For example do we have plan to test -fno-semantic-interposition well enough for it to be relied on. The consensus may already exist, and I don't know enough about it though.



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:845
 
   // If this is not an executable, don't assume anything is local.
   const auto &CGOpts = CGM.getCodeGenOpts();
----------------
I think that this comment needs updating to explain the effect of SemanticInterposition, and maybe the clang default.


================
Comment at: clang/test/CodeGen/aapcs-align.cpp:21
 }
-// CHECK: define void @g0
+// CHECK: define dso_local void @g0
 // CHECK: call void @f0(i32 1, [2 x i32] [i32 6, i32 7]
----------------
I initially thought a triple of arm-none-none-eabi (bare-metal for embedded systems) would have a relocation model of static and hence should have already been dso_local. Thinking about it in more detail the clang-driver will usually pass the relocation model to cc1 so by default the driver is assuming PIC. May be worth pointing that out in your description.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73865/new/

https://reviews.llvm.org/D73865





More information about the cfe-commits mailing list