commit
fbe9233aa7
|
@ -7989,15 +7989,9 @@ static void detect_dynamic_linker(CodeGen *g) {
|
|||
#if defined(ZIG_OS_LINUX)
|
||||
{
|
||||
Error err;
|
||||
static const char *dyn_tests[] = {
|
||||
#if defined(ZIG_ARCH_X86_64)
|
||||
"ld-linux-x86-64.so.2",
|
||||
"ld-musl-x86_64.so.1",
|
||||
#endif
|
||||
};
|
||||
Buf *result = buf_alloc();
|
||||
for (size_t i = 0; i < array_length(dyn_tests); i += 1) {
|
||||
const char *lib_name = dyn_tests[i];
|
||||
for (size_t i = 0; possible_ld_names[i] != NULL; i += 1) {
|
||||
const char *lib_name = possible_ld_names[i];
|
||||
if ((err = zig_libc_cc_print_file_name(lib_name, result, false, true))) {
|
||||
if (err != ErrorCCompilerCannotFindFile) {
|
||||
fprintf(stderr, "Unable to detect native dynamic linker: %s\n", err_str(err));
|
||||
|
|
|
@ -26,11 +26,12 @@ Buf *get_stage1_cache_path(void) {
|
|||
}
|
||||
|
||||
static void detect_dynamic_linker(Buf *lib_path) {
|
||||
#if defined(ZIG_OS_LINUX) && defined(ZIG_ARCH_X86_64)
|
||||
if (buf_ends_with_str(lib_path, "ld-linux-x86-64.so.2")) {
|
||||
buf_init_from_buf(&saved_dynamic_linker_path, lib_path);
|
||||
} else if (buf_ends_with_str(lib_path, "ld-musl-x86-64.so.1")) {
|
||||
buf_init_from_buf(&saved_dynamic_linker_path, lib_path);
|
||||
#if defined(ZIG_OS_LINUX)
|
||||
for (size_t i = 0; possible_ld_names[i] != NULL; i += 1) {
|
||||
if (buf_ends_with_str(lib_path, possible_ld_names[i])) {
|
||||
buf_init_from_buf(&saved_dynamic_linker_path, lib_path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
18
src/os.cpp
18
src/os.cpp
|
@ -2076,3 +2076,21 @@ void os_file_close(OsFile file) {
|
|||
close(file);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ZIG_OS_LINUX
|
||||
const char *possible_ld_names[] = {
|
||||
#if defined(ZIG_ARCH_X86_64)
|
||||
"ld-linux-x86-64.so.2",
|
||||
"ld-musl-x86_64.so.1",
|
||||
#elif defined(ZIG_ARCH_ARM64)
|
||||
"ld-linux-aarch64.so.1",
|
||||
"ld-musl-aarch64.so.1",
|
||||
#elif defined(ZIG_ARCH_ARM)
|
||||
"ld-linux-armhf.so.3",
|
||||
"ld-musl-armhf.so.1",
|
||||
"ld-linux.so.3",
|
||||
"ld-musl-arm.so.1",
|
||||
#endif
|
||||
NULL,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -33,10 +33,18 @@
|
|||
|
||||
#if defined(__x86_64__)
|
||||
#define ZIG_ARCH_X86_64
|
||||
#elif defined(__aarch64__)
|
||||
#define ZIG_ARCH_ARM64
|
||||
#elif defined(__ARM_EABI__)
|
||||
#define ZIG_ARCH_ARM
|
||||
#else
|
||||
#define ZIG_ARCH_UNKNOWN
|
||||
#endif
|
||||
|
||||
#ifdef ZIG_OS_LINUX
|
||||
extern const char *possible_ld_names[];
|
||||
#endif
|
||||
|
||||
#if defined(ZIG_OS_WINDOWS)
|
||||
#define ZIG_PRI_usize "I64u"
|
||||
#define ZIG_PRI_u64 "I64u"
|
||||
|
|
|
@ -171,6 +171,13 @@ fn linuxSetThreadArea(addr: usize) void {
|
|||
// acrh_prctl is documented to never fail
|
||||
assert(rc == 0);
|
||||
},
|
||||
builtin.Arch.aarch64 => {
|
||||
asm volatile (
|
||||
\\ msr tpidr_el0,x0
|
||||
\\ mov w0,#0
|
||||
\\ ret
|
||||
);
|
||||
},
|
||||
else => @compileError("Unsupported architecture"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue