Skip to content

Commit d87c536

Browse files
committed
[WIP] Add test
1 parent 736ef0a commit d87c536

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Regression test for https://github.com/rust-lang/rust/issues/128955#issuecomment-2657811196
2+
// which checks that rustc can read an archive containing LLVM bitcode with a
3+
// newer version from the one rustc links against.
4+
use run_make_support::{llvm_ar, path, rfs, rustc, static_lib_name};
5+
6+
fn main() {
7+
rfs::create_dir("archive");
8+
9+
let mut bitcode = b"BC\xC0\xDE".to_vec();
10+
bitcode.extend(std::iter::repeat(b'a').take(50));
11+
rfs::write("archive/invalid_bitcode.o", &bitcode);
12+
13+
llvm_ar()
14+
.obj_to_thin_ar()
15+
.output_input(
16+
path("archive").join(static_lib_name("thin_archive")),
17+
"archive/invalid_bitcode.o",
18+
)
19+
.run();
20+
21+
// Build an rlib which includes the members of this thin archive
22+
rustc().input("rust_lib.rs").library_search_path("archive").run();
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![crate_type = "rlib"]
2+
3+
#[link(name = "thin_archive", kind = "static")]
4+
extern "C" {
5+
pub fn simple_fn();
6+
}

0 commit comments

Comments
 (0)