mirror of
https://github.com/ziglang/zig.git
synced 2025-12-15 10:43:08 +00:00
compiler: Recognize libgcc_s regardless of target ABI.
The real libgcc_s is a compiler-provided library; it works just fine with both glibc and musl. There's no reason that I can see for this check to be limited to glibc-based targets.
This commit is contained in:
parent
f8372d030e
commit
37a34b54af
@ -3832,7 +3832,7 @@ fn createModule(
|
||||
create_module.opts.link_libcpp = true;
|
||||
continue;
|
||||
}
|
||||
switch (target_util.classifyCompilerRtLibName(target, lib_name)) {
|
||||
switch (target_util.classifyCompilerRtLibName(lib_name)) {
|
||||
.none => {},
|
||||
.only_libunwind, .both => {
|
||||
create_module.opts.link_libunwind = true;
|
||||
|
||||
@ -260,8 +260,8 @@ pub fn supportsReturnAddress(target: std.Target) bool {
|
||||
|
||||
pub const CompilerRtClassification = enum { none, only_compiler_rt, only_libunwind, both };
|
||||
|
||||
pub fn classifyCompilerRtLibName(target: std.Target, name: []const u8) CompilerRtClassification {
|
||||
if (target.abi.isGnu() and std.mem.eql(u8, name, "gcc_s")) {
|
||||
pub fn classifyCompilerRtLibName(name: []const u8) CompilerRtClassification {
|
||||
if (std.mem.eql(u8, name, "gcc_s")) {
|
||||
// libgcc_s includes exception handling functions, so if linking this library
|
||||
// is requested, zig needs to instead link libunwind. Otherwise we end up with
|
||||
// the linker unable to find `_Unwind_RaiseException` and other related symbols.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user