r359251 - Revert [COFF] Statically link certain runtime library functions

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 16:30:41 PDT 2019


Author: rnk
Date: Thu Apr 25 16:30:41 2019
New Revision: 359251

URL: http://llvm.org/viewvc/llvm-project?rev=359251&view=rev
Log:
Revert [COFF] Statically link certain runtime library functions

This reverts r359250 (git commit 4730604bd3a361c68b92b18bf73a5daa15afe9f4)

The newly added test should use -cc1 and -emit-llvm and there are other
test failures that need fixing.

Removed:
    cfe/trunk/test/CodeGen/ms-symbol-linkage.cpp
Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp
    cfe/trunk/test/CodeGenObjC/gnu-init.m
    cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=359251&r1=359250&r2=359251&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Apr 25 16:30:41 2019
@@ -3000,13 +3000,9 @@ CodeGenModule::CreateRuntimeFunction(llv
     if (F->empty()) {
       F->setCallingConv(getRuntimeCC());
 
-      // In Windows Itanium environments, try to mark runtime functions
-      // dllimport. For Mingw and MSVC, don't. We don't really know if the user
-      // will link their standard library statically or dynamically. Marking
-      // functions imported when they are not imported can cause linker errors
-      // and warnings.
-      if (!Local && getTriple().isWindowsItaniumEnvironment() &&
-          !getCodeGenOpts().LTOVisibilityPublicStd) {
+      if (!Local && getTriple().isOSBinFormatCOFF() &&
+          !getCodeGenOpts().LTOVisibilityPublicStd &&
+          !getTriple().isWindowsGNUEnvironment()) {
         const FunctionDecl *FD = GetRuntimeFunctionDecl(Context, Name);
         if (!FD || FD->hasAttr<DLLImportAttr>()) {
           F->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);

Removed: cfe/trunk/test/CodeGen/ms-symbol-linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-symbol-linkage.cpp?rev=359250&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/ms-symbol-linkage.cpp (original)
+++ cfe/trunk/test/CodeGen/ms-symbol-linkage.cpp (removed)
@@ -1,20 +0,0 @@
-// RUN: %clangxx -target aarch64-windows \
-// RUN: -fcxx-exceptions -c -o - %s \
-// RUN: | llvm-objdump -syms - 2>&1 | FileCheck %s
-
-void foo1() { throw 1; }
-// CHECK-LABEL: foo1
-// CHECK-NOT: __imp__CxxThrowException
-
-void bar();
-void foo2() noexcept(true) { bar(); }
-// CHECK-LABEL: foo2
-// CHECK-NOT: __imp___std_terminate
-
-struct A {};
-struct B { virtual void f(); };
-struct C : A, virtual B {};
-struct T {};
-T *foo3() { return dynamic_cast<T *>((C *)0); }
-// CHECK-LABEL: foo3
-// CHECK-NOT: __imp___RTDynamicCast

Modified: cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp?rev=359251&r1=359250&r2=359251&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp Thu Apr 25 16:30:41 2019
@@ -108,7 +108,7 @@ void l() {
 // CHECK-MS-DAG: @_Init_thread_epoch = external thread_local global i32
 // CHECK-MS-DAG: declare dso_local i32 @__tlregdtor(void ()*)
 // CHECK-MS-DAG: declare dso_local i32 @atexit(void ()*)
-// CHECK-MS-DYNAMIC-DAG: declare {{.*}} void @_CxxThrowException
+// CHECK-MS-DYNAMIC-DAG: declare dllimport {{.*}} void @_CxxThrowException
 // CHECK-MS-STATIC-DAG: declare {{.*}} void @_CxxThrowException
 // CHECK-MS-DAG: declare dso_local noalias i8* @"??2 at YAPAXI@Z"
 // CHECK-MS-DAG: declare dso_local void @_Init_thread_header(i32*)

Modified: cfe/trunk/test/CodeGenObjC/gnu-init.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/gnu-init.m?rev=359251&r1=359250&r2=359251&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/gnu-init.m (original)
+++ cfe/trunk/test/CodeGenObjC/gnu-init.m Thu Apr 25 16:30:41 2019
@@ -100,6 +100,6 @@
 // Check our load function is in a comdat.
 // CHECK-WIN: define linkonce_odr hidden void @.objcv2_load_function() comdat {
 
-// Make sure we do not have dllimport on the load function
-// CHECK-WIN: declare dso_local void @__objc_load
+// Make sure we have dllimport on the load function
+// CHECK-WIN: declare dllimport void @__objc_load
 

Modified: cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm?rev=359251&r1=359250&r2=359251&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm Thu Apr 25 16:30:41 2019
@@ -13,5 +13,6 @@ S f() {
   return [I m:S()];
 }
 
-// CHECK: declare dso_local void @objc_msgSend_stret(i8*, i8*, ...)
+// CHECK: declare dllimport void @objc_msgSend_stret(i8*, i8*, ...)
 // CHECK-NOT: declare dllimport void @objc_msgSend(i8*, i8*, ...)
+




More information about the cfe-commits mailing list