aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/rust/Make-lang.in11
-rw-r--r--gcc/rust/lang.opt4
-rw-r--r--gcc/rust/rust-session-manager.cc5
3 files changed, 17 insertions, 3 deletions
diff --git a/gcc/rust/Make-lang.in b/gcc/rust/Make-lang.in
index 8f10396..9f0d638 100644
--- a/gcc/rust/Make-lang.in
+++ b/gcc/rust/Make-lang.in
@@ -49,6 +49,13 @@ GCCRS_D_OBJS = \
rust/rustspec.o \
$(END)
+RUST_CXXFLAGS = $(CXXFLAGS)
+
+# If the file exists, we're bootstrapping
+ifneq ($(wildcard ../stage_current)),)
+RUST_CXXFLAGS += -DRUST_RELEASE
+endif
+
gccrs$(exeext): $(GCCRS_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(GCCRS_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
@@ -269,7 +276,7 @@ rust.uninstall:
# Enable selftests for the rust frontend
selftest-rust: s-selftest-rust
-RUST_SELFTEST_FLAGS = -xrust $(SELFTEST_FLAGS)
+RUST_SELFTEST_FLAGS = -xrust -frust-incomplete-and-experimental-compiler-do-not-use $(SELFTEST_FLAGS)
RUST_SELFTEST_DEPS = rust1$(exeext) $(SELFTEST_DEPS)
# Run the rust selftests
@@ -331,8 +338,6 @@ CFLAGS-rust/rust-lex.o += $(RUST_INCLUDES)
CFLAGS-rust/rust-parse.o += $(RUST_INCLUDES)
CFLAGS-rust/rust-session-manager.o += $(RUST_INCLUDES)
-RUST_CXXFLAGS = $(CXXFLAGS)
-
# build all rust/lex files in rust folder, add cross-folder includes
rust/%.o: rust/lex/%.cc
$(COMPILE) $(RUST_CXXFLAGS) $(RUST_INCLUDES) $<
diff --git a/gcc/rust/lang.opt b/gcc/rust/lang.opt
index 40297ad..155892d 100644
--- a/gcc/rust/lang.opt
+++ b/gcc/rust/lang.opt
@@ -74,6 +74,10 @@ frust-mangling=
Rust Joined RejectNegative Enum(frust_mangling) Var(flag_rust_mangling)
-frust-mangling=[legacy|v0] Choose which version to use for name mangling
+frust-incomplete-and-experimental-compiler-do-not-use
+Rust Var(flag_rust_experimental)
+Enable experimental compilation of Rust files at your own risk
+
Enum
Name(frust_mangling) Type(int) UnknownError(unknown rust mangling option %qs)
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 513bf50..79bf552 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -427,6 +427,11 @@ Session::handle_crate_name (const AST::Crate &parsed_crate)
void
Session::compile_crate (const char *filename)
{
+#ifdef RUST_RELEASE
+ if (!flag_rust_experimental)
+ gcc_unreachable ();
+#endif
+
RAIIFile file_wrap (filename);
if (!file_wrap.ok ())
{