Fix crt detection for Arch Linux (#1705)

* Fix crt detection for arch linux

On archlinux, the crt is located directly in /usr/lib. Thus, the globbing done in find_linux_crt fails since it expects the crt to be in a subdirectory of /usr/lib. This patch fixes this issue.
This commit is contained in:
Guillaume M.
2024-12-24 04:03:53 +09:00
committed by GitHub
parent 0ff52311c3
commit bf74ef0e5e
2 changed files with 8 additions and 0 deletions

View File

@@ -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.

View File

@@ -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)
{