diff --git a/releasenotes.md b/releasenotes.md index 3e21d112a..a867b1ac1 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -16,6 +16,7 @@ - `static-lib` and `dynamic-lib` options from the command line now produces headers. - Fix bug outputting exported functions without predefined extname. - Fix problem where crt1 was linked for dynamic libraries on Linux and BSD. #1710 +- Fix CRT detection on Arch Linux. ### Stdlib changes - Increase BitWriter.write_bits limit up to 32 bits. diff --git a/src/compiler/linker.c b/src/compiler/linker.c index fb0a0fc5a..872f2afcd 100644 --- a/src/compiler/linker.c +++ b/src/compiler/linker.c @@ -308,6 +308,13 @@ static const char *find_arch_glob_path(const char *glob_path, int file_len) static const char *find_linux_crt(void) { if (compiler.build.linuxpaths.crt) return compiler.build.linuxpaths.crt; + const char *arch_linux_crt1_path = "/usr/lib/crt1.o"; + if (file_exists(arch_linux_crt1_path)) + { + const char *arch_linux_path = "/usr/lib"; + INFO_LOG("Found crt at %s", arch_linux_path); + return arch_linux_path; + } const char *path = find_arch_glob_path("/usr/lib/*/crt1.o", 6); if (!path) {