Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loongarch64-linux-gnu #166

Open
yxd-ym opened this issue Jan 25, 2024 · 15 comments
Open

loongarch64-linux-gnu #166

yxd-ym opened this issue Jan 25, 2024 · 15 comments

Comments

@yxd-ym
Copy link
Contributor

yxd-ym commented Jan 25, 2024

It seems that the result is the same as #164

I'm working on this patch to try to make it work.

system:

OS: loongarchlinux
GCC:

$ gcc --version
gcc (GCC) 13.2.1 20230906
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[15/20] Running zig1.wasm to produce /home/yxd/playspace/zig-bootstrap/out/build-zig-host/zig2.c
FAILED: zig2.c /home/yxd/playspace/zig-bootstrap/out/build-zig-host/zig2.c
cd /home/yxd/playspace/zig-bootstrap/zig && /home/yxd/playspace/zig-bootstrap/out/build-zig-host/zig1 /home/yxd/playspace/zig-bootstrap/zig/lib build-exe -ofmt=c -lc -OReleaseSmall --name zig2 -femit-bin="/home/yxd/playspace/zig-bootstrap/out/build-zig-host/zig2.c" -target loongarch64-linux --dep build_options --dep aro --mod root src/main.zig --mod build_options /home/yxd/playspace/zig-bootstrap/out/build-zig-host/config.zig --mod aro_options src/stubs/aro_options.zig --mod Builtins/Builtin.def src/stubs/aro_builtins.zig --mod Attribute/names.def src/stubs/aro_names.zig --mod Diagnostics/messages.def src/stubs/aro_messages.zig --dep build_options=aro_options --mod aro_backend deps/aro/backend.zig --dep Builtins/Builtin.def --dep Attribute/names.def --dep Diagnostics/messages.def --dep build_options=aro_options --dep backend=aro_backend --mod aro deps/aro/aro.zig
/lib/std/os/linux.zig:77:28: error: struct 'os.linux.arch_bits__struct_7806' has no member named 'ino_t'
/lib/std/os/linux.zig:46:13: note: struct declared here
/lib/std/os/linux.zig:113:33: error: struct 'os.linux.arch_bits__struct_7806' has no member named 'MAP'
/lib/std/os/linux.zig:46:13: note: struct declared here
/lib/std/os/linux.zig:145:33: error: struct 'os.linux.arch_bits__struct_7806' has no member named 'O'
/lib/std/os/linux.zig:46:13: note: struct declared here
/lib/std/os/linux.zig:83:28: error: struct 'os.linux.arch_bits__struct_7806' has no member named 'off_t'
/lib/std/os/linux.zig:46:13: note: struct declared here
/lib/std/os/linux.zig:48:34: error: struct 'os.linux.arch_bits__struct_7806' has no member named 'syscall0'
/lib/std/os/linux.zig:46:13: note: struct declared here
/lib/std/os/linux.zig:52:34: error: struct 'os.linux.arch_bits__struct_7806' has no member named 'syscall4'
/lib/std/os/linux.zig:46:13: note: struct declared here
/lib/std/os/linux.zig:51:34: error: struct 'os.linux.arch_bits__struct_7806' has no member named 'syscall3'
/lib/std/os/linux.zig:46:13: note: struct declared here
ninja: build stopped: subcommand failed.
@nektro
Copy link

nektro commented Jan 25, 2024

loongarch64 support was added in glibc 2.36

@andrewrk
Copy link
Member

Those error indicate missing loongarch-specific logic in the zig standard library.

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Jan 28, 2024

system:

OS: loongarchlinux

Kernel:

$ uname -s -r -v -m -o
Linux 6.7.0-6 #1 SMP PREEMPT Tue, 09 Jan 2024 11:51:31 +0000 loongarch64 GNU/Linux

GCC:

$ gcc --version
gcc (GCC) 13.2.1 20230906
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

binutils: 2.41-3

glibc:

$ /usr/lib64/libc.so.6
GNU C Library (GNU libc) stable release version 2.38.
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 13.2.1 20230906.
libc ABIs: UNIQUE ABSOLUTE
Minimum supported kernel: 5.19.0
For bug reporting instructions, please see:
<https://bugs.archlinux.org/>.

With this patch, the error log is as follows:

-- Build files have been written to: /home/yxd/playspace/zig-bootstrap/out/build-zig-host
[1/5] Building C object CMakeFiles/zig2.dir/compiler_rt.c.o
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘ceill’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:17858:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
17858 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:17854:10: note: source object ‘t0’ of size 8
17854 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘cosl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:18142:2: warning: ‘memcpy’ reading 16 bytes from a region of size
8 [-Wstringop-overread]
18142 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:18138:10: note: source object ‘t0’ of size 8
18138 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘expl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:18526:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
18526 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:18522:10: note: source object ‘t0’ of size 8
18522 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘exp2l’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:18867:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
18867 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:18863:10: note: source object ‘t0’ of size 8
18863 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘fabsl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:18931:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
18931 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:18927:10: note: source object ‘t0’ of size 8
18927 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘floorl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:19243:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
19243 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:19239:10: note: source object ‘t0’ of size 8
19239 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘fmal’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:19623:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
19623 |  memcpy(&t3, &t2, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:19617:10: note: source object ‘t2’ of size 8
19617 |  zig_f64 t2;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘fmaxl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:19824:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
19824 |  memcpy(&t2, &t1, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:19819:10: note: source object ‘t1’ of size 8
19819 |  zig_f64 t1;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘fminl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:20025:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
20025 |  memcpy(&t2, &t1, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:20020:10: note: source object ‘t1’ of size 8
20020 |  zig_f64 t1;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘fmodl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:21285:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
21285 |  memcpy(&t2, &t1, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:21280:10: note: source object ‘t1’ of size 8
21280 |  zig_f64 t1;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘logl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:21613:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
21613 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:21609:10: note: source object ‘t0’ of size 8
21609 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘log10l’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:22006:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
22006 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:22002:10: note: source object ‘t0’ of size 8
22002 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘log2l’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:22393:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
22393 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:22389:10: note: source object ‘t0’ of size 8
22389 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘roundl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:22699:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
22699 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:22695:10: note: source object ‘t0’ of size 8
22695 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘sinl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:23013:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
23013 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:23009:10: note: source object ‘t0’ of size 8
23009 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘sqrtl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:24093:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
24093 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:24089:10: note: source object ‘t0’ of size 8
24089 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘tanl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:24341:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
24341 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:24337:10: note: source object ‘t0’ of size 8
24337 |  zig_f64 t0;
      |          ^~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c: In function ‘truncl’:
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:24527:2: warning: ‘memcpy’ reading 16 bytes from a region of size 8 [-Wstringop-overread]
24527 |  memcpy(&t1, &t0, sizeof(zig_c_longdouble));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yxd/playspace/zig-bootstrap/out/build-zig-host/compiler_rt.c:24523:10: note: source object ‘t0’ of size 8
24523 |  zig_f64 t0;
      |          ^~
[2/5] Building C object CMakeFiles/zig2.dir/zig2.c.o
[3/5] Linking CXX executable zig2
FAILED: zig2
: && /usr/bin/c++ -O3 -DNDEBUG -Wl,-z,stack-size=0x10000000 CMakeFiles/zig2.dir/zig2.c.o CMakeFiles/zig2.dir/compiler_rt.c.o -o zig2 -L/home/yxd/playspace/zig-bootstrap/out/host/lib -Wl,-rpath,/home/yxd/playspace/zig-bootstrap/out/host/lib  zigcpp/libzigcpp.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangFrontendTool.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangCodeGen.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangFrontend.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangDriver.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangSerialization.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangSema.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangStaticAnalyzerFrontend.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangStaticAnalyzerCheckers.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangStaticAnalyzerCore.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangAnalysis.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangASTMatchers.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangAST.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangParse.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangSema.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangStaticAnalyzerFrontend.a  /home/yxd/playspace
/zig-bootstrap/out/host/lib/libclangStaticAnalyzerCheckers.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangStaticAnalyzerCore.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangAnalysis.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangASTMatchers.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangAST.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangParse.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangBasic.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangEdit.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangLex.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangARCMigrate.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangRewriteFrontend.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangRewrite.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangCrossTU.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangIndex.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangToolingCore.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangExtractAPI.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/libclangSupport.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/liblldMinGW.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/liblldELF.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/liblldCOFF.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/liblldWasm.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/liblldMachO.a  /home/yxd/playspace/zig-bootstrap/out/host/lib/liblldCommon.a  -lLLVMWindowsManifest  -lLLVMXRay  -lLLVMLibDriver  -lLLVMDlltoolDriver  -lLLVMCoverage  -lLLVMLineEditor  -lLLVMXCoreDisassembler  -lLLVMXCoreCodeGen  -lLLVMXCoreDesc  -lLLVMXCoreInfo  -lLLVMX86TargetMCA  -lLLVMX86Disassembler  -lLLVMX86AsmParser  -lLLVMX86CodeGen  -lLLVMX86Desc  -lLLVMX86Info  -lLLVMWebAssemblyDisassembler  -lLLVMWebAssemblyAsmParser  -lLLVMWebAssemblyCodeGen  -lLLVMWebAssemblyUtils  -lLLVMWebAssemblyDesc  -lLLVMWebAssemblyInfo  -lLLVMVEDisassembler  -lLLVMVEAsmParser  -lLLVMVECodeGen  -lLLVMVEDesc  -lLLVMVEInfo  -lLLVMSystemZDisassembler  -lLLVMSystemZAsmParser  -lLLVMSystemZCodeGen  -lLLVMSystemZDesc  -lLLVMSystemZInfo  -lLLVMSparcDisassembler  -lLLVMSparcAsmParser  -lLLVMSparcCodeGen  -lLLVMSparcDesc  -lLLVMSparcInfo  -lLLVMRISCVTargetMCA  -lLLVMRISCVDisassembler  -lLLVMRISCVAsmParser  -lLLVMRISCVCodeGen  -lLLVMRISCVDesc  -lLLVMRISCVInfo  -lLLVMPowerPCDisassembler  -lLLVMPowerPCAsmParser  -lLLVMPowerPCCodeGen  -lLLVMPowerPCDesc  -lLLVMPowerPCInfo  -lLLVMNVPTXCodeGen  -lLLVMNVPTXDesc  -lLLVMNVPTXInfo  -lLLVMMSP430Disassembler  -lLLVMMSP430AsmParser  -lLLVMMSP430CodeGen  -lLLVMMSP430Desc  -lLLVMMSP430Info  -lLLVMMipsDisassembler  -lLLVMMipsAsmParser  -lLLVMMipsCodeGen  -lLLVMMipsDesc  -lLLVMMipsInfo  -lLLVMLoongArchDisassembler  -lLLVMLoongArchAsmParser  -lLLVMLoongArchCodeGen  -lLLVMLoongArchDesc  -lLLVMLoongArchInfo  -lLLVMLanaiDisassembler  -lLLVMLanaiCodeGen  -lLLVMLanaiAsmParser  -lLLVMLanaiDesc  -lLLVMLanaiInfo  -lLLVMHexagonDisassembler  -lLLVMHexagonCodeGen  -lLLVMHexagonAsmParser  -lLLVMHexagonDesc  -lLLVMHexagonInfo  -lLLVMBPFDisassembler  -lLLVMBPFAsmParser  -lLLVMBPFCodeGen  -lLLVMBPFDesc  -lLLVMBPFInfo  -lLLVMAVRDisassembler  -lLLVMAVRAsmParser  -lLLVMAVRCodeGen  -lLLVMAVRDesc  -lLLVMAVRInfo  -lLLVMARMDisassembler  -lLLVMARMAsmParser  -lLLVMARMCodeGen  -lLLVMARMDesc  -lLLVMARMUtils  -lLLVMARMInfo  -lLLVMAMDGPUTargetMCA  -lLLVMAMDGPUDisassembler  -lLLVMAMDGPUAsmParser  -lLLVMAMDGPUCodeGen  -lLLVMAMDGPUDesc  -lLLVMAMDGPUUtils  -lLLVMAMDGPUInfo  -lLLVMAArch64Disassembler  -lLLVMAArch64AsmParser  -lLLVMAArch64CodeGen  -lLLVMAArch64Desc  -lLLVMAArch64Utils  -lLLVMAArch64Info  -lLLVMOrcJIT  -lLLVMWindowsDriver  -lLLVMMCJIT  -lLLVMJITLink  -lLLVMInterpreter  -lLLVMExecutionEngine  -lLLVMRuntimeDyld  -lLLVMOrcTargetProcess  -lLLVMOrcShared  -lLLVMDWP  -lLLVMDebugInfoLogicalView  -lLLVMDe
bugInfoGSYM  -lLLVMOption  -lLLVMObjectYAML  -lLLVMObjCopy  -lLLVMMCA  -lLLVMMCDisassembler  -lLLVMLTO  -lLLVMPasses  -lLLVMCFGuard  -lLLVMCoroutines  -lLLVMipo  -lLLVMVectorize  -lLLVMLinker  -lLLVMInstrumentation  -lLLVMFrontendOpenMP  -lLLVMFrontendOpenACC  -lLLVMFrontendHLSL  -lLLVMExtensions  -lLLVMDWARFLinkerParallel  -lLLVMDWARFLinker  -lLLVMGlobalISel  -lLLVMMIRParser  -lLLVMAsmPrinter  -lLLVMSelectionDAG  -lLLVMCodeGen  -lLLVMTarget  -lLLVMObjCARCOpts  -lLLVMCodeGenTypes  -lLLVMIRPrinter  -lLLVMInterfaceStub  -lLLVMFileCheck  -lLLVMFuzzMutate  -lLLVMScalarOpts  -lLLVMInstCombine  -lLLVMAggressiveInstCombine  -lLLVMTransformUtils  -lLLVMBitWriter  -lLLVMAnalysis  -lLLVMProfileData  -lLLVMSymbolize  -lLLVMDebugInfoBTF  -lLLVMDebugInfoPDB  -lLLVMDebugInfoMSF  -lLLVMDebugInfoDWARF  -lLLVMObject  -lLLVMTextAPI  -lLLVMMCParser  -lLLVMIRReader  -lLLVMAsmParser  -lLLVMMC  -lLLVMDebugInfoCodeView  -lLLVMBitReader  -lLLVMFuzzerCLI  -lLLVMCore  -lLLVMRemarks  -lLLVMBitstreamReader  -lLLVMBinaryFormat  -lLLVMTargetParser  -lLLVMTableGen  -lLLVMSupport  -lLLVMDemangle  -lrt  -ldl  -lm  -lz  -ltinfo && :
/usr/bin/ld: /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o): relocation R_LARCH_B26 overflow 0x872c4b0
Dump relocate record:
stack top               relocation name         symbol
at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x2bc):
...
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZTVN12_GLOBAL__N_113X86AsmBackendE' + 16(0x10)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x2c0):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZTVN12_GLOBAL__N_113X86AsmBackendE' + 16(0x10)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x2cc):
0x0000000000000000 R_LARCH_B21  `.L1318'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x2d8):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_133X86AlignBranchWithin32BBoundariesE' + 128(0x80)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x2e0):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_133X86AlignBranchWithin32BBoundariesE' + 128(0x80)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x314):
0x0000000000000000 R_LARCH_B21  `.L1298'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x324):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_122X86AlignBranchBoundaryE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x328):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_122X86AlignBranchBoundaryE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x330):
0x0000000000000000 R_LARCH_B21  `.L1299'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x33c):
0x0000000000000000 R_LARCH_B21  `.L1300'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x358):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_114X86AlignBranchE' + 8(0x8)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x35c):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_114X86AlignBranchE' + 8(0x8)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x360):
0x0000000000000000 R_LARCH_B21  `.L1301'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x364):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_121X86AlignBranchKindLocE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x368):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_121X86AlignBranchKindLocE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x374):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_119X86PadMaxPrefixSizeE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x378):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_119X86PadMaxPrefixSizeE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x380):
0x0000000000000000 R_LARCH_B21  `.L1302'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6
TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x38c):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZTVN12_GLOBAL__N_120ELFX86_X32AsmBackendE' + 16(0x10)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x390):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZTVN12_GLOBAL__N_120ELFX86_X32AsmBackendE' + 16(0x10)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x39c):
0x0000000000000000 R_LARCH_B26  `.L1264'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x3b0):
0x0000000000000000 R_LARCH_B26  `_Znwm@@GLIBCXX_3.4'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x3c0):
0x0000000000000000 R_LARCH_B26  `_ZN4llvm12MCAsmBackendC2ENS_7support10endiannessEj'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x3c4):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZTVN12_GLOBAL__N_113X86AsmBackendE' + 16(0x10)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x3cc):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZTVN12_GLOBAL__N_113X86AsmBackendE' + 16(0x10)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x3d8):
0x0000000000000000 R_LARCH_B21  `.L1310'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x3e8):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_133X86AlignBranchWithin32BBoundariesE' + 128(0x80)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x3f0):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_133X86AlignBranchWithin32BBoundariesE' + 128(0x80)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x424):
0x0000000000000000 R_LARCH_B21  `.L1267'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x434):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_122X86AlignBranchBoundaryE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x438):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_122X86AlignBranchBoundaryE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x440):
0x0000000000000000 R_LARCH_B21  `.L1268'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x44c):
0x0000000000000000 R_LARCH_B21  `.L1269'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x468):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_114X86AlignBranchE' + 8(0x8)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x46c):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_114X86AlignBranchE' + 8(0x8)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x470):
0x0000000000000000 R_LARCH_B21  `.L1270'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x474):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_121X86AlignBranchKindLocE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x478):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_121X86AlignBranchKindLocE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x484):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_119X86PadMaxPrefixSizeE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x488):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_119X86PadMaxPrefixSizeE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x490):
0x0000000000000000 R_LARCH_B21  `.L1271'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x4a0):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZTVN12_GLOBAL__N_119DarwinX86AsmBackendE' + 16(0x10)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x4a4):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZTVN12_GLOBAL__N_119DarwinX86AsmBackendE' + 16(0x10)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x4c8):
0x0000000000000000 R_LARCH_B16  `.L1410'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x4d0):
0x0000000000000000 R_LARCH_B16  `.L1274'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x500):
0x0000000000000000 R_LARCH_B26  `_ZNK4llvm6Triple11isArch64BitEv'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x514):
0x0000000000000000 R_LARCH_B21  `.L1276'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6
TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x530):
0x0000000000000000 R_LARCH_B26  `.L1264'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x53c):
0x0000000000000000 R_LARCH_B26  `.L1308'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x554):
0x0000000000000000 R_LARCH_B26  `.L1277'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x558):
0x0000000000000000 R_LARCH_PCALA_HI20   `CSWTCH.576'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x560):
0x0000000000000000 R_LARCH_PCALA_LO12   `CSWTCH.576'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x568):
0x0000000000000000 R_LARCH_B26  `.L1294'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x56c):
0x0000000000000000 R_LARCH_B21  `.L1275'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x570):
0x0000000000000000 R_LARCH_B26  `.L1273'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x580):
0x0000000000000000 R_LARCH_B26  `_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@@GLIBCXX_3.4.21'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x59c):
0x0000000000000000 R_LARCH_B26  `memcpy@@GLIBC_2.36'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x5a8):
0x0000000000000000 R_LARCH_B26  `.L1275'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x5b0):
0x0000000000000000 R_LARCH_B26  `.L1288'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x5b8):
0x0000000000000000 R_LARCH_B26  `.L1266'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x5c0):
0x0000000000000000 R_LARCH_B26  `.L1297'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x5c8):
0x0000000000000000 R_LARCH_B26  `.L1303'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text._ZN4llvm22createX86_64AsmBackendERKNS_6TargetERKNS_15MCSubtargetInfoERKNS_14MCRegisterInfoERKNS_15MCTargetOptionsE+0x5d0):
0x0000000000000000 R_LARCH_B26  `__stack_chk_fail@@GLIBC_2.36'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0x0):
0x0000000000000000 R_LARCH_NONE `<nameless>' + 28(0x1c)

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0x8):
0x0000000000000000 R_LARCH_PCALA_HI20   `_ZN12_GLOBAL__N_122X86AlignBranchBoundaryE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0xc):
0x0000000000000000 R_LARCH_PCALA_LO12   `_ZN12_GLOBAL__N_122X86AlignBranchBoundaryE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0x44):
0x0000000000000000 R_LARCH_GOT_PC_HI20  `__stack_chk_guard@@GLIBC_2.36'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0x48):
0x0000000000000000 R_LARCH_GOT_PC_LO12  `__stack_chk_guard@@GLIBC_2.36'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0x50):
0x0000000000000000 R_LARCH_GOT_PC_HI20  `_ZTVN4llvm2cl6OptionE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0x54):
0x0000000000000000 R_LARCH_GOT_PC_LO12  `_ZTVN4llvm2cl6OptionE'

at /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o)(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0xb0):
0x0000000000000000 R_LARCH_B26  `_ZN4llvm2cl18getGeneralCategoryEv'

-- Record dump end --

/home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMX86Desc.a(X86AsmBackend.cpp.o): in function `_GLOBAL__sub_I_X86AsmBackend.cpp':
X86AsmBackend.cpp:(.text.startup._GLOBAL__sub_I_X86AsmBackend.cpp+0xb0): relocation truncated to fit: R_LARCH_B26 against symbol `llvm::cl::getGeneralCategory()' defined in .text._ZN4llvm2cl18getGeneralCategoryEv section in /home/yxd/playspace/zig-bootstrap/out/host/lib/libLLVMSupport.a(CommandLine.cpp.o)
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Jan 29, 2024

system:

OS: loongarchlinux

Kernel:

$ uname -s -r -v -m -o
Linux 6.7.0-6 #1 SMP PREEMPT Tue, 09 Jan 2024 11:51:31 +0000 loongarch64 GNU/Linux

clang

$ clang --version
clang version 16.0.6
Target: loongarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

glibc

$ /usr/lib64/libc.so.6
GNU C Library (GNU libc) stable release version 2.38.
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 13.2.1 20230906.
libc ABIs: UNIQUE ABSOLUTE
Minimum supported kernel: 5.19.0
For bug reporting instructions, please see:
<https://bugs.archlinux.org/>.

The GCC toolchain provided by the system is not working, tried with llvm and clang.

The command to build bootstrap

$ CMAKE_GENERATOR=Ninja CC=/usr/bin/clang CXX=/usr/bin/clang++ ./build loongarch64-linux-gnu loongarch64

With the same patch above, it seems that it is possible to compile zig2 successfully but failed in stage 3.

-- Build files have been written to: /home/yxd/playspace/zig-bootstrap/out/build-zig-host
[6/7] Building stage3
FAILED: stage3/bin/zig /home/yxd/playspace/zig-bootstrap/out/build-zig-host/stage3/bin/zig
cd /home/yxd/playspace/zig-bootstrap/zig && /home/yxd/playspace/zig-bootstrap/out/build-zig-host/zig2 build --prefix /home/yxd/playspace/zig-bootstrap/out/build-zig-host/stage3 --zig-lib-dir /home/yxd/playspace/zig-bootstrap/zig/lib -Dconfig_h=/home/yxd/playspace/zig-bootstrap/out/build-zig-host/config.h -Denable-llvm -Doptimize=ReleaseFast -Dstrip -Dno-langref -Dno-autodocs -Dtarget=native -Dcpu=native -Dversion-string=0.12.0-dev.2058+04ac028a2
error(llvm): LLVM failed to parse 'loongarch64-unknown-linux-musl': Unable to find target for this triple (no targets are registered)
error: InvalidLlvmTriple
ninja: build stopped: subcommand failed.

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Jan 31, 2024

it seems that zig itself requires fstat to work.

However, loongarch64 does not have fstat/fstatat syscall support and only has statx syscall.

Maybe we should add a translation layer for fstat/fstatat that uses statx underhood?

@nektro
Copy link

nektro commented Jan 31, 2024

However, loongarch64 does not have fstat/fstatat syscall support

is there a specific reason for this or is it because its simply not implemented yet in the kernel since loongarch64 is such a relatively new architecture?

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 1, 2024

However, loongarch64 does not have fstat/fstatat syscall support

is there a specific reason for this or is it because its simply not implemented yet in the kernel since loongarch64 is such a relatively new architecture?

Check the syscalls here.

It seems that it is not implemented in Linux kernel intentionally. And golang has an emulation implementation of fstatat with statx.

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 1, 2024

With current patch, I think I have implemented most of the loongarch64 things needed for zig std lib.

yxd-ym#1

The current build command I use:

$ CMAKE_GENERATOR=Ninja CC=/usr/bin/clang CXX=/usr/bin/clang++ ./build loongarch64-linux-gnu loongarch64

The current error output:

-- Build files have been written to: /home/yxd/playspace/zig-bootstrap/out/build-zig-host
[19/20] Building stage3
FAILED: stage3/bin/zig /home/yxd/playspace/zig-bootstrap/out/build-zig-host/stage3/bin/zig
cd /home/yxd/playspace/zig-bootstrap/zig && /home/yxd/playspace/zig-bootstrap/out/build-zig-host/zig2 build --prefix /home/yxd/playspace/zig-bootstrap/out/build-zig-host/stage3 --zig-lib-dir /home/yxd/playspace/zig-bootstrap/zig/lib -Dconfig_h=/home/yxd/playspace/zig-bootstrap/out/build-zig-host/config.h -Denable-llvm -Doptimize=ReleaseFast -Dstrip -Dno-langref -Dno-autodocs -Dtarget=native -Dcpu=native -Dversion-string=0.12.0-dev.2058+04ac028a2
thread 78035 panic: integer overflow
error: the following build command crashed:
/home/yxd/playspace/zig-bootstrap/zig/zig-cache/o/df6239b7bc57edacf4820b77cfc51b1a/build /home/yxd/playspace/zig-bootstrap/out/build-zig-host/zig2 /home/yxd/playspace/zig-bootstrap/zig /home/yxd/playspace/zig-bootstrap/zig/zig-cache /home/yxd/.cache/zig --seed 0xb709783f --prefix /home/yxd/playspace/zig-bootstrap/out/build-zig-host/stage3 --zig-lib-dir /home/yxd/playspace/zig-bootstrap/zig/lib -Dconfig_h=/home/yxd/playspace/zig-bootstrap/out/build-zig-host/config.h -Denable-llvm -Doptimize=ReleaseFast -Dstrip -Dno-langref -Dno-autodocs -Dtarget=native -Dcpu=native -Dversion-string=0.12.0-dev.2058+04ac028a2
ninja: build stopped: subcommand failed.

The backtrace of error above:

#14 0x000000000117cc10 in mem.Allocator.allocWithSizeAndAlignment__anon_14671 (self=..., n=12297829382473034410,
    return_address=18419460) at /home/yxd/playspace/zig-bootstrap/zig/lib/std/mem/Allocator.zig:211
#15 0x00000000011913b8 in mem.Allocator.allocAdvancedWithRetAddr ()
    at /home/yxd/playspace/zig-bootstrap/zig/lib/std/mem/Allocator.zig:205
#16 mem.Allocator.alignedAlloc__anon_15350 (self=..., n=12297829382473034410)
    at /home/yxd/playspace/zig-bootstrap/zig/lib/std/mem/Allocator.zig:193
#17 0x0000000001190f04 in array_list.ArrayListAligned(u8,null).ensureTotalCapacityPrecise (self=0x7ffffffe9000,
    new_capacity=12297829382473034410) at /home/yxd/playspace/zig-bootstrap/zig/lib/std/array_list.zig:458
#18 0x00000000010fb7cc in array_list.ArrayListAligned(u8,null).initCapacity (allocator=..., num=12297829382473034410)
    at /home/yxd/playspace/zig-bootstrap/zig/lib/std/array_list.zig:68
#19 0x00000000010fb460 in fs.File.readToEndAllocOptions__anon_10482 (self=..., allocator=..., max_bytes=1048576, size_hint=...)
    at /home/yxd/playspace/zig-bootstrap/zig/lib/std/fs/File.zig:996
#20 0x00000000010fc0d8 in fs.Dir.readFileAllocOptions__anon_10470 (self=..., allocator=..., file_path=..., max_bytes=1048576,
    size_hint=...) at /home/yxd/playspace/zig-bootstrap/zig/lib/std/fs/Dir.zig:1783
#21 0x00000000010fc6a0 in fs.Dir.readFileAlloc (self=..., allocator=<error reading variable: Cannot access memory at address 0x8>,
    file_path=..., max_bytes=1048576) at /home/yxd/playspace/zig-bootstrap/zig/lib/std/fs/Dir.zig:1758
#22 0x000000000110bd5c in build.build (b=0x7ffff7feea18) at /home/yxd/playspace/zig-bootstrap/zig/build.zig:324
#23 0x00000000010e7b3c in Build.runBuild__anon_8020 (b=0x7ffff7feea18)
    at /home/yxd/playspace/zig-bootstrap/zig/lib/std/Build.zig:1851
#24 0x00000000010e2808 in build_runner.main () at build_runner.zig:319
#25 0x00000000010cc9e8 in start.callMain () at /home/yxd/playspace/zig-bootstrap/zig/lib/std/start.zig:591
#26 start.initEventLoopAndCallMain () at /home/yxd/playspace/zig-bootstrap/zig/lib/std/start.zig:525
#27 start.callMainWithArgs () at /home/yxd/playspace/zig-bootstrap/zig/lib/std/start.zig:475
#28 start.posixCallMainAndExit () at /home/yxd/playspace/zig-bootstrap/zig/lib/std/start.zig:431
#29 0x0000000000000000 in ?? ()

The overflow happens on stack element 18 where num=12297829382473034410. It seems that the builtin function @intFromBool is not implemented.

I guess things like zig/src/arch/loongarch64 need to be implemented like other CPU architectures (e.g. zig/src/arch/aarch64 and zig/src/arch/riscv64) next.

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 1, 2024

ziglang/zig#18771

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 1, 2024

ziglang/zig#18772

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 3, 2024

The overflow happens on stack element 18 where num=12297829382473034410. It seems that the builtin function @intFromBool is not implemented.

This has been fixed.

And now the error is zig2 failed to build libunwind.

$ /home/yxd/playspace/zig-bootstrap/out/build-zig-host/zig2 clang zig/lib/libunwind/src/libunwind.cpp --no-default-config -nostdinc++ -fno-caret-diagnostics -D__GLIBC_MINOR__=38 -target loongarch64-unknown-linux-gnu -nostdinc -fno-spell-checking -isystem zig/lib/include -isystem /usr/include -Xclang -target-cpu -Xclang loongarch64 -Xclang -target-feature -Xclang -32bit -Xclang -target-feature -Xclang +64bit -Xclang -target-feature -Xclang -d -Xclang -target-feature -Xclang -f -Xclang -target-feature -Xclang -la-global-with-abs -Xclang -target-feature -Xclang -la-global-with-pcrel -Xclang -target-feature -Xclang -la-local-with-abs -Xclang -target-feature -Xclang -lasx -Xclang -target-feature -Xclang -lbt -Xclang -target-feature -Xclang -lsx -Xclang -target-feature -Xclang -lvz -Xclang -target-feature -Xclang +ual -fomit-frame-pointer -fno-stack-protector -DNDEBUG -O2 -fPIC -fno-unwind-tables -MD -MV -MF /home/yxd/.cache/zig/tmp/bfc89e0056ee4547-libunwind.o.d -fno-rtti -I zig/lib/libunwind/include -fPIC -D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS -Wa,--noexecstack -fvisibility=hidden -fvisibility-inlines-hidden -funwind-tables -D_LIBUNWIND_IS_NATIVE_ONLY -Wno-bitwise-conditional-parentheses -Wno-visibility -Wno-incompatible-pointer-types -c -o /home/yxd/.cache/zig/tmp/bfc89e0056ee4547-libunwind.o --serialize-diagnostics /home/yxd/.cache/zig/tmp/bfc89e0056ee4547-libunwind.o.diag
In file included from zig/lib/libunwind/src/libunwind.cpp:30:
In file included from zig/lib/libunwind/src/AddressSpace.hpp:23:
In file included from zig/lib/libunwind/src/EHHeaderParser.hpp:17:
In file included from zig/lib/libunwind/src/DwarfParser.hpp:22:
zig/lib/libunwind/src/Registers.hpp:5086:18: error: static assertion failed due to requirement 'check_fit<libunwind::Registers_loongarch, unw_context_t>::does_fit': loongarch registers do not fit into unw_context_t
In file included from zig/lib/libunwind/src/libunwind.cpp:31:
zig/lib/libunwind/src/UnwindCursor.hpp:1324:18: error: static assertion failed due to requirement 'check_fit<libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_loongarch>, unw_cursor_t>::does_fit': UnwindCursor<> does not fit in unw_cursor_t
zig/lib/libunwind/src/libunwind.cpp:87:7: note: in instantiation of member function 'libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_loongarch>::UnwindCursor' requested here

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 4, 2024

Disabled the macro _LIBUNWIND_IS_NATIVE_ONLY and it is OK to build libunwind.

The next problem is that ld.lld having error doing relocation when linking zig binary.

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 4, 2024

Managed to replace ld.lld with mold for the command that linking zig binary. Now I have a working zig stage3 binary I guess.

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 5, 2024

With the patch now it is possible to build a stage3 zig binary with command

$ CMAKE_GENERATOR=Ninja CC=/usr/bin/clang CXX=/usr/bin/clang++ ./build loongarch64-linux-gnu loongarch64

With this stage3 zig binary, there is still some problem:

  • stage3 zig is linked by external mold, we might need to wait for ld.lld in upstream to support R_LARCH_ALIGN relocation.
  • there is no libc support yet.

@yxd-ym
Copy link
Contributor Author

yxd-ym commented Feb 6, 2024

ziglang/glibc-abi-tool#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants