-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
30 additions
and
19 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 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,25 @@ | ||
// When the compiler is performing link time optimization, it will | ||
// need to copy the original rlib file, set the copy's permissions to read/write, | ||
// and modify that copy - even if the original | ||
// file is read-only. This test creates a read-only rlib, and checks that | ||
// compilation with LTO succeeds. | ||
// See https://github.com/rust-lang/rust/pull/17619 | ||
|
||
//@ ignore-cross-compile | ||
|
||
use run_make_support::fs_wrapper; | ||
use run_make_support::{cwd, run, rustc}; | ||
|
||
fn main() { | ||
rustc().input("lib.rs").run(); | ||
let entries = fs_wrapper::read_dir(cwd()); | ||
for entry in entries { | ||
if entry.path().extension().and_then(|s| s.to_str()) == Some("rlib") { | ||
let mut perms = fs_wrapper::metadata(entry.path()).permissions(); | ||
perms.set_readonly(true); | ||
fs_wrapper::set_permissions(entry.path(), perms); | ||
} | ||
} | ||
rustc().input("main.rs").arg("-Clto").run(); | ||
run("main"); | ||
} |