[PATCH] D120394: [asan] Allow -fsanitize-address-globals-dead-stripping with -fno-data-sections for ELF

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 16:08:31 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0477cac332d5: [asan] Allow -fsanitize-address-globals-dead-stripping with -fno-data-sections… (authored by MaskRay).

Changed prior to commit:
  https://reviews.llvm.org/D120394?vs=410739&id=410967#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120394/new/

https://reviews.llvm.org/D120394

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/CodeGen/asan-globals-gc.cpp
  clang/test/CodeGen/asan-no-globals-no-comdat.cpp


Index: clang/test/CodeGen/asan-no-globals-no-comdat.cpp
===================================================================
--- clang/test/CodeGen/asan-no-globals-no-comdat.cpp
+++ clang/test/CodeGen/asan-no-globals-no-comdat.cpp
@@ -1,9 +1,7 @@
 // Test that on Linux asan constructor is placed in a comdat iff globals-gc is on.
 // Even if there are no globals in the module.
 
-// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
-// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fdata-sections -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITH-GC
-// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fno-integrated-as -fdata-sections -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
+// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITH-GC
 // RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fno-integrated-as -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
 // RUN: %clang_cc1 -fsanitize=address -fdata-sections -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
 
Index: clang/test/CodeGen/asan-globals-gc.cpp
===================================================================
--- clang/test/CodeGen/asan-globals-gc.cpp
+++ clang/test/CodeGen/asan-globals-gc.cpp
@@ -1,6 +1,5 @@
-// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
+// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITH-GC
 // RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fdata-sections -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITH-GC
-// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fno-integrated-as -fdata-sections -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
 // RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fno-integrated-as -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
 // RUN: %clang_cc1 -fsanitize=address -fdata-sections -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
 
Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -281,7 +281,7 @@
   case Triple::COFF:
     return true;
   case Triple::ELF:
-    return CGOpts.DataSections && !CGOpts.DisableIntegratedAS;
+    return !CGOpts.DisableIntegratedAS;
   case Triple::GOFF:
     llvm::report_fatal_error("ASan not implemented for GOFF");
   case Triple::XCOFF:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120394.410967.patch
Type: text/x-patch
Size: 3100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220224/0a623e1b/attachment.bin>


More information about the cfe-commits mailing list