This is an automated email from the ASF dual-hosted git repository. zhaoc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new 0f829ca Add arm compatible patches (#2798) 0f829ca is described below commit 0f829ca4c45bb044a9643d6dd7d80bdaf4768415 Author: yangzhg <780531...@qq.com> AuthorDate: Mon Jan 20 00:21:47 2020 +0800 Add arm compatible patches (#2798) --- thirdparty/build-thirdparty.sh | 3 +- thirdparty/download-thirdparty.sh | 4 +- thirdparty/patches/incubator-brpc-0.9.5.patch | 237 ++++++++++++++++++++++++++ thirdparty/patches/llvm-3.4.2.patch | 4 +- 4 files changed, 243 insertions(+), 5 deletions(-) diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index 26e621e..c8bf40c 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -159,7 +159,7 @@ build_libevent() { CFLAGS="-std=c99 -fPIC -D_BSD_SOURCE -fno-omit-frame-pointer -g -ggdb -O2 -I${TP_INCLUDE_DIR}" \ LDFLAGS="-L${TP_LIB_DIR}" \ - ./configure --prefix=$TP_INSTALL_DIR --enable-shared=no --disable-samples + ./configure --prefix=$TP_INSTALL_DIR --enable-shared=no --disable-samples --disable-libevent-regress make -j$PARALLEL && make install } @@ -690,6 +690,7 @@ build_orc() { -DLZ4_INCLUDE_DIR=$TP_INSTALL_DIR/include/lz4 \ -DZLIB_HOME=$TP_INSTALL_DIR\ -DBUILD_LIBHDFSPP=OFF \ + -DBUILD_CPP_TESTS=OFF \ -DCMAKE_INSTALL_PREFIX=$TP_INSTALL_DIR make -j$PARALLEL && make install diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh index 5838830..a850911 100755 --- a/thirdparty/download-thirdparty.sh +++ b/thirdparty/download-thirdparty.sh @@ -299,8 +299,8 @@ echo "Finished patching $LZ4_SOURCE" # brpc patch to disable shared library cd $TP_SOURCE_DIR/$BRPC_SOURCE -if [ ! -f $PATCHED_MARK ]; then - patch -p0 < $TP_PATCH_DIR/brpc-0.9.0.patch +if [ ! -f $PATCHED_MARK ] && [ $BRPC_SOURCE == "incubator-brpc-0.9.5" ]; then + patch -p0 < $TP_PATCH_DIR/incubator-brpc-0.9.5.patch touch $PATCHED_MARK fi cd - diff --git a/thirdparty/patches/incubator-brpc-0.9.5.patch b/thirdparty/patches/incubator-brpc-0.9.5.patch new file mode 100644 index 0000000..a717f5f --- /dev/null +++ b/thirdparty/patches/incubator-brpc-0.9.5.patch @@ -0,0 +1,237 @@ +--- CMakeLists.txt 2018-10-30 12:00:24.000000000 +0800 ++++ CMakeLists.txt 2020-01-19 15:30:38.260000000 +0800 +@@ -104,8 +104,11 @@ + + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + #required by butil/crc32.cc to boost performance for 10x +- if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)) ++ if((CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4 -msse4.2") ++ elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")) ++ # segmentation fault in libcontext ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-gcse -w") + endif() + if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-aligned-new") +--- src/bthread/context.cpp 2018-10-30 12:00:24.000000000 +0800 ++++ src/bthread/context.cpp 2020-01-19 15:48:18.070000000 +0800 +@@ -600,3 +600,106 @@ + ); + + #endif ++ ++#if defined(BTHREAD_CONTEXT_PLATFORM_linux_arm64) && defined(BTHREAD_CONTEXT_COMPILER_gcc) ++__asm ( ++".cpu generic+fp+simd\n" ++".text\n" ++".align 2\n" ++".global bthread_jump_fcontext\n" ++".type bthread_jump_fcontext, %function\n" ++"bthread_jump_fcontext:\n" ++" # prepare stack for GP + FPU\n" ++" sub sp, sp, #0xb0\n" ++"# Because gcc may save integer registers in fp registers across a\n" ++"# function call we cannot skip saving the fp registers.\n" ++"#\n" ++"# Do not reinstate this test unless you fully understand what you\n" ++"# are doing.\n" ++"#\n" ++"# # test if fpu env should be preserved\n" ++"# cmp w3, #0\n" ++"# b.eq 1f\n" ++" # save d8 - d15\n" ++" stp d8, d9, [sp, #0x00]\n" ++" stp d10, d11, [sp, #0x10]\n" ++" stp d12, d13, [sp, #0x20]\n" ++" stp d14, d15, [sp, #0x30]\n" ++"1:\n" ++" # save x19-x30\n" ++" stp x19, x20, [sp, #0x40]\n" ++" stp x21, x22, [sp, #0x50]\n" ++" stp x23, x24, [sp, #0x60]\n" ++" stp x25, x26, [sp, #0x70]\n" ++" stp x27, x28, [sp, #0x80]\n" ++" stp x29, x30, [sp, #0x90]\n" ++" # save LR as PC\n" ++" str x30, [sp, #0xa0]\n" ++" # store RSP (pointing to context-data) in first argument (x0).\n" ++" # STR cannot have sp as a target register\n" ++" mov x4, sp\n" ++" str x4, [x0]\n" ++" # restore RSP (pointing to context-data) from A2 (x1)\n" ++" mov sp, x1\n" ++"# # test if fpu env should be preserved\n" ++"# cmp w3, #0\n" ++"# b.eq 2f\n" ++" # load d8 - d15\n" ++" ldp d8, d9, [sp, #0x00]\n" ++" ldp d10, d11, [sp, #0x10]\n" ++" ldp d12, d13, [sp, #0x20]\n" ++" ldp d14, d15, [sp, #0x30]\n" ++"2:\n" ++" # load x19-x30\n" ++" ldp x19, x20, [sp, #0x40]\n" ++" ldp x21, x22, [sp, #0x50]\n" ++" ldp x23, x24, [sp, #0x60]\n" ++" ldp x25, x26, [sp, #0x70]\n" ++" ldp x27, x28, [sp, #0x80]\n" ++" ldp x29, x30, [sp, #0x90]\n" ++" # use third arg as return value after jump\n" ++" # and as first arg in context function\n" ++" mov x0, x2\n" ++" # load pc\n" ++" ldr x4, [sp, #0xa0]\n" ++" # restore stack from GP + FPU\n" ++" add sp, sp, #0xb0\n" ++" ret x4\n" ++".size bthread_jump_fcontext,.-bthread_jump_fcontext\n" ++"# Mark that we don't need executable stack.\n" ++".section .note.GNU-stack,\"\",%progbits\n" ++); ++ ++#endif ++ ++#if defined(BTHREAD_CONTEXT_PLATFORM_linux_arm64) && defined(BTHREAD_CONTEXT_COMPILER_gcc) ++__asm ( ++".cpu generic+fp+simd\n" ++".text\n" ++".align 2\n" ++".global bthread_make_fcontext\n" ++".type bthread_make_fcontext, %function\n" ++"bthread_make_fcontext:\n" ++" # shift address in x0 (allocated stack) to lower 16 byte boundary\n" ++" and x0, x0, ~0xF\n" ++" # reserve space for context-data on context-stack\n" ++" sub x0, x0, #0xb0\n" ++" # third arg of bthread_make_fcontext() == address of context-function\n" ++" # store address as a PC to jump in\n" ++" str x2, [x0, #0xa0]\n" ++" # save address of finish as return-address for context-function\n" ++" # will be entered after context-function returns (LR register)\n" ++" adr x1, finish\n" ++" str x1, [x0, #0x98]\n" ++" ret x30 \n" ++"finish:\n" ++" # exit code is zero\n" ++" mov x0, #0\n" ++" # exit application\n" ++" bl _exit\n" ++".size bthread_make_fcontext,.-bthread_make_fcontext\n" ++"# Mark that we don't need executable stack.\n" ++".section .note.GNU-stack,\"\",%progbits\n" ++); ++ ++#endif +--- src/bthread/context.h 2018-10-30 12:00:24.000000000 +0800 ++++ src/bthread/context.h 2020-01-19 14:15:37.170000000 +0800 +@@ -30,6 +30,9 @@ + #elif __arm__ + #define BTHREAD_CONTEXT_PLATFORM_linux_arm32 + #define BTHREAD_CONTEXT_CALL_CONVENTION ++ #elif __aarch64__ ++ #define BTHREAD_CONTEXT_PLATFORM_linux_arm64 ++ #define BTHREAD_CONTEXT_CALL_CONVENTION + #endif + + #elif defined(__MINGW32__) || defined (__MINGW64__) +--- src/bthread/processor.h 2018-10-30 12:00:24.000000000 +0800 ++++ src/bthread/processor.h 2020-01-19 15:23:50.410000000 +0800 +@@ -20,9 +20,13 @@ + #define BTHREAD_PROCESSOR_H + + // Pause instruction to prevent excess processor bus usage, only works in GCC +-# ifndef cpu_relax +-# define cpu_relax() asm volatile("pause\n": : :"memory") +-# endif ++#ifndef cpu_relax ++#if defined(ARCH_CPU_ARM_FAMILY) ++# define cpu_relax() asm volatile("yield\n": : :"memory") ++#else ++#define cpu_relax() asm volatile("pause\n": : :"memory") ++#endif ++#endif + + // Compile read-write barrier + # ifndef barrier +--- src/butil/config.h 1970-01-01 08:00:00.000000000 +0800 ++++ src/butil/config.h 2020-01-19 12:39:01.070000000 +0800 +@@ -0,0 +1,6 @@ ++#ifndef BUTIL_CONFIG_H ++#define BUTIL_CONFIG_H ++ ++#define BRPC_WITH_GLOG 1 ++ ++#endif // BUTIL_CONFIG_H +--- src/butil/third_party/snappy/snappy-internal.h 2018-10-30 12:00:24.000000000 +0800 ++++ src/butil/third_party/snappy/snappy-internal.h 2020-01-19 14:59:50.610000000 +0800 +@@ -132,7 +132,7 @@ + matched += 4; + } + if (LittleEndian::IsLittleEndian() && s2 <= s2_limit - 4) { +- uint32 x = UNALIGNED_LOAD32(s2) ^ UNALIGNED_LOAD32(s1 + matched); ++ uint32_t x = UNALIGNED_LOAD32(s2) ^ UNALIGNED_LOAD32(s1 + matched); + int matching_bits = Bits::FindLSBSetNonZero(x); + matched += matching_bits >> 3; + } else { +--- src/butil/third_party/snappy/snappy-stubs-internal.h 2018-10-30 12:00:24.000000000 +0800 ++++ src/butil/third_party/snappy/snappy-stubs-internal.h 2020-01-19 14:49:12.990000000 +0800 +@@ -35,6 +35,7 @@ + #include <assert.h> + #include <stdlib.h> + #include <string.h> ++#include <stdint.h> + #include "butil/compiler_specific.h" + #include "butil/basictypes.h" + #include "butil/sys_byteorder.h" +@@ -114,8 +115,8 @@ + // See if that would be more efficient on platforms supporting it, + // at least for copies. + +-inline uint64_tUNALIGNED_LOAD64(const void *p) { +- uint64_tt; ++inline uint64_t UNALIGNED_LOAD64(const void *p) { ++ uint64_t t; + memcpy(&t, p, sizeof t); + return t; + } +@@ -141,8 +142,8 @@ + return t; + } + +-inline uint64_tUNALIGNED_LOAD64(const void *p) { +- uint64_tt; ++inline uint64_t UNALIGNED_LOAD64(const void *p) { ++ uint64_t t; + memcpy(&t, p, sizeof t); + return t; + } +@@ -155,7 +156,7 @@ + memcpy(p, &v, sizeof v); + } + +-inline void UNALIGNED_STORE64(void *p, uint64_tv) { ++inline void UNALIGNED_STORE64(void *p, uint64_t v) { + memcpy(p, &v, sizeof v); + } + +--- src/CMakeLists.txt 2018-10-30 12:00:24.000000000 +0800 ++++ src/CMakeLists.txt 2020-01-19 15:58:52.000000000 +0800 +@@ -47,11 +47,13 @@ + target_link_libraries(protoc-gen-mcpack brpc-shared) + + #install directory +-install(TARGETS brpc-shared +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ) ++if(BUILD_SHARED_LIBS) ++ install(TARGETS brpc-shared ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() + + install(TARGETS brpc-static + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/thirdparty/patches/llvm-3.4.2.patch b/thirdparty/patches/llvm-3.4.2.patch index b3cfb30..97ffec6 100644 --- a/thirdparty/patches/llvm-3.4.2.patch +++ b/thirdparty/patches/llvm-3.4.2.patch @@ -2,8 +2,8 @@ +++ autoconf/config.guess 2019-12-24 16:00:25.940000000 +0800 @@ -864,6 +864,13 @@ i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org