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
This commit is contained in:
Shuduo Sang 2022-11-29 23:42:20 +08:00 committed by GitHub
parent 60b3d00a4e
commit f565ff3769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1 deletions

View File

@ -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")

View File

@ -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

View File

@ -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__

View File

@ -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) {
// 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;