Skip to content

Commit 47cab49

Browse files
committed
Ensure using otool that framework linking actually happened
1 parent 72ebc0f commit 47cab49

7 files changed

+44
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# only-macos
2+
#
3+
# Check that linking to a framework actually makes it to the linker.
4+
5+
include ../tools.mk
6+
7+
all:
8+
$(RUSTC) dep-link-framework.rs
9+
$(RUSTC) dep-link-weak-framework.rs
10+
11+
$(RUSTC) empty.rs
12+
otool -L $(TMPDIR)/no-link | $(CGREP) -v CoreFoundation
13+
14+
$(RUSTC) link-framework.rs
15+
otool -L $(TMPDIR)/link-framework | $(CGREP) CoreFoundation | $(CGREP) -v weak
16+
17+
$(RUSTC) link-weak-framework.rs
18+
otool -L $(TMPDIR)/link-weak-framework | $(CGREP) CoreFoundation | $(CGREP) weak
19+
20+
# When linking the framework both normally, and weakly, the weak linking takes preference
21+
22+
$(RUSTC) link-both.rs
23+
otool -L $(TMPDIR)/link-both | $(CGREP) CoreFoundation | $(CGREP) weak
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#![crate_type = "rlib"]
2+
3+
#[link(name = "CoreFoundation", kind = "framework")]
4+
extern "C" {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![crate_type = "rlib"]
2+
#![feature(link_arg_attribute)]
3+
4+
#[link(name = "-weak_framework", kind = "link-arg", modifiers = "+verbatim")]
5+
#[link(name = "CoreFoundation", kind = "link-arg", modifiers = "+verbatim")]
6+
extern "C" {}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
extern crate dep_link_framework;
2+
extern crate dep_link_weak_framework;
3+
4+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
extern crate dep_link_framework;
2+
3+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
extern crate dep_link_weak_framework;
2+
3+
fn main() {}

0 commit comments

Comments
 (0)