2022-10-12 16:44:01 -05:00
|
|
|
# Regression test for calling an inline function that uses a raw-dylib function.
|
|
|
|
|
|
|
|
# only-windows
|
|
|
|
|
2023-03-30 07:58:50 -05:00
|
|
|
include ../tools.mk
|
2022-10-12 16:44:01 -05:00
|
|
|
|
2022-08-05 14:08:53 -05:00
|
|
|
# We'd be using the llvm-objdump instead of the system objdump to ensure compatibility
|
|
|
|
# with the LLVM bitcode generated by rustc but on Windows piping/IO redirection under MSYS2 is wonky with llvm-objdump.
|
|
|
|
OBJDUMP = objdump
|
|
|
|
|
2022-10-12 16:44:01 -05:00
|
|
|
all:
|
|
|
|
$(RUSTC) --crate-type dylib --crate-name raw_dylib_test lib.rs -C prefer-dynamic
|
|
|
|
$(RUSTC) --crate-type dylib --crate-name raw_dylib_test_wrapper lib_wrapper.rs -C prefer-dynamic
|
|
|
|
$(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" -C prefer-dynamic
|
|
|
|
# Make sure we don't find an import to the functions we expect to be inlined.
|
2022-08-05 14:08:53 -05:00
|
|
|
$(OBJDUMP) -p $(TMPDIR)/driver.exe | $(CGREP) -v -e "inline_library_function"
|
|
|
|
$(OBJDUMP) -p $(TMPDIR)/driver.exe | $(CGREP) -v -e "inline_library_function_calls_inline"
|
2022-10-12 16:44:01 -05:00
|
|
|
# Make sure we do find an import to the functions we expect to be imported.
|
2022-08-05 14:08:53 -05:00
|
|
|
$(OBJDUMP) -p $(TMPDIR)/driver.exe | $(CGREP) -e "library_function"
|
2022-10-12 16:44:01 -05:00
|
|
|
$(call COMPILE_OBJ,"$(TMPDIR)"/extern_1.obj,extern_1.c)
|
|
|
|
$(call COMPILE_OBJ,"$(TMPDIR)"/extern_2.obj,extern_2.c)
|
|
|
|
ifdef IS_MSVC
|
|
|
|
$(CC) "$(TMPDIR)"/extern_1.obj -link -dll -out:"$(TMPDIR)"/extern_1.dll -noimplib
|
|
|
|
$(CC) "$(TMPDIR)"/extern_2.obj -link -dll -out:"$(TMPDIR)"/extern_2.dll -noimplib
|
|
|
|
else
|
|
|
|
$(CC) "$(TMPDIR)"/extern_1.obj -shared -o "$(TMPDIR)"/extern_1.dll
|
|
|
|
$(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll
|
|
|
|
endif
|
|
|
|
$(call RUN,driver) > "$(TMPDIR)"/output.txt
|
2023-10-07 01:23:10 -05:00
|
|
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
|