| author | |
| committer | |
| log | fbe9233aa7a84a1c382f35510e71f06d597e2a19 |
| tree | c5373e65b70a3ec9ec4d4c3cdeeaed5ae70d9e4b |
| parent | cf4e9a27c5a0f370197837312307f40bb1d6685f |
| parent | 084724c689215fe3a647ceb9d8622faeb60da1ba |
| signature |
fix build on arm645 files changed, 41 insertions(+), 13 deletions(-)
src/codegen.cpp+2-8| ... | ... | @@ -7989,15 +7989,9 @@ static void detect_dynamic_linker(CodeGen *g) { |
| 7989 | 7989 | #if defined(ZIG_OS_LINUX) |
| 7990 | 7990 | { |
| 7991 | 7991 | Error err; |
| 7992 | static const char *dyn_tests[] = { | |
| 7993 | #if defined(ZIG_ARCH_X86_64) | |
| 7994 | "ld-linux-x86-64.so.2", | |
| 7995 | "ld-musl-x86_64.so.1", | |
| 7996 | #endif | |
| 7997 | }; | |
| 7998 | 7992 | Buf *result = buf_alloc(); |
| 7999 | for (size_t i = 0; i < array_length(dyn_tests); i += 1) { | |
| 8000 | const char *lib_name = dyn_tests[i]; | |
| 7993 | for (size_t i = 0; possible_ld_names[i] != NULL; i += 1) { | |
| 7994 | const char *lib_name = possible_ld_names[i]; | |
| 8001 | 7995 | if ((err = zig_libc_cc_print_file_name(lib_name, result, false, true))) { |
| 8002 | 7996 | if (err != ErrorCCompilerCannotFindFile) { |
| 8003 | 7997 | fprintf(stderr, "Unable to detect native dynamic linker: %s\n", err_str(err)); |
src/compiler.cpp+6-5| ... | ... | @@ -26,11 +26,12 @@ Buf *get_stage1_cache_path(void) { |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | static void detect_dynamic_linker(Buf *lib_path) { |
| 29 | #if defined(ZIG_OS_LINUX) && defined(ZIG_ARCH_X86_64) | |
| 30 | if (buf_ends_with_str(lib_path, "ld-linux-x86-64.so.2")) { | |
| 31 | buf_init_from_buf(&saved_dynamic_linker_path, lib_path); | |
| 32 | } else if (buf_ends_with_str(lib_path, "ld-musl-x86-64.so.1")) { | |
| 33 | buf_init_from_buf(&saved_dynamic_linker_path, lib_path); | |
| 29 | #if defined(ZIG_OS_LINUX) | |
| 30 | for (size_t i = 0; possible_ld_names[i] != NULL; i += 1) { | |
| 31 | if (buf_ends_with_str(lib_path, possible_ld_names[i])) { | |
| 32 | buf_init_from_buf(&saved_dynamic_linker_path, lib_path); | |
| 33 | break; | |
| 34 | } | |
| 34 | 35 | } |
| 35 | 36 | #endif |
| 36 | 37 | } |
src/os.cpp+18| ... | ... | @@ -2076,3 +2076,21 @@ void os_file_close(OsFile file) { |
| 2076 | 2076 | close(file); |
| 2077 | 2077 | #endif |
| 2078 | 2078 | } |
| 2079 | ||
| 2080 | #ifdef ZIG_OS_LINUX | |
| 2081 | const char *possible_ld_names[] = { | |
| 2082 | #if defined(ZIG_ARCH_X86_64) | |
| 2083 | "ld-linux-x86-64.so.2", | |
| 2084 | "ld-musl-x86_64.so.1", | |
| 2085 | #elif defined(ZIG_ARCH_ARM64) | |
| 2086 | "ld-linux-aarch64.so.1", | |
| 2087 | "ld-musl-aarch64.so.1", | |
| 2088 | #elif defined(ZIG_ARCH_ARM) | |
| 2089 | "ld-linux-armhf.so.3", | |
| 2090 | "ld-musl-armhf.so.1", | |
| 2091 | "ld-linux.so.3", | |
| 2092 | "ld-musl-arm.so.1", | |
| 2093 | #endif | |
| 2094 | NULL, | |
| 2095 | }; | |
| 2096 | #endif |
src/os.hpp+8| ... | ... | @@ -33,10 +33,18 @@ |
| 33 | 33 | |
| 34 | 34 | #if defined(__x86_64__) |
| 35 | 35 | #define ZIG_ARCH_X86_64 |
| 36 | #elif defined(__aarch64__) | |
| 37 | #define ZIG_ARCH_ARM64 | |
| 38 | #elif defined(__ARM_EABI__) | |
| 39 | #define ZIG_ARCH_ARM | |
| 36 | 40 | #else |
| 37 | 41 | #define ZIG_ARCH_UNKNOWN |
| 38 | 42 | #endif |
| 39 | 43 | |
| 44 | #ifdef ZIG_OS_LINUX | |
| 45 | extern const char *possible_ld_names[]; | |
| 46 | #endif | |
| 47 | ||
| 40 | 48 | #if defined(ZIG_OS_WINDOWS) |
| 41 | 49 | #define ZIG_PRI_usize "I64u" |
| 42 | 50 | #define ZIG_PRI_u64 "I64u" |
std/special/bootstrap.zig+7| ... | ... | @@ -171,6 +171,13 @@ fn linuxSetThreadArea(addr: usize) void { |
| 171 | 171 | // acrh_prctl is documented to never fail |
| 172 | 172 | assert(rc == 0); |
| 173 | 173 | }, |
| 174 | builtin.Arch.aarch64 => { | |
| 175 | asm volatile ( | |
| 176 | \\ msr tpidr_el0,x0 | |
| 177 | \\ mov w0,#0 | |
| 178 | \\ ret | |
| 179 | ); | |
| 180 | }, | |
| 174 | 181 | else => @compileError("Unsupported architecture"), |
| 175 | 182 | } |
| 176 | 183 | } |