Skip to content

Commit caa964b

Browse files
authored
Merge pull request #236 from zanieb/zb/zig-build
Use POSIX `-u` instead of GNU `--undefined` for zig linker support
2 parents 0c4c659 + ce817c0 commit caa964b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cargo-auditable/src/rustc_wrapper.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@ fn rustc_command_with_audit_data(rustc_path: &OsStr) -> Option<Command> {
137137
} else if is_wasm(&target_info) {
138138
// We don't emit the symbol name in WASM, so nothing to do
139139
} else {
140-
// Unrecognized platform, assume it to be unix-like
141-
#[allow(clippy::collapsible_else_if)]
140+
// Unrecognized platform, assume it to be unix-like.
141+
// Use POSIX `-u` instead of GNU `--undefined=` for broad compatibility
142+
// (e.g. zig rejects the GNU form).
142143
if args.bare_linker() {
143-
command.arg("-Clink-arg=--undefined=AUDITABLE_VERSION_INFO");
144+
command.arg("-Clink-arg=-u");
145+
command.arg("-Clink-arg=AUDITABLE_VERSION_INFO");
144146
} else {
145-
command.arg("-Clink-arg=-Wl,--undefined=AUDITABLE_VERSION_INFO");
147+
command.arg("-Clink-arg=-Wl,-u,AUDITABLE_VERSION_INFO");
146148
}
147149
}
148150
Some(command)

0 commit comments

Comments
 (0)