Skip to content

Commit

Permalink
Add initial support for loong64
Browse files Browse the repository at this point in the history
* This adds initial support for building on loong64 to the build system
and ROOT's configuration files and utilities

Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>
  • Loading branch information
wszqkzqk authored and hahnjo committed Jan 7, 2025
1 parent 8eefabd commit 433ca8c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmake/modules/SetUpLinux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions config/root-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ linuxriscv64)
# RISC-V Linux
auxlibs="-lm -ldl -rdynamic"
;;
linuxloong64)
# loong64 Linux
auxlibs="-lm -ldl -rdynamic"
;;
freebsd*)
# FreeBSD
auxcflags="${cxxversionflag}"
Expand Down
8 changes: 8 additions & 0 deletions core/foundation/inc/ROOT/RConfig.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
9 changes: 9 additions & 0 deletions etc/Makefile.arch
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down
2 changes: 2 additions & 0 deletions interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion interpreter/cling/lib/Interpreter/IncrementalJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand Down

0 comments on commit 433ca8c

Please sign in to comment.