Bug 1756570 - [loong64] Add basic build support for LoongArch64 port. r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D139567
This commit is contained in:
Zhao Jiazhong 2022-02-25 03:42:34 +00:00
parent 276701f973
commit 62341514c5
4 changed files with 13 additions and 2 deletions

View file

@ -526,6 +526,9 @@ def split_triplet(triplet, allow_msvc=False, allow_wasi=False):
elif cpu in ("riscv64", "riscv64gc"): elif cpu in ("riscv64", "riscv64gc"):
canonical_cpu = "riscv64" canonical_cpu = "riscv64"
endianness = "little" endianness = "little"
elif cpu.startswith("loongarch64"):
canonical_cpu = "loongarch64"
endianness = "little"
elif cpu == "sh4": elif cpu == "sh4":
canonical_cpu = "sh4" canonical_cpu = "sh4"
endianness = "little" endianness = "little"

View file

@ -202,8 +202,9 @@ using namespace mozilla;
// depending on kernel configuration, so they are opted out by default. // depending on kernel configuration, so they are opted out by default.
// Debug builds are opted out too, for test coverage. // Debug builds are opted out too, for test coverage.
#ifndef MOZ_DEBUG #ifndef MOZ_DEBUG
# if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__) && \ # if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__) && \
!defined(__aarch64__) && !defined(__powerpc__) && !defined(XP_MACOSX) !defined(__aarch64__) && !defined(__powerpc__) && !defined(XP_MACOSX) && \
!defined(__loongarch__)
# define MALLOC_STATIC_PAGESIZE 1 # define MALLOC_STATIC_PAGESIZE 1
# endif # endif
#endif #endif
@ -471,6 +472,8 @@ static const size_t kChunkSizeMask = kChunkSize - 1;
// Platform specific page size conditions copied from js/public/HeapAPI.h // Platform specific page size conditions copied from js/public/HeapAPI.h
# if defined(__powerpc64__) # if defined(__powerpc64__)
static const size_t gPageSize = 64_KiB; static const size_t gPageSize = 64_KiB;
# elif defined(__loongarch64)
static const size_t gPageSize = 16_KiB;
# else # else
static const size_t gPageSize = 4_KiB; static const size_t gPageSize = 4_KiB;
# endif # endif

View file

@ -165,6 +165,9 @@
#elif defined __aarch64__ || defined _M_ARM64 #elif defined __aarch64__ || defined _M_ARM64
# define RETURN_INSTR 0xd65f03c0 /* ret */ # define RETURN_INSTR 0xd65f03c0 /* ret */
#elif defined __loongarch64
# define RETURN_INSTR 0x4c000020 /* jirl zero, ra, 0 */
#elif defined __ia64 #elif defined __ia64
struct ia64_instr { struct ia64_instr {
uint32_t mI[4]; uint32_t mI[4];

View file

@ -47,6 +47,7 @@ CPU_bitness = {
"arm": 32, "arm": 32,
"hppa": 32, "hppa": 32,
"ia64": 64, "ia64": 64,
"loongarch64": 64,
"m68k": 32, "m68k": 32,
"mips32": 32, "mips32": 32,
"mips64": 64, "mips64": 64,
@ -95,6 +96,7 @@ CPU_preprocessor_checks = OrderedDict(
("mips64", "__mips64"), ("mips64", "__mips64"),
("mips32", "__mips__"), ("mips32", "__mips__"),
("riscv64", "__riscv && __riscv_xlen == 64"), ("riscv64", "__riscv && __riscv_xlen == 64"),
("loongarch64", "__loongarch64"),
("sh4", "__sh__"), ("sh4", "__sh__"),
("wasm32", "__wasm32__"), ("wasm32", "__wasm32__"),
) )