[compiler-rt] [CompilerRT] Add numerical sanitizer (PR #94322)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 08:40:21 PDT 2024


ilovepi wrote:

Hi, we're seeing some test failures in our Linux CI bots for arm64 and x64 after this patch. It appears that the c++ file for gtest is being compiled w/ `clang` instead of `clang++`. Its not clear to me why that's happening, from a quick look at the patch. Probably a small mistake in the CMake?

Error Message:
```
FAILED: compiler-rt/lib/nsan/tests/NsanTestObjects.gtest-all.cc.x86_64.o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/nsan/tests/NsanTestObjects.gtest-all.cc.x86_64.o 
cd /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/nsan/tests && /b/s/w/ir/x/w/llvm_build/./bin/clang --target=x86_64-unknown-linux-gnu -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -ffile-prefix-map=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins=../../../llvm-llvm-project -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -Wall -Wno-unused-parameter -Wno-unknown-warning-option -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -I/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/include -nostdinc++ -g -Wno-covered-switch-default -Wno-suggest-override -DGTEST_NO_LLVM_SUPPORT=1 -DGTEST_HAS_RTTI=0 -I/b/s/w/ir/x/w/llvm-llvm-project/runtimes/../third-party/unittest/googletest/include -I/b/s/w/ir/x/w/llvm-llvm-project/runtimes/../third-party/unittest/googletest -I/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/ -DSANITIZER_COMMON_REDEFINE_BUILTINS_IN_STD -O2 -g -fno-omit-frame-pointer -c -o NsanTestObjects.gtest-all.cc.x86_64.o /b/s/w/ir/x/w/llvm-llvm-project/third-party/unittest/googletest/src/gtest-all.cc
In file included from /b/s/w/ir/x/w/llvm-llvm-project/third-party/unittest/googletest/src/gtest-all.cc:38:
/b/s/w/ir/x/w/llvm-llvm-project/runtimes/../third-party/unittest/googletest/include/gtest/gtest.h:52:10: fatal error: 'cstddef' file not found
   52 | #include <cstddef>
      |          ^~~~~~~~~
1 error generated.
```

Failing bot:   https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8744662427054892657/overview

Bug: https://fxbug.dev/348377270

I'm not sure how this is passing in buildbot. Can you take a look, and if its hard to fix quickly, revert until it can be relanded?

As an FYI on our build config, it isn't special, its a normal Linux toolchain, using the RUNTIMES build, and fails w/ both stage1 and stage2 toolchains. Of note is that our bots don't have a libc installed, and we build our toolchains hermetically w/ a curated Linux sysroot. There's a chance your patch isn't respecting the SYSROOT correctly, but I haven't looked closely enough to be sure.

That said, I'm fairly certain the error in this case is using the c compiler vs. the c++ compiler.

https://github.com/llvm/llvm-project/pull/94322


More information about the llvm-commits mailing list