mirror of
https://github.com/bkaradzic/bx.git
synced 2026-10-22 08:41:00 +00:00
Add LoongArch64 support (#428)
* Add LoongArch64 support * Use refined preprocessor to determine loongarch64
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#define BX_CPU_JIT 0
|
||||
#define BX_CPU_MIPS 0
|
||||
#define BX_CPU_PPC 0
|
||||
#define BX_CPU_LOONGARCH64 0
|
||||
#define BX_CPU_RISCV 0
|
||||
#define BX_CPU_X86 0
|
||||
|
||||
@@ -108,6 +109,10 @@
|
||||
# undef BX_CPU_RISCV
|
||||
# define BX_CPU_RISCV 1
|
||||
# define BX_CACHE_LINE_SIZE 64
|
||||
#elif defined(__loongarch__) && (__loongarch_grlen == 64)
|
||||
# undef BX_CPU_LOONGARCH64
|
||||
# define BX_CPU_LOONGARCH64 1
|
||||
# define BX_CACHE_LINE_SIZE 64
|
||||
#elif defined(_M_IX86) \
|
||||
|| defined(_M_X64) \
|
||||
|| defined(__i386__) \
|
||||
@@ -400,6 +405,8 @@
|
||||
# define BX_CPU_NAME "MIPS"
|
||||
#elif BX_CPU_PPC
|
||||
# define BX_CPU_NAME "PowerPC"
|
||||
#elif BX_CPU_LOONGARCH64
|
||||
# define BX_CPU_NAME "LoongArch64"
|
||||
#elif BX_CPU_RISCV
|
||||
# define BX_CPU_NAME "RISC-V"
|
||||
#elif BX_CPU_X86
|
||||
|
||||
@@ -78,6 +78,7 @@ function toolchain(_buildDir, _libDir)
|
||||
{ "linux-ppc64le-gcc", "Linux (PPC64LE, GCC compiler)" },
|
||||
{ "linux-ppc64le-clang", "Linux (PPC64LE, Clang compiler)" },
|
||||
{ "linux-riscv64-gcc", "Linux (RISC-V 64, GCC compiler)" },
|
||||
{ "linux-loongarch64-gcc", "Linux (LoongArch64, GCC compiler)" },
|
||||
{ "ios-arm64", "iOS - ARM64" },
|
||||
{ "ios-simulator", "iOS - Simulator" },
|
||||
{ "tvos-arm64", "tvOS - ARM64" },
|
||||
@@ -341,6 +342,9 @@ function toolchain(_buildDir, _libDir)
|
||||
elseif "linux-riscv64-gcc" == _OPTIONS["gcc"] then
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-linux-riscv64-gcc"))
|
||||
|
||||
elseif "linux-loongarch64-gcc" == _OPTIONS["gcc"] then
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-linux-loongarch64-gcc"))
|
||||
|
||||
elseif "mingw-gcc" == _OPTIONS["gcc"] then
|
||||
if not os.getenv("MINGW") then
|
||||
print("Set MINGW environment variable.")
|
||||
@@ -929,6 +933,20 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wl,--gc-sections",
|
||||
}
|
||||
|
||||
configuration { "linux-loongarch64*" }
|
||||
buildoptions {
|
||||
"-Wunused-value",
|
||||
"-Wundef",
|
||||
"-march=loongarch64"
|
||||
}
|
||||
links {
|
||||
"rt",
|
||||
"dl",
|
||||
}
|
||||
linkoptions {
|
||||
"-Wl,--gc-sections",
|
||||
}
|
||||
|
||||
configuration { "linux-ppc64le-gcc" }
|
||||
targetdir (path.join(_buildDir, "linux_ppc64le_gcc/bin"))
|
||||
objdir (path.join(_buildDir, "linux_ppc64le_gcc/obj"))
|
||||
@@ -944,6 +962,11 @@ function toolchain(_buildDir, _libDir)
|
||||
objdir (path.join(_buildDir, "linux_riscv64_gcc/obj"))
|
||||
libdirs { path.join(_libDir, "lib/linux_riscv64_gcc") }
|
||||
|
||||
configuration { "linux-loongarch64-gcc" }
|
||||
targetdir (path.join(_buildDir, "linux_loongarch64_gcc/bin"))
|
||||
objdir (path.join(_buildDir, "linux_loongarch64_gcc/obj"))
|
||||
libdirs { path.join(_libDir, "lib/linux_loongarch64_gcc") }
|
||||
|
||||
configuration { "wasm2js" }
|
||||
targetdir (path.join(_buildDir, "wasm2js/bin"))
|
||||
objdir (path.join(_buildDir, "wasm2js/obj"))
|
||||
|
||||
Reference in New Issue
Block a user