From d2f92e1797cf30c2fb0993d7e09de73e496144f5 Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Sat, 3 May 2025 06:32:15 +0200 Subject: compiler: Link libunwind when linking glibc statically. glibc's libc.a depends on the functions provided by libunwind. --- src/target.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/target.zig') diff --git a/src/target.zig b/src/target.zig index 1bafb1b8f7..21b701fc37 100644 --- a/src/target.zig +++ b/src/target.zig @@ -23,6 +23,10 @@ pub fn osRequiresLibC(target: std.Target) bool { return target.os.requiresLibC(); } +pub fn libCNeedsLibUnwind(target: std.Target, link_mode: std.builtin.LinkMode) bool { + return target.isGnuLibC() and link_mode == .static; +} + pub fn libCxxNeedsLibUnwind(target: std.Target) bool { return switch (target.os.tag) { .macos, -- cgit v1.2.3