forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix review comments and other improvements
- Loading branch information
Showing
6 changed files
with
34 additions
and
24 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
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 |
---|---|---|
@@ -1,10 +1,5 @@ | ||
#[link(name = "rust_archive", kind = "static")] | ||
extern "C" { | ||
fn simple_fn(); | ||
} | ||
|
||
fn main() { | ||
unsafe { | ||
simple_fn(); | ||
rust_lib::simple_fn(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,28 @@ | ||
// Regression test for https://github.com/rust-lang/rust/issues/107407 | ||
// Regression test for https://github.com/rust-lang/rust/issues/107407 which | ||
// checks that rustc can read thin archive. Before the object crate added thin | ||
// archive support rustc would add emit object files to the staticlib and after | ||
// the object crate added thin archive support it would previously crash the | ||
// compiler due to a missing special case for thin archive members. | ||
use std::path::Path; | ||
|
||
use run_make_support::{llvm_ar, rustc, static_lib_name}; | ||
use run_make_support::{llvm_ar, rust_lib_name, 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")*/ | ||
std::fs::create_dir("archive").unwrap(); | ||
|
||
// Build a thin archive | ||
rustc().input("simple_obj.rs").emit("obj").output("archive/simple_obj.o").run(); | ||
llvm_ar() | ||
.obj_to_thin_ar() | ||
.output_input( | ||
Path::new("archive").join(static_lib_name("thin_archive")), | ||
"archive/simple_obj.o", | ||
) | ||
.run(); | ||
|
||
// Build an rlib which includes the members of this thin archive | ||
rustc().input("rust_lib.rs").library_search_path("archive").run(); | ||
|
||
// Build a binary which requires a symbol from the thin archive | ||
rustc().input("bin.rs").extern_("rust_lib", rust_lib_name("rust_lib")).run(); | ||
} |
This file was deleted.
Oops, something went wrong.
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(); | ||
} |