From fd09f12f32f57564d619a28b8826d33ade47b12e Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Thu, 16 Jan 2020 11:56:41 +0100 Subject: Implement -fsemantic-interposition First attempt at implementing -fsemantic-interposition. Rely on GlobalValue::isInterposable that already captures most of the expected behavior. Rely on a ModuleFlag to state whether we should respect SemanticInterposition or not. The default remains no. So this should be a no-op if -fsemantic-interposition isn't used, and if it is, isInterposable being already used in most optimisation, they should honor it properly. Note that it only impacts architecture compiled with -fPIC and no pie. Differential Revision: https://reviews.llvm.org/D72829 --- clang/lib/Frontend/CompilerInvocation.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index a8dfd8a..335f8cd 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3036,6 +3036,10 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.setDefaultCallingConv(DefaultCC); } + // -fsemantic-interposition + Opts.SemanticInterposition = + Args.hasArg(OPT_fsemantic_interposition) && Opts.PICLevel && !Opts.PIE; + // -mrtd option if (Arg *A = Args.getLastArg(OPT_mrtd)) { if (Opts.getDefaultCallingConv() != LangOptions::DCC_None) -- cgit v1.1