File tree Expand file tree Collapse file tree 14 files changed +65
-34
lines changed 
sanitizer-invalid-cratetype Expand file tree Collapse file tree 14 files changed +65
-34
lines changed Original file line number Diff line number Diff line change @@ -1268,11 +1268,11 @@ impl Step for Compiletest {
12681268        builder. add_rust_test_threads ( & mut  cmd) ; 
12691269
12701270        if  builder. config . sanitizers  { 
1271-             cmd. env ( "SANITIZER_SUPPORT " ,  "1" ) ; 
1271+             cmd. env ( "RUSTC_SANITIZER_SUPPORT " ,  "1" ) ; 
12721272        } 
12731273
12741274        if  builder. config . profiler  { 
1275-             cmd. env ( "PROFILER_SUPPORT " ,  "1" ) ; 
1275+             cmd. env ( "RUSTC_PROFILER_SUPPORT " ,  "1" ) ; 
12761276        } 
12771277
12781278        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+ 
13-include  ../tools.mk
24
35all :
4- ifeq  ($(PROFILER_SUPPORT ) ,1)
56	$(RUSTC )  -Copt-level=3 -Clto=fat -Z pgo-gen=" $( TMPDIR) "   test.rs
67	$(call  RUN,test)  ||  exit  1
78	[ -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+ 
13-include  ../tools.mk
24
35all :
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
67	#  We expect symbols starting with "__llvm_profile_".
78	$(CGREP )  " __llvm_profile_"   <  $(TMPDIR ) /test.ll
89	#  We do NOT expect the "__imp_" version of these symbols.
910	$(CGREP )  -v " __imp___llvm_profile_"   <  $(TMPDIR ) /test.ll #  64 bit
1011	$(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+ 
13-include  ../tools.mk
24
35all :
4- ifeq  ($(PROFILER_SUPPORT ) ,1)
56	$(RUSTC )  -g -Z pgo-gen=" $( TMPDIR) "   test.rs
67	$(call  RUN,test)  ||  exit  1
78	[ -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+ 
13-include  ../tools.mk
24
35all :
4- ifeq  ($(PROFILER_SUPPORT ) ,1)
56	$(RUSTC )  -g -Z profile test.rs
67	$(call  RUN,test)  ||  exit  1
78	[ -e  " $( TMPDIR)  /test.gcno"   ] ||  (echo " No .gcno file" ;  exit  1)
89	[ -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+ 
13-include  ../tools.mk
24
35LOG  := $(TMPDIR ) /log.txt
46
57#  NOTE the address sanitizer only supports x86_64 linux and macOS
68
79ifeq  ($(TARGET ) ,x86_64-apple-darwin)
8- ASAN_SUPPORT =$(SANITIZER_SUPPORT ) 
910EXTRA_RUSTFLAG =-C rpath
1011else 
1112ifeq  ($(TARGET ) ,x86_64-unknown-linux-gnu)
12- ASAN_SUPPORT =$(SANITIZER_SUPPORT ) 
1313
1414#  Apparently there are very specific Linux kernels, notably the one that's
1515#  currently on Travis CI, which contain a buggy commit that triggers failures in
2323endif 
2424
2525all :
26- ifeq  ($(ASAN_SUPPORT ) ,1)
2726	$(RUSTC )  -g -Z sanitizer=address -Z print-link-args $(EXTRA_RUSTFLAG )  overflow.rs |  $(CGREP )  librustc_asan
2827	$(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+ 
13-include  ../tools.mk
24
35LOG  := $(TMPDIR ) /log.txt
@@ -8,15 +10,12 @@ LOG := $(TMPDIR)/log.txt
810#  is correctly detected.
911
1012ifeq  ($(TARGET ) ,x86_64-unknown-linux-gnu)
11- ASAN_SUPPORT =$(SANITIZER_SUPPORT ) 
1213
1314#  See comment in sanitizer-address/Makefile for why this is here
1415EXTRA_RUSTFLAG =-C relocation-model=dynamic-no-pic
1516endif 
1617
1718all :
18- ifeq  ($(ASAN_SUPPORT ) ,1)
1919	$(RUSTC )  -g -Z sanitizer=address --crate-type cdylib --target $(TARGET )  $(EXTRA_RUSTFLAG )  library.rs
2020	$(RUSTC )  -g -Z sanitizer=address --crate-type bin --target $(TARGET )  $(EXTRA_RUSTFLAG )  -llibrary program.rs
2121	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+ 
13-include  ../tools.mk
24
35LOG  := $(TMPDIR ) /log.txt
@@ -8,15 +10,11 @@ LOG := $(TMPDIR)/log.txt
810#  is correctly detected.
911
1012ifeq  ($(TARGET ) ,x86_64-unknown-linux-gnu)
11- ASAN_SUPPORT =$(SANITIZER_SUPPORT ) 
12- 
1313#  See comment in sanitizer-address/Makefile for why this is here
1414EXTRA_RUSTFLAG =-C relocation-model=dynamic-no-pic
1515endif 
1616
1717all :
18- ifeq  ($(ASAN_SUPPORT ) ,1)
1918	$(RUSTC )  -g -Z sanitizer=address --crate-type dylib --target $(TARGET )  $(EXTRA_RUSTFLAG )  library.rs
2019	$(RUSTC )  -g -Z sanitizer=address --crate-type bin --target $(TARGET )  $(EXTRA_RUSTFLAG )  -llibrary program.rs
2120	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+ 
13-include  ../tools.mk
24
35#  NOTE the address sanitizer only supports x86_64 linux and macOS
46
57ifeq  ($(TARGET ) ,x86_64-apple-darwin)
6- ASAN_SUPPORT =$(SANITIZER_SUPPORT ) 
78EXTRA_RUSTFLAG =-C rpath
89else 
910ifeq  ($(TARGET ) ,x86_64-unknown-linux-gnu)
10- ASAN_SUPPORT =$(SANITIZER_SUPPORT ) 
1111EXTRA_RUSTFLAG =
1212endif 
1313endif 
1414
1515all :
16- ifeq  ($(ASAN_SUPPORT ) ,1)
1716	$(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