[compiler-rt] [llvm] [compiler-rt][X86] Use functions in cpuid.h instead of inline assembly (PR #97877)
Khem Raj via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 26 18:43:16 PDT 2024
kraj wrote:
@boomanaiden154 this is causing a build regression when compiling standalone compiler-rt for x86_64 in a cross build environment
```
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/recipe-sysroot-native/usr/bin/x86_64-yoe-linux-musl/x86_64-yoe-linux-musl-clang --target=x86_64-yoe-linux-musl --sysroot=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/recipe-sysroot -DVISIBILITY_HIDDEN -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/compiler-rt-20.0.0/projects/compiler-rt/lib/builtins -I/mnt/b/yoe/master/workspace/sources/llvm-project/compiler-rt/lib/builtins -I/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/compiler-rt-20.0.0/include -I/mnt/b/yoe/master/workspace/sources/llvm-project/llvm/include -target x86_64-yoe-linux-musl -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/recipe-sysroot -O2 -g -fmacro-prefix-map=/mnt/b/yoe/master/workspace/sources/llvm-project=/usr/src/debug/compiler-rt/20.0.0 -fdebug-prefix-map=/mnt/b/yoe/master/workspace/sources/llvm-project=/usr/src/debug/compiler-rt/20.0.0 -fmacro-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/compiler-rt-20.0.0=/usr/src/debug/compiler-rt/20.0.0 -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/compiler-rt-20.0.0=/usr/src/debug/compiler-rt/20.0.0 -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/recipe-sysroot= -fmacro-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/recipe-sysroot= -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/compiler-rt/20.0.0/recipe-sysroot-native= -pipe -fPIC -fno-semantic-interposition -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -O2 -g -DNDEBUG -fPIC -fno-lto -Werror=array-bounds -Werror=uninitialized -Werror=shadow -Werror=empty-body -Werror=sizeof-pointer-memaccess -Werror=sizeof-array-argument -Werror=suspicious-memaccess -Werror=builtin-memcpy-chk-size -Werror=array-bounds-pointer-arithmetic -Werror=return-stack-address -Werror=sizeof-array-decay -Werror=format-insufficient-args -Wformat -std=c11 -DCOMPILER_RT_HAS_FLOAT16 -MD -MT projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-x86_64.dir/cpu_model/x86.c.o -MF projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-x86_64.dir/cpu_model/x86.c.o.d -o projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-x86_64.dir/cpu_model/x86.c.o -c /mnt/b/yoe/master/workspace/sources/llvm-project/compiler-rt/lib/builtins/cpu_model/x86.c
/mnt/b/yoe/master/workspace/sources/llvm-project/compiler-rt/lib/builtins/cpu_model/x86.c:27:10: fatal error: 'cpuid.h' file not found
27 | #include "cpuid.h"
| ^~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
```
if I manually add ` -I/mnt/b/yoe/master/workspace/sources/llvm-project/clang/lib/Headers/` to compiler invocation then it works but I thought it should be automatically added ?
https://github.com/llvm/llvm-project/pull/97877
More information about the llvm-commits
mailing list