-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for Apple's -weak_framework linker argument
- Loading branch information
Showing
3 changed files
with
38 additions
and
21 deletions.
There are no files selected for viewing
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,8 @@ | ||
error: linking with `cc` failed: exit status: 1 | ||
| | ||
ld: Undefined symbols: | ||
_CFRunLoopGetTypeID, referenced from: | ||
clang: error: linker command failed with exit code 1 (use -v to see invocation) | ||
|
||
|
||
error: aborting due to 1 previous error | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, 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,30 @@ | ||
// Check that linking frameworks on Apple platforms works. | ||
//@ only-macos | ||
//@ revisions: omit link weak both | ||
//@ [omit]build-fail | ||
//@ [link]run-pass | ||
//@ [weak]run-pass | ||
//@ [both]run-pass | ||
|
||
// The linker's exact error output changes between Xcode versions. | ||
//@ compare-output-lines-by-subset | ||
//@ normalize-stderr-test: "Undefined symbols for architecture .*" -> "ld: Undefined symbols:" | ||
//@ normalize-stderr-test: "._CFRunLoopGetTypeID.," -> "_CFRunLoopGetTypeID," | ||
|
||
#![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; | ||
} | ||
|
||
pub fn main() { | ||
unsafe { | ||
CFRunLoopGetTypeID(); | ||
} | ||
} |
We're seeing test failures where "The actual stderr differed from the expected stderr." See https://issues.chromium.org/u/1/issues/332562251#comment1