From: Rafael Espindola Date: Thu, 22 Mar 2018 18:03:13 +0000 (+0000) Subject: Set dso_local on builtin functions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48f819f244e462e1ff8717f0e37d8738e83aa35d;p=clang Set dso_local on builtin functions. The difference between CreateRuntimeFunction and CreateBuiltinFunction is that CreateBuiltinFunction would not set dllimport or dso_local. To keep the current semantics, just forward to CreateRuntimeFunction with Local=true so it doesn't add dllimport. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328224 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index e7efd410db..2748dc3422 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -2640,13 +2640,7 @@ CodeGenModule::CreateRuntimeFunction(llvm::FunctionType *FTy, StringRef Name, llvm::Constant * CodeGenModule::CreateBuiltinFunction(llvm::FunctionType *FTy, StringRef Name, llvm::AttributeList ExtraAttrs) { - llvm::Constant *C = - GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(), /*ForVTable=*/false, - /*DontDefer=*/false, /*IsThunk=*/false, ExtraAttrs); - if (auto *F = dyn_cast(C)) - if (F->empty()) - F->setCallingConv(getRuntimeCC()); - return C; + return CreateRuntimeFunction(FTy, Name, ExtraAttrs, true); } /// isTypeConstant - Determine whether an object of this type can be emitted diff --git a/test/CodeGen/mingw-long-double.c b/test/CodeGen/mingw-long-double.c index 5dcd9a8bcd..6026c24b36 100644 --- a/test/CodeGen/mingw-long-double.c +++ b/test/CodeGen/mingw-long-double.c @@ -42,6 +42,6 @@ long double _Complex TestLDC(long double _Complex x) { // GNU64: define dso_local void @TestLDC({ x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* %x) // MSC64: define dso_local void @TestLDC({ double, double }* noalias sret %agg.result, { double, double }* %x) -// GNU32: declare void @__mulxc3 -// GNU64: declare void @__mulxc3 -// MSC64: declare void @__muldc3 +// GNU32: declare dso_local void @__mulxc3 +// GNU64: declare dso_local void @__mulxc3 +// MSC64: declare dso_local void @__muldc3