From aa40d61d5d8299ba72b390cabe4994bbf985c14c Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 5 May 2011 22:44:28 -0400 Subject: [PATCH] Link fuzzer to the rustc crate --- mk/fuzzer.mk | 12 +++++++++++- src/fuzzer/Fuzzer.rs | 3 ++- src/fuzzer/fuzzer.rc | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mk/fuzzer.mk b/mk/fuzzer.mk index d07db91a4f8..b68693238f4 100644 --- a/mk/fuzzer.mk +++ b/mk/fuzzer.mk @@ -5,6 +5,16 @@ FUZZER_CRATE := $(S)src/fuzzer/fuzzer.rc FUZZER_INPUTS := $(wildcard $(addprefix $(S)src/fuzzer/, *.rs)) -stage2/fuzzer.o: $(FUZZER_CRATE) $(FUZZER_INPUTS) $(SREQ1) +stage2/fuzzer.o: $(FUZZER_CRATE) $(FUZZER_INPUTS) $(SREQ1) \ + stage2/$(CFG_RUSTCLIB) @$(call E, compile: $@) $(STAGE1) -c -o $@ $< + +stage2/fuzzer$(X): stage2/fuzzer.o $(SREQ1) + @$(call E, link [gcc]: $@) + $(Q)gcc $(CFG_GCC_CFLAGS) stage2/glue.o -o $@ $< \ + -Lstage2 -Lrustllvm -Lrt -lrustrt -lrustllvm -lstd -lm -lrustc + @# dsymutil sometimes fails or prints a warning, but the + @# program still runs. Since it simplifies debugging other + @# programs, I\'ll live with the noise. + -$(Q)$(CFG_DSYMUTIL) $@ diff --git a/src/fuzzer/Fuzzer.rs b/src/fuzzer/Fuzzer.rs index ea3850b23a3..60db8ecbe27 100644 --- a/src/fuzzer/Fuzzer.rs +++ b/src/fuzzer/Fuzzer.rs @@ -1,2 +1,3 @@ -fn main() { +fn main(vec[str] args) { + rustc.driver.rustc.main(args); } \ No newline at end of file diff --git a/src/fuzzer/fuzzer.rc b/src/fuzzer/fuzzer.rc index 2f0758bffd5..abe6169655b 100644 --- a/src/fuzzer/fuzzer.rc +++ b/src/fuzzer/fuzzer.rc @@ -1,6 +1,7 @@ // -*- rust -*- use std; +use rustc; mod Fuzzer;