diff --git a/cmake/modules/SetUpLinux.cmake b/cmake/modules/SetUpLinux.cmake index 74957a07b3d6c..b92645ea75a06 100644 --- a/cmake/modules/SetUpLinux.cmake +++ b/cmake/modules/SetUpLinux.cmake @@ -31,6 +31,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES s390) set(ROOT_ARCHITECTURE linuxs390gcc) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES riscv64) set(ROOT_ARCHITECTURE linuxriscv64) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES loongarch64) + set(ROOT_ARCHITECTURE linuxloong64) else() message(FATAL_ERROR "Unknown processor: ${CMAKE_SYSTEM_PROCESSOR}") endif() diff --git a/config/root-config.in b/config/root-config.in index 5b6efa132d541..a3f5f855f395e 100755 --- a/config/root-config.in +++ b/config/root-config.in @@ -262,6 +262,10 @@ linuxriscv64) # RISC-V Linux auxlibs="-lm -ldl -rdynamic" ;; +linuxloong64) + # loong64 Linux + auxlibs="-lm -ldl -rdynamic" + ;; freebsd*) # FreeBSD auxcflags="${cxxversionflag}" diff --git a/core/foundation/inc/ROOT/RConfig.hxx b/core/foundation/inc/ROOT/RConfig.hxx index 2b3af250e7968..9cd379d981d98 100644 --- a/core/foundation/inc/ROOT/RConfig.hxx +++ b/core/foundation/inc/ROOT/RConfig.hxx @@ -238,6 +238,14 @@ # define NEED_SIGJMP #endif +#if defined(linux) && defined(__loongarch_lp64) +# define R__LINUX +# define R__UNIX +# define R__BYTESWAP +# define R__B64 +# define NEED_SIGJMP +#endif + #if defined(__MACH__) && defined(__i386__) && !defined(__APPLE__) # define R__HURD # define f2cFortran /* cfortran.h does not know HURD - sigh */ diff --git a/etc/Makefile.arch b/etc/Makefile.arch index 2e04959a2ffe1..22617c5eba730 100644 --- a/etc/Makefile.arch +++ b/etc/Makefile.arch @@ -259,6 +259,15 @@ LDFLAGS = $(OPT) SOFLAGS = -shared endif +ifeq ($(ARCH),linuxloong64) +# loong64 Linux with gcc and glibc +CXX = g++ +CXXFLAGS = $(OPT) -Wall -fPIC +LD = g++ +LDFLAGS = $(OPT) +SOFLAGS = -shared +endif + ifeq ($(ARCH),freebsd4) # FreeBSD with glibc CXX = g++ diff --git a/interpreter/CMakeLists.txt b/interpreter/CMakeLists.txt index 72c437090e8ce..419ff4028a0a7 100644 --- a/interpreter/CMakeLists.txt +++ b/interpreter/CMakeLists.txt @@ -74,6 +74,8 @@ elseif(ROOT_ARCHITECTURE MATCHES s390) set(ROOT_CLING_TARGET "SystemZ") elseif(ROOT_ARCHITECTURE MATCHES riscv64) set(ROOT_CLING_TARGET "RISCV") +elseif(ROOT_ARCHITECTURE MATCHES loong64) + set(ROOT_CLING_TARGET "LoongArch") elseif(ROOT_ARCHITECTURE MATCHES freebsd OR ROOT_ARCHITECTURE MATCHES linux OR ROOT_ARCHITECTURE MATCHES macosx) set(ROOT_CLING_TARGET "X86") elseif(ROOT_ARCHITECTURE MATCHES win32 OR ROOT_ARCHITECTURE MATCHES win64) diff --git a/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp b/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp index ddd2acbe72815..ad936d9316ce5 100644 --- a/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp +++ b/interpreter/cling/lib/Interpreter/IncrementalJIT.cpp @@ -349,7 +349,7 @@ static bool UseJITLink(const Triple& TT) { bool jitLink = false; // Default to JITLink on macOS and RISC-V, as done in (recent) LLVM by // LLJITBuilderState::prepareForConstruction. - if (TT.getArch() == Triple::riscv64 || + if (TT.getArch() == Triple::riscv64 || TT.getArch() == Triple::loongarch64 || (TT.isOSBinFormatMachO() && (TT.getArch() == Triple::aarch64 || TT.getArch() == Triple::x86_64)) || (TT.isOSBinFormatELF() &&