linking: remove check for target_supports_libunwind

I'm not sure why this was ever there. Maybe it was working around a
problem with LLVM 9. Anyway this fixes linking C++ code for 32 bit
arm and riscv.
This commit is contained in:
Andrew Kelley 2020-03-30 15:50:53 -04:00
parent 9e7ae06249
commit 6408766d6b
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
3 changed files with 2 additions and 20 deletions

View File

@ -1947,15 +1947,11 @@ static void construct_linker_job_elf(LinkJob *lj) {
lj->args.append("-lpthread");
}
} else if (target_is_glibc(g->zig_target)) {
if (target_supports_libunwind(g->zig_target)) {
lj->args.append(build_libunwind(g, lj->build_dep_prog_node));
}
lj->args.append(build_libunwind(g, lj->build_dep_prog_node));
add_glibc_libs(lj);
lj->args.append(get_libc_crt_file(g, "libc_nonshared.a", lj->build_dep_prog_node));
} else if (target_is_musl(g->zig_target)) {
if (target_supports_libunwind(g->zig_target)) {
lj->args.append(build_libunwind(g, lj->build_dep_prog_node));
}
lj->args.append(build_libunwind(g, lj->build_dep_prog_node));
lj->args.append(build_musl(g, lj->build_dep_prog_node));
} else if (g->libcpp_link_lib != nullptr) {
lj->args.append(build_libunwind(g, lj->build_dep_prog_node));

View File

@ -1295,19 +1295,6 @@ const char *target_arch_musl_name(ZigLLVM_ArchType arch) {
}
}
bool target_supports_libunwind(const ZigTarget *target) {
switch (target->arch) {
case ZigLLVM_arm:
case ZigLLVM_armeb:
case ZigLLVM_riscv32:
case ZigLLVM_riscv64:
return false;
default:
return true;
}
return true;
}
bool target_libc_needs_crti_crtn(const ZigTarget *target) {
if (target->arch == ZigLLVM_riscv32 || target->arch == ZigLLVM_riscv64 || target_is_android(target)) {
return false;

View File

@ -119,7 +119,6 @@ bool target_supports_stack_probing(const ZigTarget *target);
bool target_supports_sanitize_c(const ZigTarget *target);
bool target_has_debug_info(const ZigTarget *target);
const char *target_arch_musl_name(ZigLLVM_ArchType arch);
bool target_supports_libunwind(const ZigTarget *target);
uint32_t target_arch_pointer_bit_width(ZigLLVM_ArchType arch);
uint32_t target_arch_largest_atomic_bits(ZigLLVM_ArchType arch);