File tree Expand file tree Collapse file tree 14 files changed +71
-43
lines changed
sanitizer-invalid-cratetype Expand file tree Collapse file tree 14 files changed +71
-43
lines changed Original file line number Diff line number Diff line change @@ -1268,11 +1268,11 @@ impl Step for Compiletest {
1268
1268
builder. add_rust_test_threads ( & mut cmd) ;
1269
1269
1270
1270
if builder. config . sanitizers {
1271
- cmd. env ( "SANITIZER_SUPPORT " , "1" ) ;
1271
+ cmd. env ( "RUSTC_SANITIZER_SUPPORT " , "1" ) ;
1272
1272
}
1273
1273
1274
1274
if builder. config . profiler {
1275
- cmd. env ( "PROFILER_SUPPORT " , "1" ) ;
1275
+ cmd. env ( "RUSTC_PROFILER_SUPPORT " , "1" ) ;
1276
1276
}
1277
1277
1278
1278
cmd. env ( "RUST_TEST_TMPDIR" , builder. out . join ( "tmp" ) ) ;
Original file line number Diff line number Diff line change
1
+ // Test that `-Zpgo-gen` creates expected instrumentation artifacts in LLVM IR.
2
+
3
+ // needs-profiler-support
4
+ // compile-flags: -Z pgo-gen -Ccodegen-units=1
5
+
6
+ // CHECK: @__llvm_profile_raw_version =
7
+ // CHECK: @__profc_{{.*}}pgo_instrumentation{{.*}}some_function{{.*}} = private global
8
+ // CHECK: @__profd_{{.*}}pgo_instrumentation{{.*}}some_function{{.*}} = private global
9
+ // CHECK: @__profc_{{.*}}pgo_instrumentation{{.*}}main{{.*}} = private global
10
+ // CHECK: @__profd_{{.*}}pgo_instrumentation{{.*}}main{{.*}} = private global
11
+ // CHECK: @__llvm_profile_filename = {{.*}}"default_%m.profraw\00"{{.*}}
12
+
13
+ #[ inline( never) ]
14
+ fn some_function ( ) {
15
+
16
+ }
17
+
18
+ fn main ( ) {
19
+ some_function ( ) ;
20
+ }
Original file line number Diff line number Diff line change
1
+ # needs-profiler-support
2
+
1
3
-include ../tools.mk
2
4
3
5
all :
4
- ifeq ($(PROFILER_SUPPORT ) ,1)
5
6
$(RUSTC ) -Copt-level=3 -Clto=fat -Z pgo-gen=" $( TMPDIR) " test.rs
6
7
$(call RUN,test) || exit 1
7
8
[ -e " $( TMPDIR) " /default_* .profraw ] || (echo " No .profraw file" ; exit 1)
8
- endif
Original file line number Diff line number Diff line change
1
+ # needs-profiler-support
2
+
1
3
-include ../tools.mk
2
4
3
5
all :
4
- ifeq ($(PROFILER_SUPPORT ) ,1)
5
- $(RUSTC) -O -Ccodegen-units=1 -Z pgo-gen="$(TMPDIR)/test.profraw" --emit=llvm-ir test.rs
6
+ $(RUSTC ) -O -Ccodegen-units=1 -Z pgo-gen=" $( TMPDIR) " --emit=llvm-ir test.rs
6
7
# We expect symbols starting with "__llvm_profile_".
7
8
$(CGREP ) " __llvm_profile_" < $(TMPDIR ) /test.ll
8
9
# We do NOT expect the "__imp_" version of these symbols.
9
10
$(CGREP ) -v " __imp___llvm_profile_" < $(TMPDIR ) /test.ll # 64 bit
10
11
$(CGREP ) -v " __imp____llvm_profile_" < $(TMPDIR ) /test.ll # 32 bit
11
- endif
Original file line number Diff line number Diff line change
1
+ # needs-profiler-support
2
+
1
3
-include ../tools.mk
2
4
3
5
all :
4
- ifeq ($(PROFILER_SUPPORT ) ,1)
5
6
$(RUSTC ) -g -Z pgo-gen=" $( TMPDIR) " test.rs
6
7
$(call RUN,test) || exit 1
7
8
[ -e " $( TMPDIR) " /default_* .profraw ] || (echo " No .profraw file" ; exit 1)
8
- endif
Original file line number Diff line number Diff line change
1
+ # needs-profiler-support
2
+
1
3
-include ../tools.mk
2
4
3
5
all :
4
- ifeq ($(PROFILER_SUPPORT ) ,1)
5
6
$(RUSTC ) -g -Z profile test.rs
6
7
$(call RUN,test) || exit 1
7
8
[ -e " $( TMPDIR) /test.gcno" ] || (echo " No .gcno file" ; exit 1)
8
9
[ -e " $( TMPDIR) /test.gcda" ] || (echo " No .gcda file" ; exit 1)
9
- endif
Original file line number Diff line number Diff line change
1
+ # needs-sanitizer-support
2
+
1
3
-include ../tools.mk
2
4
3
5
LOG := $(TMPDIR ) /log.txt
4
6
5
7
# NOTE the address sanitizer only supports x86_64 linux and macOS
6
8
7
9
ifeq ($(TARGET ) ,x86_64-apple-darwin)
8
- ASAN_SUPPORT =$(SANITIZER_SUPPORT )
9
10
EXTRA_RUSTFLAG =-C rpath
10
11
else
11
12
ifeq ($(TARGET ) ,x86_64-unknown-linux-gnu)
12
- ASAN_SUPPORT =$(SANITIZER_SUPPORT )
13
13
14
14
# Apparently there are very specific Linux kernels, notably the one that's
15
15
# currently on Travis CI, which contain a buggy commit that triggers failures in
23
23
endif
24
24
25
25
all :
26
- ifeq ($(ASAN_SUPPORT ) ,1)
27
26
$(RUSTC ) -g -Z sanitizer=address -Z print-link-args $(EXTRA_RUSTFLAG ) overflow.rs | $(CGREP ) librustc_asan
28
27
$(TMPDIR ) /overflow 2>&1 | $(CGREP ) stack-buffer-overflow
29
- endif
Original file line number Diff line number Diff line change
1
+ # needs-sanitizer-support
2
+ # only-x86_64
3
+ # only-linux
4
+
1
5
-include ../tools.mk
2
6
3
7
LOG := $(TMPDIR ) /log.txt
@@ -7,16 +11,10 @@ LOG := $(TMPDIR)/log.txt
7
11
# are compiled with address sanitizer, and we assert that a fault in the cdylib
8
12
# is correctly detected.
9
13
10
- ifeq ($(TARGET ) ,x86_64-unknown-linux-gnu)
11
- ASAN_SUPPORT =$(SANITIZER_SUPPORT )
12
-
13
14
# See comment in sanitizer-address/Makefile for why this is here
14
15
EXTRA_RUSTFLAG =-C relocation-model=dynamic-no-pic
15
- endif
16
16
17
17
all :
18
- ifeq ($(ASAN_SUPPORT ) ,1)
19
18
$(RUSTC ) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET ) $(EXTRA_RUSTFLAG ) library.rs
20
19
$(RUSTC ) -g -Z sanitizer=address --crate-type bin --target $(TARGET ) $(EXTRA_RUSTFLAG ) -llibrary program.rs
21
20
LD_LIBRARY_PATH=$(TMPDIR ) $(TMPDIR ) /program 2>&1 | $(CGREP ) stack-buffer-overflow
22
- endif
Original file line number Diff line number Diff line change
1
+ # needs-sanitizer-support
2
+ # only-x86_64
3
+ # only-linux
4
+
1
5
-include ../tools.mk
2
6
3
7
LOG := $(TMPDIR ) /log.txt
@@ -7,16 +11,10 @@ LOG := $(TMPDIR)/log.txt
7
11
# are compiled with address sanitizer, and we assert that a fault in the dylib
8
12
# is correctly detected.
9
13
10
- ifeq ($(TARGET ) ,x86_64-unknown-linux-gnu)
11
- ASAN_SUPPORT =$(SANITIZER_SUPPORT )
12
-
13
14
# See comment in sanitizer-address/Makefile for why this is here
14
15
EXTRA_RUSTFLAG =-C relocation-model=dynamic-no-pic
15
- endif
16
16
17
17
all :
18
- ifeq ($(ASAN_SUPPORT ) ,1)
19
18
$(RUSTC ) -g -Z sanitizer=address --crate-type dylib --target $(TARGET ) $(EXTRA_RUSTFLAG ) library.rs
20
19
$(RUSTC ) -g -Z sanitizer=address --crate-type bin --target $(TARGET ) $(EXTRA_RUSTFLAG ) -llibrary program.rs
21
20
LD_LIBRARY_PATH=$(TMPDIR ) $(TMPDIR ) /program 2>&1 | $(CGREP ) stack-buffer-overflow
22
- endif
Original file line number Diff line number Diff line change
1
+ # needs-sanitizer-support
2
+
1
3
-include ../tools.mk
2
4
3
5
# NOTE the address sanitizer only supports x86_64 linux and macOS
4
6
5
7
ifeq ($(TARGET ) ,x86_64-apple-darwin)
6
- ASAN_SUPPORT =$(SANITIZER_SUPPORT )
7
8
EXTRA_RUSTFLAG =-C rpath
8
9
else
9
10
ifeq ($(TARGET ) ,x86_64-unknown-linux-gnu)
10
- ASAN_SUPPORT =$(SANITIZER_SUPPORT )
11
11
EXTRA_RUSTFLAG =
12
12
endif
13
13
endif
14
14
15
15
all :
16
- ifeq ($(ASAN_SUPPORT ) ,1)
17
16
$(RUSTC ) -Z sanitizer=address --crate-type proc-macro --target $(TARGET ) hello.rs 2>&1 | $(CGREP ) ' -Z sanitizer'
18
- endif
You can’t perform that action at this time.
0 commit comments