]>
Commit | Line | Data |
---|---|---|
48663c56 | 1 | # needs-sanitizer-support |
f035d41b | 2 | # needs-sanitizer-address |
48663c56 XL |
3 | # only-linux |
4 | ||
041b39d2 XL |
5 | -include ../tools.mk |
6 | ||
e74abb32 XL |
7 | # This test first builds a staticlib with AddressSanitizer and checks that |
8 | # linking it to an executable fails due to the missing sanitizer runtime. | |
9 | # It then builds an executable linking to the staticlib and checks that | |
10 | # the fault in the staticlib is detected correctly. | |
11 | ||
12 | # Note that checking for the link failure actually checks two things at once: | |
13 | # 1) That the library has the sanitizer intrumentation | |
14 | # 2) and that library does not have the sanitizer runtime | |
041b39d2 | 15 | |
041b39d2 | 16 | all: |
041b39d2 | 17 | $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs |
e74abb32 XL |
18 | ! $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS) |
19 | $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -L . program.rs | |
ff7c6d11 | 20 | LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow |
041b39d2 | 21 |