未验证 提交 f565ff37 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

fix: get cpuid on x86 only (#18552)

* chore: taostools sanitizer flag align with tdengine

* chore: re-enable old style build asan config for taos-tools

* chore: update taos-tools 274d230

* chore: update taos-tools and add x86 definition

* fix: get cpu id on x86 only
上级 60b3d00a
...@@ -82,10 +82,12 @@ IF ("${CPUTYPE}" STREQUAL "") ...@@ -82,10 +82,12 @@ IF ("${CPUTYPE}" STREQUAL "")
MESSAGE(STATUS "Current platform is amd64") MESSAGE(STATUS "Current platform is amd64")
SET(PLATFORM_ARCH_STR "amd64") SET(PLATFORM_ARCH_STR "amd64")
SET(TD_INTEL_64 TRUE) SET(TD_INTEL_64 TRUE)
ADD_DEFINITIONS("-D_TD_X86_")
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)") ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)")
MESSAGE(STATUS "Current platform is x86") MESSAGE(STATUS "Current platform is x86")
SET(PLATFORM_ARCH_STR "i386") SET(PLATFORM_ARCH_STR "i386")
SET(TD_INTEL_32 TRUE) SET(TD_INTEL_32 TRUE)
ADD_DEFINITIONS("-D_TD_X86_")
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l") ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "armv7l")
MESSAGE(STATUS "Current platform is aarch32") MESSAGE(STATUS "Current platform is aarch32")
SET(PLATFORM_ARCH_STR "arm") SET(PLATFORM_ARCH_STR "arm")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# taos-tools # taos-tools
ExternalProject_Add(taos-tools ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG 9f587e9 GIT_TAG d19e82c
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR "" BINARY_DIR ""
#BUILD_IN_SOURCE TRUE #BUILD_IN_SOURCE TRUE
......
...@@ -48,8 +48,10 @@ extern "C" { ...@@ -48,8 +48,10 @@ extern "C" {
#else #else
#include <argp.h> #include <argp.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#if defined(_TD_X86_)
#include <cpuid.h> #include <cpuid.h>
#endif #endif
#endif
#else #else
#ifndef __func__ #ifndef __func__
......
...@@ -481,6 +481,7 @@ int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma) { ...@@ -481,6 +481,7 @@ int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma) {
#elif defined(_TD_DARWIN_64) #elif defined(_TD_DARWIN_64)
#else #else
#ifdef _TD_X86_
// Since the compiler is not support avx/avx2 instructions, the global variables always need to be // Since the compiler is not support avx/avx2 instructions, the global variables always need to be
// set to be false // set to be false
#if __AVX__ || __AVX2__ #if __AVX__ || __AVX2__
...@@ -504,6 +505,7 @@ int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma) { ...@@ -504,6 +505,7 @@ int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma) {
// Ref to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756 // Ref to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756
__cpuid_fix(7u, eax, ebx, ecx, edx); __cpuid_fix(7u, eax, ebx, ecx, edx);
*avx2 = (char) ((ebx & bit_AVX2) == bit_AVX2); *avx2 = (char) ((ebx & bit_AVX2) == bit_AVX2);
#endif // _TD_X86_
#endif #endif
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册