Skip to content

Commit ac3cf6b

Browse files
committed
Compile main executable with rustc in staticlib test
The static libraries produced by rustc no longer contain sanitizer runtime libraries, so the final linking step needs to be performed with rustc and sanitizer flag.
1 parent 87c3eed commit ac3cf6b

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/test/run-make-fulldeps/sanitizer-staticlib-link/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
all:
1212
$(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs
13-
$(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS)
14-
LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow
13+
$(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -L . program.rs
14+
$(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow
1515

src/test/run-make-fulldeps/sanitizer-staticlib-link/program.c

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#[link(name = "library")]
2+
extern {
3+
fn overflow();
4+
}
5+
6+
fn main() {
7+
unsafe {
8+
overflow();
9+
}
10+
}

0 commit comments

Comments
 (0)