r301374 - [asan] Unconditionally enable GC of globals on COFF.

Evgeniy Stepanov via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 17:51:06 PDT 2017


Author: eugenis
Date: Tue Apr 25 19:51:06 2017
New Revision: 301374

URL: http://llvm.org/viewvc/llvm-project?rev=301374&view=rev
Log:
[asan] Unconditionally enable GC of globals on COFF.

This change restores pre-r301225 behavior, where linker GC compatible global
instrumentation was used on COFF targets disregarding -f(no-)data-sections and/or
/Gw flags.

This instrumentation puts each global in a COMDAT with an ASan descriptor for that global.
It effectively enables -fdata-sections, but limits it to ASan-instrumented globals.

Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp
    cfe/trunk/test/CodeGen/asan-globals-gc.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=301374&r1=301373&r2=301374&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Apr 25 19:51:06 2017
@@ -196,9 +196,8 @@ static void addSanitizerCoveragePass(con
 static bool asanUseGlobalsGC(const Triple &T, const CodeGenOptions &CGOpts) {
   switch (T.getObjectFormat()) {
   case Triple::MachO:
-    return true;
   case Triple::COFF:
-    return CGOpts.DataSections;
+    return true;
   case Triple::ELF:
     return CGOpts.DataSections && !CGOpts.DisableIntegratedAS;
   default:

Modified: cfe/trunk/test/CodeGen/asan-globals-gc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asan-globals-gc.cpp?rev=301374&r1=301373&r2=301374&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/asan-globals-gc.cpp (original)
+++ cfe/trunk/test/CodeGen/asan-globals-gc.cpp Tue Apr 25 19:51:06 2017
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefix=WITHOUT-GC
+// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefix=WITH-GC
 // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-windows-msvc -fdata-sections %s | FileCheck %s --check-prefix=WITH-GC
 
 int global;




More information about the cfe-commits mailing list