r331010 - [Driver] Don't enable "-fregister-global-dtors-with-atexit" by default

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 26 18:42:34 PDT 2018


Author: ahatanak
Date: Thu Apr 26 18:42:33 2018
New Revision: 331010

URL: http://llvm.org/viewvc/llvm-project?rev=331010&view=rev
Log:
[Driver] Don't enable "-fregister-global-dtors-with-atexit" by default
when compiling the kernel or kexts.

Destructors should be registered with atexit by default only when we are
compiling userland code.

Modified:
    cfe/trunk/lib/Driver/ToolChains/Clang.cpp
    cfe/trunk/test/Driver/cxa-atexit.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=331010&r1=331009&r2=331010&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Apr 26 18:42:33 2018
@@ -4194,7 +4194,7 @@ void Clang::ConstructJob(Compilation &C,
 
   if (Args.hasFlag(options::OPT_fregister_global_dtors_with_atexit,
                    options::OPT_fno_register_global_dtors_with_atexit,
-                   RawTriple.isOSDarwin()))
+                   RawTriple.isOSDarwin() && !KernelOrKext))
     CmdArgs.push_back("-fregister-global-dtors-with-atexit");
 
   // -fms-extensions=0 is default.

Modified: cfe/trunk/test/Driver/cxa-atexit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cxa-atexit.cpp?rev=331010&r1=331009&r2=331010&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cxa-atexit.cpp (original)
+++ cfe/trunk/test/Driver/cxa-atexit.cpp Thu Apr 26 18:42:33 2018
@@ -31,6 +31,8 @@
 // RUN: FileCheck --check-prefix=WITHATEXIT %s
 // RUN: %clang -target x86_64-apple-darwin -c -### %s 2>&1 | \
 // RUN: FileCheck --check-prefix=WITHATEXIT %s
+// RUN: %clang -target x86_64-apple-darwin -c -mkernel -### %s 2>&1 | \
+// RUN: FileCheck --check-prefix=WITHOUTATEXIT %s
 // RUN: %clang -target x86_64-pc-linux-gnu -fregister-global-dtors-with-atexit -fno-register-global-dtors-with-atexit -c -### %s 2>&1 | \
 // RUN: FileCheck --check-prefix=WITHOUTATEXIT %s
 // RUN: %clang -target x86_64-pc-linux-gnu -fno-register-global-dtors-with-atexit -fregister-global-dtors-with-atexit -c -### %s 2>&1 | \




More information about the cfe-commits mailing list