summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/main.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 46a34f86..18570b83 100644
--- a/Makefile
+++ b/Makefile
@@ -206,7 +206,7 @@ rust_tests-run-pass: $(call DEF_RUST_TESTS,run-pass)
rust_tests-run-fail: $(call DEF_RUST_TESTS,run-fail)
#rust_tests-compile-fail: $(call DEF_RUST_TESTS,compile-fail)
-output/rust/test_run-pass_hello: $(RUST_TESTS_DIR)run-pass/hello.rs output/libstd.hir $(BIN)
+output/rust/test_run-pass_hello: $(RUST_TESTS_DIR)run-pass/hello.rs output/libstd.hir $(BIN) output/liballoc_system.hir output/libpanic_abort.hir
$(DBG) $(BIN) $< -o $@.c $(PIPECMD)
TEST_ARGS_run-pass/cfgs-on-items := --cfg fooA --cfg fooB
diff --git a/src/main.cpp b/src/main.cpp
index b8219c48..4d8c0b0a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -271,6 +271,14 @@ int main(int argc, char *argv[])
return 0;
}
+ // Allocator and panic strategies
+ if( crate.m_crate_type == ::AST::Crate::Type::Executable )
+ {
+ // TODO: Detect if an allocator crate is already present.
+ crate.load_extern_crate(Span(), "alloc_system");
+ crate.load_extern_crate(Span(), "panic_abort");
+ }
+
// Resolve names to be absolute names (include references to the relevant struct/global/function)
// - This does name checking on types and free functions.
// - Resolves all identifiers/paths to references