Skip to content

Commit 1ada819

Browse files
committed
[asan] Default to -fsanitize-address-use-odr-indicator for non-Windows
This enables odr indicators on all platforms and private aliases on non-Windows. Note that GCC also uses private aliases: this fixes bogus `The following global variable is not properly aligned.` errors for interposed global variables Fix google/sanitizers#398 Fix google/sanitizers#1017 Fix llvm#36893 (we can restore D46665) Global variables of non-hasExactDefinition() linkages (i.e. linkonce/linkonce_odr/weak/weak_odr/common/external_weak) are not instrumented. If an instrumented variable gets interposed to an uninstrumented variable due to symbol interposition (e.g. in issue 36893, _ZTS1A in foo.so is resolved to _ZTS1A in the executable), there may be a bogus error. With private aliases, the register code will not resolve to a definition in another module, and thus prevent the issue. Cons: minor size increase. This is mainly due to extra `__odr_asan_gen_*` symbols. (ELF) In addition, in relocatable files private aliases replace some relocations referencing global symbols with .L symbols and may introduce some STT_SECTION symbols. For lld, with -g0, the size increase is 0.07~0.09% for many configurations I have tested: -O0, -O1, -O2, -O3, -O2 -ffunction-sections -fdata-sections -Wl,--gc-sections. With -g1 or above, the size increase ratio will be even smaller. This patch obsoletes D92078. Don't migrate Windows for now: the static data member of a specialization `std::num_put<char>::id` is a weak symbol, as well as its ODR indicator. Unfortunately, link.exe (and lld without -lldmingw) generally doesn't support duplicate weak definitions (weak symbols in different TUs likely pick different defined external symbols and conflict). Differential Revision: https://reviews.llvm.org/D137227
1 parent 01ccb23 commit 1ada819

File tree

14 files changed

+51
-46
lines changed

14 files changed

+51
-46
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ defm sanitize_address_globals_dead_stripping : BoolOption<"f", "sanitize-address
17581758
NegFlag<SetFalse, [], "Disable linker dead stripping of globals in AddressSanitizer">>,
17591759
Group<f_clang_Group>;
17601760
defm sanitize_address_use_odr_indicator : BoolOption<"f", "sanitize-address-use-odr-indicator",
1761-
CodeGenOpts<"SanitizeAddressUseOdrIndicator">, DefaultFalse,
1761+
CodeGenOpts<"SanitizeAddressUseOdrIndicator">, DefaultTrue,
17621762
PosFlag<SetTrue, [], "Enable ODR indicator globals to avoid false ODR violation"
17631763
" reports in partially sanitized programs at the cost of an increase in binary size">,
17641764
NegFlag<SetFalse, [], "Disable ODR indicator globals">>,

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,10 +923,14 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
923923
!TC.getTriple().isOSBinFormatELF() || TC.getTriple().isOSFuchsia() ||
924924
TC.getTriple().isPS());
925925

926+
// Enable ODR indicators which allow better handling of mixed instrumented
927+
// and uninstrumented globals. Disable them for Windows where weak odr
928+
// indicators (.weak.__odr_asan_gen*) may cause multiple definition linker
929+
// errors in the absence of -lldmingw.
926930
AsanUseOdrIndicator =
927931
Args.hasFlag(options::OPT_fsanitize_address_use_odr_indicator,
928932
options::OPT_fno_sanitize_address_use_odr_indicator,
929-
AsanUseOdrIndicator);
933+
!TC.getTriple().isOSWindows());
930934

931935
if (AllAddedKinds & SanitizerKind::PointerCompare & ~AllRemove) {
932936
AsanInvalidPointerCmp = true;
@@ -1236,8 +1240,8 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
12361240
if (AsanGlobalsDeadStripping)
12371241
CmdArgs.push_back("-fsanitize-address-globals-dead-stripping");
12381242

1239-
if (AsanUseOdrIndicator)
1240-
CmdArgs.push_back("-fsanitize-address-use-odr-indicator");
1243+
if (!AsanUseOdrIndicator)
1244+
CmdArgs.push_back("-fno-sanitize-address-use-odr-indicator");
12411245

12421246
if (AsanInvalidPointerCmp) {
12431247
CmdArgs.push_back("-mllvm");

clang/test/CodeGen/asan-globals-odr.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefixes=CHECK,INDICATOR0,GLOB_VAR,ALIAS0
2-
// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-use-odr-indicator -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefixes=CHECK,INDICATOR1,GLOB_ALIAS_INDICATOR,ALIAS1
1+
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefixes=CHECK,INDICATOR1,GLOB_ALIAS_INDICATOR,ALIAS1
32
// RUN: %clang_cc1 -fsanitize=address -fno-sanitize-address-use-odr-indicator -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefixes=CHECK,INDICATOR0,GLOB_VAR,ALIAS0
43
// RUN: %clang_cc1 -fsanitize=address -fno-sanitize-address-use-odr-indicator -fsanitize-address-use-odr-indicator -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefixes=CHECK,INDICATOR1,GLOB_ALIAS_INDICATOR,ALIAS1
54
// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-use-odr-indicator -fno-sanitize-address-use-odr-indicator -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefixes=CHECK,INDICATOR0,GLOB_VAR,ALIAS0
65

76
// No alias on Windows but indicators should work.
8-
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefixes=CHECK,GLOB_VAR,ALIAS0
9-
// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-use-odr-indicator -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefixes=CHECK,INDICATOR1,GLOB_VAR_INDICATOR,ALIAS0
7+
// RUN: %clang_cc1 -fsanitize=address -fno-sanitize-address-use-odr-indicator -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefixes=CHECK,GLOB_VAR,ALIAS0
8+
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefixes=CHECK,INDICATOR1,GLOB_VAR_INDICATOR,ALIAS0
109

1110
int global;
1211

clang/test/CodeGen/asan-static-odr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s
1+
// RUN: %clang_cc1 -fsanitize=address -fno-sanitize-address-use-odr-indicator -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s
22

33
// No alias on Windows but indicators should work.
4-
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s
4+
// RUN: %clang_cc1 -fsanitize=address -fno-sanitize-address-use-odr-indicator -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s
55

66
static int global;
77

clang/test/Driver/fsanitize.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -263,23 +263,18 @@
263263
// RUN: FileCheck %s --check-prefix=CHECK-NO-CHECK-ASAN-CALLBACK
264264
// CHECK-NO-CHECK-ASAN-CALLBACK-NOT: "-mllvm" "-asan-instrumentation-with-call-threshold=0"
265265

266-
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR
267-
// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fsanitize-address-use-odr-indicator -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR
268-
// CHECK-ASAN-ODR-INDICATOR: -cc1{{.*}}-fsanitize-address-use-odr-indicator
266+
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR
267+
// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-OFF
268+
// CHECK-ASAN-ODR-INDICATOR-NOT: "-fsanitize-address-use-odr-indicator"
269269

270270
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fno-sanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-OFF
271271
// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fno-sanitize-address-use-odr-indicator -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-OFF
272-
// CHECK-ASAN-ODR-INDICATOR-OFF-NOT: -cc1{{.*}}address-generate-odr-globals
272+
// CHECK-ASAN-ODR-INDICATOR-OFF: "-cc1" {{.*}} "-fno-sanitize-address-use-odr-indicator"
273273

274-
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fno-sanitize-address-use-odr-indicator -fsanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-BOTH
275-
// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fno-sanitize-address-use-odr-indicator -fsanitize-address-use-odr-indicator -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-BOTH
276-
// CHECK-ASAN-ODR-INDICATOR-BOTH: -cc1{{.*}}-fsanitize-address-use-odr-indicator
274+
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fno-sanitize-address-use-odr-indicator -fsanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR
275+
// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fno-sanitize-address-use-odr-indicator -fsanitize-address-use-odr-indicator -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR
277276

278-
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-address-use-odr-indicator -fno-sanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-BOTH-OFF
279-
// CHECK-ASAN-ODR-INDICATOR-BOTH-OFF-NOT: -cc1{{.*}}address-generate-odr-globals
280-
281-
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-WITHOUT-ODR-INDICATOR
282-
// CHECK-ASAN-WITHOUT-ODR-INDICATOR-NOT: -cc1{{.*}}address-generate-odr-globals
277+
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-address-use-odr-indicator -fno-sanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-OFF
283278

284279
// RUN: %clang --target=x86_64-linux-gnu -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-TRACK-ORIGINS
285280
// CHECK-ONLY-TRACK-ORIGINS: warning: argument unused during compilation: '-fsanitize-memory-track-origins'

compiler-rt/test/asan/TestCases/Linux/odr-violation.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66
// We use fast_unwind_on_malloc=0 to have full unwinding even w/o frame
77
// pointers. This setting is not on by default because it's too expensive.
88
//
9+
// Note, -asan-use-private-alias=1 -asan-use-odr-indicator=1 is the default.
10+
// -fno-sanitize-address-use-odr-indicator turns off both.
11+
//
912
// Different size: detect a bug if detect_odr_violation>=1
10-
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared %s -o %dynamiclib
11-
// RUN: %clangxx_asan -g %s %ld_flags_rpath_exe -o %t-ODR-EXE
13+
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fno-sanitize-address-use-odr-indicator %s -o %dynamiclib
14+
// RUN: %clangxx_asan -g -fno-sanitize-address-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE
1215
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 not %run %t-ODR-EXE 2>&1 | FileCheck %s
1316
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s
1417
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
1518
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
1619
//
1720
// Same size: report a bug only if detect_odr_violation>=2.
18-
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared %s -o %dynamiclib -DSZ=100
21+
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -fno-sanitize-address-use-odr-indicator %s -o %dynamiclib -DSZ=100
1922
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=1 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
2023
// RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t-ODR-EXE 2>&1 | FileCheck %s
2124
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
@@ -26,13 +29,13 @@
2629
// RUN: rm -f %t.supp
2730
//
2831
// Use private aliases for global variables without indicator symbol.
29-
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-private-alias %s -o %dynamiclib -DSZ=100
30-
// RUN: %clangxx_asan -g -mllvm -asan-use-private-alias %s %ld_flags_rpath_exe -o %t-ODR-EXE
32+
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-odr-indicator=0 %s -o %dynamiclib -DSZ=100
33+
// RUN: %clangxx_asan -g -mllvm -asan-use-odr-indicator=0 %s %ld_flags_rpath_exe -o %t-ODR-EXE
3134
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 %run %t-ODR-EXE 2>&1 | FileCheck %s --check-prefix=DISABLED
3235

3336
// Use private aliases for global variables: use indicator symbol to detect ODR violation.
34-
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared -mllvm -asan-use-private-alias -mllvm -asan-use-odr-indicator %s -o %dynamiclib -DSZ=100
35-
// RUN: %clangxx_asan -g -mllvm -asan-use-private-alias -mllvm -asan-use-odr-indicator %s %ld_flags_rpath_exe -o %t-ODR-EXE
37+
// RUN: %clangxx_asan -g -DBUILD_SO=1 -fPIC -shared %s -o %dynamiclib -DSZ=100
38+
// RUN: %clangxx_asan -g %s %ld_flags_rpath_exe -o %t-ODR-EXE
3639
// RUN: %env_asan_opts=fast_unwind_on_malloc=0 not %run %t-ODR-EXE 2>&1 | FileCheck %s
3740

3841
// Same as above but with clang switches.

compiler-rt/test/asan/TestCases/Linux/odr_indicators.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_asan -fPIC %s -o %t
1+
// RUN: %clangxx_asan -fno-sanitize-address-use-odr-indicator -fPIC %s -o %t
22
// RUN: %env_asan_opts=report_globals=2 %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,INDICATOR0
33

44
// RUN: %clangxx_asan -fsanitize-address-use-odr-indicator -fPIC %s -o %t

llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct AddressSanitizerOptions {
3636
class AddressSanitizerPass : public PassInfoMixin<AddressSanitizerPass> {
3737
public:
3838
AddressSanitizerPass(const AddressSanitizerOptions &Options,
39-
bool UseGlobalGC = true, bool UseOdrIndicator = false,
39+
bool UseGlobalGC = true, bool UseOdrIndicator = true,
4040
AsanDtorKind DestructorKind = AsanDtorKind::Global);
4141
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
4242
void printPipeline(raw_ostream &OS,

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,12 @@ static cl::opt<uint32_t> ClForceExperiment(
396396
static cl::opt<bool>
397397
ClUsePrivateAlias("asan-use-private-alias",
398398
cl::desc("Use private aliases for global variables"),
399-
cl::Hidden, cl::init(false));
399+
cl::Hidden, cl::init(true));
400400

401401
static cl::opt<bool>
402402
ClUseOdrIndicator("asan-use-odr-indicator",
403403
cl::desc("Use odr indicators to improve ODR reporting"),
404-
cl::Hidden, cl::init(false));
404+
cl::Hidden, cl::init(true));
405405

406406
static cl::opt<bool>
407407
ClUseGlobalsGC("asan-globals-live-support",
@@ -767,15 +767,19 @@ class ModuleAddressSanitizer {
767767
public:
768768
ModuleAddressSanitizer(Module &M, bool CompileKernel = false,
769769
bool Recover = false, bool UseGlobalsGC = true,
770-
bool UseOdrIndicator = false,
770+
bool UseOdrIndicator = true,
771771
AsanDtorKind DestructorKind = AsanDtorKind::Global)
772772
: CompileKernel(ClEnableKasan.getNumOccurrences() > 0 ? ClEnableKasan
773773
: CompileKernel),
774774
Recover(ClRecover.getNumOccurrences() > 0 ? ClRecover : Recover),
775775
UseGlobalsGC(UseGlobalsGC && ClUseGlobalsGC && !this->CompileKernel),
776776
// Enable aliases as they should have no downside with ODR indicators.
777-
UsePrivateAlias(UseOdrIndicator || ClUsePrivateAlias),
778-
UseOdrIndicator(UseOdrIndicator || ClUseOdrIndicator),
777+
UsePrivateAlias(ClUsePrivateAlias.getNumOccurrences() > 0
778+
? ClUsePrivateAlias
779+
: UseOdrIndicator),
780+
UseOdrIndicator(ClUseOdrIndicator.getNumOccurrences() > 0
781+
? ClUseOdrIndicator
782+
: UseOdrIndicator),
779783
// Not a typo: ClWithComdat is almost completely pointless without
780784
// ClUseGlobalsGC (because then it only works on modules without
781785
// globals, which are rare); it is a prerequisite for ClUseGlobalsGC;

llvm/test/Instrumentation/AddressSanitizer/global_metadata.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ target triple = "x86_64-unknown-linux-gnu"
1616

1717
; Check that globals were instrumented:
1818

19-
; CHECK: @global = global { i32, [28 x i8] } zeroinitializer, align 32
20-
; CHECK: @.str = internal constant { [14 x i8], [18 x i8] } { [14 x i8] c"Hello, world!\00", [18 x i8] zeroinitializer }, align 32
19+
; CHECK: @global = global { i32, [28 x i8] } zeroinitializer, comdat, align 32
20+
; CHECK: @.str = internal constant { [14 x i8], [18 x i8] } { [14 x i8] c"Hello, world!\00", [18 x i8] zeroinitializer }, comdat({{.*}}), align 32
2121

2222
; Check emitted location descriptions:
2323
; CHECK: [[VARNAME:@___asan_gen_.[0-9]+]] = private unnamed_addr constant [7 x i8] c"global\00", align 1

llvm/test/Instrumentation/AddressSanitizer/global_with_comdat.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
; enabled as indicator symbols will cause link time odr violations.
66
; This is to fix PR 47925.
77
;
8-
; RUN: opt < %s -passes=asan -asan-globals-live-support=1 -S | FileCheck %s --check-prefixes=CHECK,NOCOMDAT
8+
; RUN: opt < %s -passes=asan -asan-globals-live-support=1 -asan-use-odr-indicator=0 -S | FileCheck %s --check-prefixes=CHECK,NOCOMDAT
99
; Check that enabling odr indicators enables comdat for globals.
10-
; RUN: opt < %s -passes=asan -asan-globals-live-support=1 -asan-use-odr-indicator=1 -S | FileCheck %s --check-prefixes=CHECK,COMDAT
10+
; RUN: opt < %s -passes=asan -asan-globals-live-support=1 -S | FileCheck %s --check-prefixes=CHECK,COMDAT
1111
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1212
target triple = "x86_64-unknown-linux-gnu"
1313

@@ -43,8 +43,8 @@ target triple = "x86_64-unknown-linux-gnu"
4343

4444
; Check emitted location descriptions:
4545
; CHECK: [[VARNAME:@___asan_gen_.[0-9]+]] = private unnamed_addr constant [7 x i8] c"global\00", align 1
46-
; COMDAT: @__asan_global_global = {{.*}}i64 ptrtoint (ptr @global to i64){{.*}} section "asan_globals"{{.*}}, !associated
47-
; COMDAT: @__asan_global_.str = {{.*}}i64 ptrtoint (ptr @{{.str|1}} to i64){{.*}} section "asan_globals"{{.*}}, !associated
46+
; COMDAT: @__asan_global_global = {{.*}}i64 ptrtoint (ptr @__odr_asan_gen_global to i64){{.*}} section "asan_globals"{{.*}}, comdat($global), !associated
47+
; COMDAT: @__asan_global_.str = {{.*}}i64 ptrtoint (ptr @___asan_gen_ to i64){{.*}} section "asan_globals"{{.*}}, comdat($.str.{{.*}}), !associated
4848

4949
; The metadata has to be inserted to llvm.compiler.used to avoid being stripped
5050
; during LTO.

llvm/test/Instrumentation/AddressSanitizer/local_alias.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; Defaults
2-
; RUN: opt < %s -passes=asan -S | FileCheck %s --check-prefixes=CHECK-NOALIAS,CHECK-NOINDICATOR
2+
; RUN: opt < %s -passes=asan -S | FileCheck %s --check-prefixes=CHECK-ALIAS,CHECK-INDICATOR
33

44
; {newPM,legacyPM} x {alias0,alias1} x {odr0,odr1}
55
; RUN: opt < %s -passes=asan -asan-use-private-alias=0 -asan-use-odr-indicator=0 -S | FileCheck %s --check-prefixes=CHECK-NOALIAS,CHECK-NOINDICATOR

llvm/test/Instrumentation/AddressSanitizer/odr-check-ignore.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: opt < %s -passes=asan -asan-use-private-alias=0 -S | FileCheck %s --check-prefix=NOALIAS
2-
; RUN: opt < %s -passes=asan -asan-use-private-alias=1 -S | FileCheck %s --check-prefix=ALIAS
1+
; RUN: opt < %s -passes=asan -asan-use-odr-indicator=0 -asan-use-private-alias=0 -S | FileCheck %s --check-prefix=NOALIAS
2+
; RUN: opt < %s -passes=asan -asan-use-odr-indicator=0 -asan-use-private-alias=1 -S | FileCheck %s --check-prefix=ALIAS
33

44
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
55
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Instrumentation/AddressSanitizer/win-string-literal.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -passes=asan -S | FileCheck %s
1+
; RUN: opt < %s -passes=asan -asan-use-odr-indicator=0 -asan-use-private-alias=0 -S | FileCheck %s
22

33
; Generated like so:
44
; $ clang -S -emit-llvm -Xclang -disable-llvm-passes -fsanitize=address -O1 t.cpp -o t.ll

0 commit comments

Comments
 (0)