forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#137017 - bjorn3:ignore_invalid_bitcode, r=oli-obk Don't error when adding a staticlib with bitcode files compiled by newer LLVM cc rust-lang#128955 (comment)
- Loading branch information
Showing
3 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Regression test for https://github.com/rust-lang/rust/issues/128955#issuecomment-2657811196 | ||
// which checks that rustc can read an archive containing LLVM bitcode with a | ||
// newer version from the one rustc links against. | ||
use run_make_support::{llvm_ar, path, rfs, rustc, static_lib_name}; | ||
|
||
fn main() { | ||
rfs::create_dir("archive"); | ||
|
||
let mut bitcode = b"BC\xC0\xDE".to_vec(); | ||
bitcode.extend(std::iter::repeat(b'a').take(50)); | ||
rfs::write("archive/invalid_bitcode.o", &bitcode); | ||
|
||
llvm_ar() | ||
.arg("rcuS") // like obj_to_ar() except skips creating a symbol table | ||
.output_input( | ||
path("archive").join(static_lib_name("thin_archive")), | ||
"archive/invalid_bitcode.o", | ||
) | ||
.run(); | ||
|
||
// Build an rlib which includes the members of this thin archive | ||
rustc().input("rust_lib.rs").library_search_path("archive").run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#![crate_type = "rlib"] | ||
|
||
#[link(name = "thin_archive", kind = "static")] | ||
extern "C" { | ||
pub fn simple_fn(); | ||
} |