Skip to content

Commit

Permalink
build, feat: support loong64.
Browse files Browse the repository at this point in the history
  • Loading branch information
xicilion committed Jan 10, 2023
1 parent c50aaaa commit bd0927f
Show file tree
Hide file tree
Showing 15 changed files with 71,186 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ TARGET_OS=`uname`

if [[ "$BUILD_TARGET" != "" ]]; then
CUR=`pwd`
docker run --rm -v ${CUR}:/fibjs fibjs/${BUILD_TARGET}-build-env:${TARGET_ARCH} bash -c "cd /fibjs; bash build -j2 ${TARGET_ARCH} ${BUILD_TYPE} ci"
docker run -t --rm -v ${CUR}:/fibjs fibjs/${BUILD_TARGET}-build-env:${TARGET_ARCH} bash -c "cd /fibjs; bash build -j2 ${TARGET_ARCH} ${BUILD_TYPE} ci"
elif [[ "$TARGET_OS" == "Linux" ]]; then
CUR=`pwd`
docker run --rm -v ${CUR}:/fibjs fibjs/linux-build-env:${TARGET_ARCH} bash -c "cd /fibjs; bash build -j2 ${TARGET_ARCH} ${BUILD_TYPE} ci"
docker run -t --rm -v ${CUR}:/fibjs fibjs/linux-build-env:${TARGET_ARCH} bash -c "cd /fibjs; bash build -j2 ${TARGET_ARCH} ${BUILD_TYPE} ci"
else
bash build -j2 ${TARGET_ARCH} ${BUILD_TYPE} ci
fi
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
target_arch: [amd64, i386, arm, arm64, mips64, ppc64]
target_arch: [amd64, i386, arm, arm64, mips64, ppc64, loong64]
build_type: [release, debug]
include:
- os: ubuntu-18.04
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jssdk_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ if [[ $TARGET_OS_NAME == 'Linux' ]]; then
CUR=`pwd`

if [[ "$BUILD_TARGET" == "" ]]; then
docker run --rm -v ${CUR}:/fibjs fibjs/linux-build-env:${TARGET_ARCH} /fibjs/.dist/bin/${DIST_DIR}/jssdk_test
docker run -t --rm -v ${CUR}:/fibjs fibjs/linux-build-env:${TARGET_ARCH} /fibjs/.dist/bin/${DIST_DIR}/jssdk_test
else
docker run --rm -v ${CUR}:/fibjs fibjs/${BUILD_TARGET}-test-env:${TARGET_ARCH} /fibjs/.dist/bin/${DIST_DIR}/jssdk_test
docker run -t --rm -v ${CUR}:/fibjs fibjs/${BUILD_TARGET}-test-env:${TARGET_ARCH} /fibjs/.dist/bin/${DIST_DIR}/jssdk_test
fi
else # Darwin/Windows
.dist/bin/$DIST_DIR/jssdk_test
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/setup_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@

sudo apt update

sudo apt install qemu-user-static -y
sudo apt install qemu-user-static -y

sudo update-binfmts --enable
sudo update-binfmts --install qemu-loongarch64 /usr/cross-tools/qemu-loongarch64 \
--magic "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01" \
--mask "\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"
4 changes: 2 additions & 2 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ usage()
echo "Options:"
echo " release, debug: "
echo " Specifies the build type."
echo " i386, amd64, arm, arm64, mips64, ppc64, riscv64:"
echo " i386, amd64, arm, arm64, mips64, ppc64, s390x, riscv64:"
echo " Specifies the architecture for code generation."
echo " clean: "
echo " Clean the build folder."
Expand All @@ -25,7 +25,7 @@ usage()
for i in "$@"
do
case $i in
i386|amd64|arm|arm64|mips64|ppc64|riscv64) BUILD_ARCH=$i
i386|amd64|arm|arm64|mips64|ppc64|s390x|riscv64|loong64) BUILD_ARCH=$i
;;
alpine) BUILD_ALPINE="alpine"
;;
Expand Down
2 changes: 1 addition & 1 deletion build_tools
7 changes: 7 additions & 0 deletions exlib/include/osconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,10 @@
#endif
#endif
#endif

#ifdef __loongarch64
#ifndef loong64
#define loong64
#define ARCH_BITS 64
#endif
#endif
4 changes: 2 additions & 2 deletions jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* total number of bits in a pointer, e.g. on x64, for which the uppermost 16
* bits are the same as bit 47.
*/
#if defined(__x86_64__) || defined(__aarch64__) || defined(__mips64) || defined(__powerpc64__) || defined(_WIN64)
#if defined(__x86_64__) || defined(__aarch64__) || defined(__mips64) || defined(__powerpc64__) || defined (__loongarch64) || defined(_WIN64)
#define LG_VADDR 48
#else
#define LG_VADDR 32
Expand Down Expand Up @@ -332,7 +332,7 @@
/* sizeof(long) == 2^LG_SIZEOF_LONG. */
#ifdef _MSC_VER
#define LG_SIZEOF_LONG 2
#elif defined(__x86_64__) || defined(__aarch64__) || defined(__mips64) || defined(__powerpc64__)
#elif defined(__x86_64__) || defined(__aarch64__) || defined(__mips64) || defined(__powerpc64__) || defined (__loongarch64)
#define LG_SIZEOF_LONG 3
#else
#define LG_SIZEOF_LONG 2
Expand Down
3 changes: 3 additions & 0 deletions jemalloc/include/jemalloc/internal/quantum.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
# ifdef __le32__
# define LG_QUANTUM 4
# endif
# ifdef __loongarch64
# define LG_QUANTUM 4
# endif
# ifndef LG_QUANTUM
# error "Unknown minimum alignment for architecture; specify via "
"--with-lg-quantum"
Expand Down
2 changes: 1 addition & 1 deletion jemalloc/include/jemalloc/jemalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern "C" {
/* #undef JEMALLOC_USE_CXX_THROW */

/* sizeof(void *) == 2^LG_SIZEOF_PTR. */
#if defined(__x86_64__) || defined(__aarch64__) || defined(__mips64) || defined(__powerpc64__) || defined(_WIN64)
#if defined(__x86_64__) || defined(__aarch64__) || defined(__mips64) || defined(__powerpc64__) || defined (__loongarch64) || defined(_WIN64)
#define LG_SIZEOF_PTR 3
#else
#define LG_SIZEOF_PTR 2
Expand Down
Loading

0 comments on commit bd0927f

Please sign in to comment.