错误:在为 aarch64_be 编译 compiler-rt ASAN 运行时时静态断言失败

问题描述

我正在使用 RTOS/arm64be(GNU 7.3.0) 来构建 CLANG 编译器-rt ASAN 运行时库。我收到这样的错误

121 In file included from /cdev/ASAN/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp:21:0:
122 /cdev/ASAN/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:332:30: error: static assertion Failed
123  #define COMPILER_CHECK(pred) static_assert(pred,"")
128 /cdev/ASAN/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp:72:1: note: in expansion of macro 'COMPILER_CHECK'
129  COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct stat));

我在 lib/sanitizer_common/sanitizer_platform_limits_posix.h 中检查了 struct_kernel_stat_sz:

lib/sanitizer_common/sanitizer_platform_limits_posix.h:74 #elif defined(__aarch64__)
lib/sanitizer_common/sanitizer_platform_limits_posix.h:75 const unsigned struct_kernel_stat_sz = 128;
lib/sanitizer_common/sanitizer_platform_limits_posix.h:76 const unsigned struct_kernel_stat64_sz = 104;

显然 struct_kernel_stat_sz 在我的情况下需要 128。 我还在我的 sysroot(RTOS/**/arm64be/sdkilp32) 中检查了 asm/stat.h 的 stat 定义,但我没有找到任何与架构相关的 MACRO 控制构建流程。

另外,这里列出我的编译命令行

aarch64_be-linux -gnu-g++ -Dasan_EXPORTS -I/cdev/ASAN/llvm-project/compiler-rt/lib/. -I/cdev/ASAN/llvm-project/compiler-rt/lib/sanitizer_common -I/cdev/ASAN/llvm-project/compiler-rt/lib/asan  -fPIC -Wall -std=c++14 -Wno-unused-parameter -fpermissive -nodefaultlibs -Wl,-z,text -Wl,--version-script,/cdev/ASAN/llvm-project/compiler-rt/build/lib/asan/clang_rt.asan-dynamic-x86_64.vers -Wl,gnu-version-script-compat-shared -DARCH=arm -mabi=ilp32 -march=armv8-a -mbig-endian -D__ARCH_WANT_SYSCALL_OFF_T -D__ILP32__ -fstack-protector-strong --sysroot=${TOOL_PATH}/sdkilp32 -o CMakeFiles/asan.dir/sanitizer_common/sanitizer_platform_limits_posix.cpp.o -c /cdev/ASAN/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)