Skip to content

Commit b8213bb

Browse files
committed
Enable raw-dylib for binaries
1 parent ca1e68b commit b8213bb

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,9 @@ fn add_local_native_libraries(
22122212
NativeLibKind::Dylib { as_needed } => {
22132213
cmd.link_dylib(name, verbatim, as_needed.unwrap_or(true))
22142214
}
2215-
NativeLibKind::Unspecified => cmd.link_dylib(name, verbatim, true),
2215+
NativeLibKind::RawDylib | NativeLibKind::Unspecified => {
2216+
cmd.link_dylib(name, verbatim, true)
2217+
}
22162218
NativeLibKind::Framework { as_needed } => {
22172219
cmd.link_framework(name, as_needed.unwrap_or(true))
22182220
}
@@ -2233,10 +2235,6 @@ fn add_local_native_libraries(
22332235
cmd.link_staticlib(name, verbatim)
22342236
}
22352237
}
2236-
NativeLibKind::RawDylib => {
2237-
// FIXME(#58713): Proper handling for raw dylibs.
2238-
bug!("raw_dylib feature not yet implemented");
2239-
}
22402238
}
22412239
}
22422240
}

src/test/run-make/raw-dylib-c/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ else
1616
endif
1717
$(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs
1818
$(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)"
19+
$(RUSTC) --crate-type bin --crate-name raw_dylib_test_bin lib.rs
1920
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
21+
"$(TMPDIR)"/raw_dylib_test_bin > "$(TMPDIR)"/output_bin.txt
2022

2123
ifdef RUSTC_BLESS_TEST
2224
cp "$(TMPDIR)"/output.txt output.txt
2325
else
2426
$(DIFF) output.txt "$(TMPDIR)"/output.txt
27+
$(DIFF) output.txt "$(TMPDIR)"/output_bin.txt
2528
endif

src/test/run-make/raw-dylib-c/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ pub fn library_function() {
2020
extern_fn_3();
2121
}
2222
}
23+
24+
fn main() {
25+
library_function();
26+
}

0 commit comments

Comments
 (0)