Skip to content

Commit 145b843

Browse files
committed
Use cfg_attr for switching link attrs in libunwind.
1 parent adce670 commit 145b843

File tree

1 file changed

+17
-33
lines changed

1 file changed

+17
-33
lines changed

src/libstd/sys/common/libunwind.rs

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -99,39 +99,23 @@ pub type _Unwind_Exception_Cleanup_Fn =
9999
extern "C" fn(unwind_code: _Unwind_Reason_Code,
100100
exception: *mut _Unwind_Exception);
101101

102-
#[cfg(any(all(target_os = "linux", not(target_env = "musl")),
103-
target_os = "freebsd"))]
104-
#[link(name = "gcc_s")]
105-
extern {}
106-
107-
#[cfg(all(target_os = "linux", target_env = "musl", not(test)))]
108-
#[link(name = "unwind", kind = "static")]
109-
extern {}
110-
111-
#[cfg(any(target_os = "android", target_os = "openbsd"))]
112-
#[link(name = "gcc")]
113-
extern {}
114-
115-
#[cfg(all(target_os = "netbsd", not(target_vendor = "rumprun")))]
116-
#[link(name = "gcc")]
117-
extern {}
118-
119-
#[cfg(all(target_os = "netbsd", target_vendor = "rumprun"))]
120-
#[link(name = "unwind")]
121-
extern {}
122-
123-
#[cfg(target_os = "dragonfly")]
124-
#[link(name = "gcc_pic")]
125-
extern {}
126-
127-
#[cfg(target_os = "bitrig")]
128-
#[link(name = "c++abi")]
129-
extern {}
130-
131-
#[cfg(all(target_os = "windows", target_env="gnu"))]
132-
#[link(name = "gcc_eh")]
133-
extern {}
134-
102+
#[cfg_attr(any(all(target_os = "linux", not(target_env = "musl")),
103+
target_os = "freebsd"),
104+
link(name = "gcc_s"))]
105+
#[cfg_attr(all(target_os = "linux", target_env = "musl", not(test)),
106+
link(name = "unwind", kind = "static"))]
107+
#[cfg_attr(any(target_os = "android", target_os = "openbsd"),
108+
link(name = "gcc"))]
109+
#[cfg_attr(all(target_os = "netbsd", not(target_vendor = "rumprun")),
110+
link(name = "gcc"))]
111+
#[cfg_attr(all(target_os = "netbsd", target_vendor = "rumprun"),
112+
link(name = "unwind"))]
113+
#[cfg_attr(target_os = "dragonfly",
114+
link(name = "gcc_pic"))]
115+
#[cfg_attr(target_os = "bitrig",
116+
link(name = "c++abi"))]
117+
#[cfg_attr(all(target_os = "windows", target_env="gnu"),
118+
link(name = "gcc_eh"))]
135119
extern "C" {
136120
// iOS on armv7 uses SjLj exceptions and requires to link
137121
// against corresponding routine (..._SjLj_...)

0 commit comments

Comments
 (0)