rust/tests/run-make/no-alloc-shim/Makefile

25 lines
1.2 KiB
Makefile
Raw Normal View History

2022-09-11 09:01:03 -05:00
include ../tools.mk
# ignore-cross-compile
# ignore-msvc FIXME(bjorn3) can't figure out how to link with the MSVC toolchain
2022-09-11 09:01:03 -05:00
TARGET_LIBDIR = $$($(RUSTC) --print target-libdir)
all:
$(RUSTC) foo.rs --crate-type bin --emit obj -Cpanic=abort
ifdef IS_MSVC
2023-03-09 13:41:44 -06:00
$(CC) $(CFLAGS) $(TMPDIR)/foo.o $(call OUT_EXE,foo) /link $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib
2022-09-11 09:01:03 -05:00
$(call OUT_EXE,foo)
else
$(CC) $(CFLAGS) $(TMPDIR)/foo.o $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib -o $(call RUN_BINFILE,foo)
$(call RUN_BINFILE,foo)
endif
# Check that linking without __rust_no_alloc_shim_is_unstable defined fails
$(RUSTC) foo.rs --crate-type bin --emit obj -Cpanic=abort --cfg check_feature_gate
ifdef IS_MSVC
2023-03-09 13:41:44 -06:00
$(CC) $(CFLAGS) $(TMPDIR)/foo.o $(call OUT_EXE,foo) /link $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib || exit 0 && exit 1
2022-09-11 09:01:03 -05:00
else
$(CC) $(CFLAGS) $(TMPDIR)/foo.o $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib -o $(call RUN_BINFILE,foo) || exit 0 && exit 1
endif