fix fedora dyn lib (#2917)

* also look into /usr/lib64
This commit is contained in:
g.denis
2026-02-10 23:12:04 +01:00
committed by GitHub
parent de8a733c77
commit a80e40a798

View File

@@ -383,17 +383,24 @@ static const char *find_linux_crt(void)
{ {
if (compiler.build.linuxpaths.crt) return compiler.build.linuxpaths.crt; if (compiler.build.linuxpaths.crt) return compiler.build.linuxpaths.crt;
const char *arch_linux_crt1_path = "/usr/lib/crt1.o"; const char *arch_linux_crt1_path = "/usr/lib/crt1.o";
const char *arch_linux_64_crt1_path = "/usr/lib64/crt1.o";
if (file_exists(arch_linux_crt1_path)) if (file_exists(arch_linux_crt1_path))
{ {
const char *arch_linux_path = "/usr/lib"; const char *arch_linux_path = "/usr/lib";
INFO_LOG("Found crt at %s", arch_linux_path); INFO_LOG("Found crt at %s", arch_linux_path);
return arch_linux_path; return arch_linux_path;
} }
if (file_exists(arch_linux_64_crt1_path))
{
const char* arch_linux_path = "/usr/lib64";
INFO_LOG("Found crt at %s", arch_linux_path);
return arch_linux_path;
}
const char *arch_glob_path = get_linux_crt_arch_glob(); const char *arch_glob_path = get_linux_crt_arch_glob();
const char *path = find_arch_glob_path(arch_glob_path, 6); const char *path = find_arch_glob_path(arch_glob_path, 6);
if (!path) if (!path)
{ {
INFO_LOG("No crt in /usr/lib/*/"); INFO_LOG("No crt in /usr/{lib,lib64}/*/");
return NULL; return NULL;
} }
INFO_LOG("Found crt at %s", path); INFO_LOG("Found crt at %s", path);
@@ -964,10 +971,10 @@ static bool link_exe(const char *output_file, const char **files_to_link, unsign
default: default:
UNREACHABLE UNREACHABLE
} }
#else #else
success = false; success = false;
error = "linking (.exe) is not implemented for C3C compiled without LLVM"; error = "linking (.exe) is not implemented for C3C compiled without LLVM";
#endif #endif
if (!success) if (!success)
{ {
error_exit("Failed to create an executable: %s", error); error_exit("Failed to create an executable: %s", error);
@@ -1221,10 +1228,10 @@ bool dynamic_lib_linker(const char *output_file, const char **files, unsigned fi
default: default:
UNREACHABLE UNREACHABLE
} }
#else #else
success = false; success = false;
error = "linking not implemented for c3c compiled without llvm"; error = "linking not implemented for c3c compiled without llvm";
#endif #endif
if (!success) if (!success)
{ {
error_exit("Failed to create a dynamic library: %s", error); error_exit("Failed to create a dynamic library: %s", error);
@@ -1256,9 +1263,9 @@ bool static_lib_linker(const char *output_file, const char **files, unsigned fil
break; break;
} }
return llvm_ar(output_file, files, file_count, format); return llvm_ar(output_file, files, file_count, format);
#else #else
return false; return false;
#endif #endif
} }
bool linker(const char *output_file, const char **files, unsigned file_count) bool linker(const char *output_file, const char **files, unsigned file_count)