mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 04:24:33 +01:00
zig cc: Add support for -exported_symbols_list (#30628)
Resolves [unsupported linker arg: `-exported_symbols_list`](https://github.com/ziglang/zig/issues/24662) This PR has been tested with https://github.com/anttiharju/compare-changes/pull/117 (via commits like75b17b948e) where the `zig cc` ([via this wrapper](791129d401/.cargo/zcc/aarch64-apple-darwin.sh)) successfully builds a macOS binary (build would fail with zig 0.15.2): Co-authored-by: Gunnar Wagenknecht <gunnar@wagenknecht.org> Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30628 Reviewed-by: Andrew Kelley <andrew@ziglang.org> Co-authored-by: Antti Harju <anttiharju@noreply.codeberg.org> Co-committed-by: Antti Harju <anttiharju@noreply.codeberg.org>
This commit is contained in:
parent
b99dc12ece
commit
f695ca08e3
1 changed files with 11 additions and 0 deletions
11
src/main.zig
11
src/main.zig
|
|
@ -665,6 +665,7 @@ const usage_build_generic =
|
|||
\\ -weak_framework [name] (Darwin) link against framework and mark it and all referenced symbols as weak
|
||||
\\ -F[dir] (Darwin) add search path for frameworks
|
||||
\\ --export=[value] (WebAssembly) Force a symbol to be exported
|
||||
\\ --exported_symbols_list [file] (Darwin) Force symbols in the file to be exported
|
||||
\\
|
||||
\\Test Options:
|
||||
\\ --test-filter [text] Skip tests that do not match any filter
|
||||
|
|
@ -2612,6 +2613,16 @@ fn buildOutputType(
|
|||
};
|
||||
} else if (mem.eql(u8, arg, "--export")) {
|
||||
try linker_export_symbol_names.append(arena, linker_args_it.nextOrFatal());
|
||||
} else if (mem.eql(u8, arg, "-exported_symbols_list")) {
|
||||
const exported_symbols_list = linker_args_it.nextOrFatal();
|
||||
const content = Io.Dir.cwd().readFileAlloc(io, exported_symbols_list, arena, .limited(10 * 1024 * 1024)) catch |err| {
|
||||
fatal("unable to read exported symbols list '{s}': {s}", .{ exported_symbols_list, @errorName(err) });
|
||||
};
|
||||
var symbols_it = mem.splitScalar(u8, content, '\n');
|
||||
while (symbols_it.next()) |line| {
|
||||
if (line.len == 0) continue;
|
||||
try linker_export_symbol_names.append(arena, line);
|
||||
}
|
||||
} else if (mem.eql(u8, arg, "--compress-debug-sections")) {
|
||||
const arg1 = linker_args_it.nextOrFatal();
|
||||
linker_compress_debug_sections = std.meta.stringToEnum(std.zig.CompressDebugSections, arg1) orelse {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue