mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Add test for thin archive reading support
This commit is contained in:
parent
4f8042e22e
commit
a57f73d320
@ -271,6 +271,12 @@ impl LlvmAr {
|
||||
self
|
||||
}
|
||||
|
||||
/// Like `obj_to_ar` except creating a thin archive.
|
||||
pub fn obj_to_thin_ar(&mut self) -> &mut Self {
|
||||
self.cmd.arg("rcus").arg("--thin");
|
||||
self
|
||||
}
|
||||
|
||||
/// Extract archive members back to files.
|
||||
pub fn extract(&mut self) -> &mut Self {
|
||||
self.cmd.arg("x");
|
||||
|
10
tests/run-make/staticlib-thin-archive/bin.rs
Normal file
10
tests/run-make/staticlib-thin-archive/bin.rs
Normal file
@ -0,0 +1,10 @@
|
||||
#[link(name = "rust_archive", kind = "static")]
|
||||
extern "C" {
|
||||
fn simple_fn();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
simple_fn();
|
||||
}
|
||||
}
|
13
tests/run-make/staticlib-thin-archive/rmake.rs
Normal file
13
tests/run-make/staticlib-thin-archive/rmake.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Regression test for https://github.com/rust-lang/rust/issues/107407
|
||||
|
||||
use run_make_support::{llvm_ar, rustc, static_lib_name};
|
||||
|
||||
fn main() {
|
||||
rustc().input("simple_obj.rs").emit("obj").run();
|
||||
llvm_ar().obj_to_thin_ar().output_input(static_lib_name("thin_archive"), "simple_obj.o").run();
|
||||
rustc().input("rust_archive.rs").run();
|
||||
// Disable lld as it ignores the symbol table in the archive file.
|
||||
rustc()
|
||||
.input("bin.rs") /*.arg("-Zlinker-features=-lld")*/
|
||||
.run();
|
||||
}
|
4
tests/run-make/staticlib-thin-archive/rust_archive.rs
Normal file
4
tests/run-make/staticlib-thin-archive/rust_archive.rs
Normal file
@ -0,0 +1,4 @@
|
||||
#![crate_type = "staticlib"]
|
||||
|
||||
#[link(name = "thin_archive", kind = "static")]
|
||||
extern "C" {}
|
4
tests/run-make/staticlib-thin-archive/simple_obj.rs
Normal file
4
tests/run-make/staticlib-thin-archive/simple_obj.rs
Normal file
@ -0,0 +1,4 @@
|
||||
#![crate_type = "staticlib"]
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn simple_fn() {}
|
Loading…
Reference in New Issue
Block a user