[llvm] r274578 - [asan] Add a hidden option for Mach-O global metadata liveness tracking
Ryan Govostes via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 5 14:53:08 PDT 2016
Author: rgov
Date: Tue Jul 5 16:53:08 2016
New Revision: 274578
URL: http://llvm.org/viewvc/llvm-project?rev=274578&view=rev
Log:
[asan] Add a hidden option for Mach-O global metadata liveness tracking
Modified:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=274578&r1=274577&r2=274578&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Jul 5 16:53:08 2016
@@ -245,6 +245,13 @@ static cl::opt<bool>
" variables"),
cl::Hidden, cl::init(false));
+static cl::opt<bool>
+ ClUseMachOGlobalsSection("asan-globals-live-support",
+ cl::desc("Use linker features to support dead "
+ "code stripping of globals "
+ "(Mach-O only)"),
+ cl::Hidden, cl::init(false));
+
// Debug flags.
static cl::opt<int> ClDebug("asan-debug", cl::desc("debug"), cl::Hidden,
cl::init(0));
@@ -1338,6 +1345,9 @@ bool AddressSanitizerModule::ShouldInstr
// binary in order to allow the linker to properly dead strip. This is only
// supported on recent versions of ld64.
bool AddressSanitizerModule::ShouldUseMachOGlobalsSection() const {
+ if (!ClUseMachOGlobalsSection)
+ return false;
+
if (!TargetTriple.isOSBinFormatMachO())
return false;
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll?rev=274578&r1=274577&r2=274578&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll Tue Jul 5 16:53:08 2016
@@ -2,7 +2,7 @@
; allowing dead stripping to be performed, and that the appropriate runtime
; routines are invoked.
-; RUN: opt < %s -asan -asan-module -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-globals-live-support -S | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
More information about the llvm-commits
mailing list