fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

1.43.1
779 B20 linesraw
1# needs-sanitizer-support
2# only-x86_64
3# only-linux
4
5-include ../tools.mk
6
7LOG := $(TMPDIR)/log.txt
8
9# This test builds a shared object, then an executable that links it as a native
10# rust library (contrast to an rlib). The shared library and executable both
11# are compiled with address sanitizer, and we assert that a fault in the dylib
12# is correctly detected.
13
14# See comment in sanitizer-address/Makefile for why this is here
15EXTRA_RUSTFLAG=-C relocation-model=dynamic-no-pic
16
17all:
18	$(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) $(EXTRA_RUSTFLAG) library.rs
19	$(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) $(EXTRA_RUSTFLAG) -llibrary program.rs
20	LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow