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.
Auto merge of rust-lang#132244 - jyn514:linker-refactors, r=bjorn3
fix various linker warnings separated out from rust-lang#119286; this doesn't have anything user-facing, i just want to land these changes so i can stop rebasing them. r? `@bjorn3`
- Loading branch information
Showing
12 changed files
with
194 additions
and
181 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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#![cfg_attr(any(weak, both), feature(link_arg_attribute))] | ||
|
||
#[cfg_attr(any(link, both), link(name = "CoreFoundation", kind = "framework"))] | ||
#[cfg_attr( | ||
any(weak, both), | ||
link(name = "-weak_framework", kind = "link-arg", modifiers = "+verbatim"), | ||
link(name = "CoreFoundation", kind = "link-arg", modifiers = "+verbatim") | ||
)] | ||
extern "C" { | ||
fn CFRunLoopGetTypeID() -> core::ffi::c_ulong; | ||
} | ||
|
||
fn main() { | ||
unsafe { | ||
CFRunLoopGetTypeID(); | ||
} | ||
} |
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,26 @@ | ||
//! Check that linking frameworks on Apple platforms works. | ||
|
||
//@ only-apple | ||
|
||
use run_make_support::{Rustc, run, rustc}; | ||
|
||
fn compile(cfg: &str) -> Rustc { | ||
let mut rustc = rustc(); | ||
rustc.cfg(cfg).input("main.rs"); | ||
rustc | ||
} | ||
|
||
fn main() { | ||
for cfg in ["link", "weak", "both"] { | ||
compile(cfg).run(); | ||
run("main"); | ||
} | ||
|
||
let errs = compile("omit").run_fail(); | ||
// The linker's exact error output changes between Xcode versions, depends on | ||
// linker invocation details, and the linker sometimes outputs more warnings. | ||
errs.assert_stderr_contains_regex(r"error: linking with `.*` failed"); | ||
errs.assert_stderr_contains_regex(r"(Undefined symbols|ld: symbol[^\s]* not found)"); | ||
errs.assert_stderr_contains_regex(r".?_CFRunLoopGetTypeID.?, referenced from:"); | ||
errs.assert_stderr_contains("clang: error: linker command failed with exit code 1"); | ||
} |
Oops, something went wrong.