You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As sort of a followup to #167, I've been trying out cargo-auditable with cargo-zigbuild. The subcommand part works fine, but it looks like it fails at the linker stage.
zig uses its own linker, which messes with auditable's assumption that there will always be a GNU-compatible linker on a Linux target. I've been looking into the zig linker and trying to see if there's a good option. zig lld-link -help shows relevant-looking flags with similar syntax to MSVC:
/include:<value> Force symbol to be added to symbol table as undefined one
/includeoptional:<value>
Add symbol as undefined, but allow it to remain undefined
I haven't worked out how to get it to actually use them yet though - zig cc -Wl,/include:blah complains with the same error: unsupported linker arg error as with --undefined.
Here's the end of the output from a cargo auditable zigbuild build run:
zig lld-link -help shows relevant-looking flags with similar syntax to MSVC:
That is because zig lld-link is literally for calling LLD's counterpart to MSVC link.exe. zig ld.lld would be a bare Unix linker, though on Unix you need a wrapper like gcc, clang or zig cc around the bare linker to successfully link.
Found the linker options in zig cc; looks like the specific one we want might not be exposed.
Yes, it seems this is an issue on the Zig side - it doesn't recognize the --undefined argument at all, which we need to reliably inject audit data and make sure it's not removed by the linker as unused, e.g. when performing LTO.
Unfortunately there seems to be nothing I can do about this in cargo auditable. This flag needs to be added to Zig.
As sort of a followup to #167, I've been trying out
cargo-auditable
withcargo-zigbuild
. The subcommand part works fine, but it looks like it fails at the linker stage.zig uses its own linker, which messes with auditable's assumption that there will always be a GNU-compatible linker on a Linux target. I've been looking into the zig linker and trying to see if there's a good option.
zig lld-link -help
shows relevant-looking flags with similar syntax to MSVC:I haven't worked out how to get it to actually use them yet though -
zig cc -Wl,/include:blah
complains with the sameerror: unsupported linker arg
error as with--undefined
.Here's the end of the output from a
cargo auditable zigbuild build
run:The text was updated successfully, but these errors were encountered: