Issue 176892
Summary compiler-rt builtins tests fail on mac and windows with -DCOMPILER_RT_BUILD_CRT=ON
Labels compiler-rt:builtins
Assignees
Reporter zmodem
    https://github.com/llvm/llvm-project/pull/171941 made the builtins tests run when configured as part of a "runtimes build" (`-DLLVM_ENABLE_RUNTIMES=...`).

As reported in https://github.com/llvm/llvm-project/pull/174443#issuecomment-3729604341, not all of the tests pass on Mac and Windows. Specifically, when building with `-DCOMPILER_RT_BUILD_CRT=ON` some tests with `// REQUIRES: crt` will fail due to unsupported flags or missing `crt1.o` etc.

See below for the failures.

Presumably these tests were never meant to run on Mac or Windows? Should we mark them unsupported? `REQUIRES: linux`?

---

When configuring and building with

```
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=Native -DLLVM_ENABLE_RUNTIMES=compiler-rt -DCOMPILER_RT_BUILD_CRT=ON ../llvm
ninja check-runtime
```

On arm64 Mac:

```
FAIL: Builtins-arm64-darwin :: ctor_dtor.c (633 of 3119)
******************** TEST 'Builtins-arm64-darwin :: ctor_dtor.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/Users/hwennborg/llvm-project/build.test/./bin/clang   -arch arm64 -stdlib=libc++ -mmacosx-version-min=10.13 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mlinker-version=1230.1 -fno-builtin -I /Users/hwennborg/llvm-project/compiler-rt/lib/builtins -nodefaultlibs -fno-use-init-array -g -c /Users/hwennborg/llvm-project/compiler-rt/test/builtins/Unit/ctor_dtor.c -o /Users/hwennborg/llvm-project/build.test/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/ARM64DarwinConfig/Output/ctor_dtor.c.tmp.o
# executed command: /Users/hwennborg/llvm-project/build.test/./bin/clang -arch arm64 -stdlib=libc++ -mmacosx-version-min=10.13 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mlinker-version=1230.1 -fno-builtin -I /Users/hwennborg/llvm-project/compiler-rt/lib/builtins -nodefaultlibs -fno-use-init-array -g -c /Users/hwennborg/llvm-project/compiler-rt/test/builtins/Unit/ctor_dtor.c -o /Users/hwennborg/llvm-project/build.test/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/ARM64DarwinConfig/Output/ctor_dtor.c.tmp.o
# .---command stderr------------
# | clang: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument]
# | clang: warning: argument unused during compilation: '-fno-use-init-array' [-Wunused-command-line-argument]
# `-----------------------------
# RUN: at line 4
/Users/hwennborg/llvm-project/build.test/./bin/clang   -arch arm64 -stdlib=libc++ -mmacosx-version-min=10.13 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mlinker-version=1230.1 -fno-builtin -I /Users/hwennborg/llvm-project/compiler-rt/lib/builtins -nodefaultlibs -o /Users/hwennborg/llvm-project/build.test/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/ARM64DarwinConfig/Output/ctor_dtor.c.tmp -no-pie -nostdlib crt1.o crti.o /Users/hwennborg/llvm-project/build.test/./lib/../lib/clang/23/lib/darwin/clang_rt.crtbegin-arm64.o /Users/hwennborg/llvm-project/build.test/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/ARM64DarwinConfig/Output/ctor_dtor.c.tmp.o -lc /Users/hwennborg/llvm-project/build.test/lib/clang/23/lib/darwin/libclang_rt.osx.a /Users/hwennborg/llvm-project/build.test/./lib/../lib/clang/23/lib/darwin/clang_rt.crtend-arm64.o crtn.o
# executed command: /Users/hwennborg/llvm-project/build.test/./bin/clang -arch arm64 -stdlib=libc++ -mmacosx-version-min=10.13 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mlinker-version=1230.1 -fno-builtin -I /Users/hwennborg/llvm-project/compiler-rt/lib/builtins -nodefaultlibs -o /Users/hwennborg/llvm-project/build.test/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/ARM64DarwinConfig/Output/ctor_dtor.c.tmp -no-pie -nostdlib crt1.o crti.o /Users/hwennborg/llvm-project/build.test/./lib/../lib/clang/23/lib/darwin/clang_rt.crtbegin-arm64.o /Users/hwennborg/llvm-project/build.test/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/ARM64DarwinConfig/Output/ctor_dtor.c.tmp.o -lc /Users/hwennborg/llvm-project/build.test/lib/clang/23/lib/darwin/libclang_rt.osx.a /Users/hwennborg/llvm-project/build.test/./lib/../lib/clang/23/lib/darwin/clang_rt.crtend-arm64.o crtn.o
# .---command stderr------------
# | clang: error: no such file or directory: 'crt1.o'
# | clang: error: no such file or directory: 'crti.o'
# | clang: error: no such file or directory: '/Users/hwennborg/llvm-project/build.test/./lib/../lib/clang/23/lib/darwin/clang_rt.crtbegin-arm64.o'
# | clang: error: no such file or directory: '/Users/hwennborg/llvm-project/build.test/./lib/../lib/clang/23/lib/darwin/clang_rt.crtend-arm64.o'
# | clang: error: no such file or directory: 'crtn.o'
# `-----------------------------
# error: command failed with exit status: 1
```

On Windows:

```
FAIL: Builtins-x86_64-windows :: ctor_dtor.c (1820 of 3056, 3 of 3 attempts)
******************** TEST 'Builtins-x86_64-windows :: ctor_dtor.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
C:/src/llvm-project/build.test/./bin/clang.exe   -DCOMPILER_RT_HAS_FLOAT16 -fno-builtin -I C:/src/llvm-project/compiler-rt\lib\builtins -nodefaultlibs -fno-use-init-array -g -c C:\src\llvm-project\compiler-rt\test\builtins\Unit\ctor_dtor.c -o C:\src\llvm-project\build.test\runtimes\runtimes-bins\compiler-rt\test\builtins\Unit\X86_64WindowsConfig\Output\ctor_dtor.c.tmp.o
# executed command: C:/src/llvm-project/build.test/./bin/clang.exe -DCOMPILER_RT_HAS_FLOAT16 -fno-builtin -I 'C:/src/llvm-project/compiler-rt\lib\builtins' -nodefaultlibs -fno-use-init-array -g -c 'C:\src\llvm-project\compiler-rt\test\builtins\Unit\ctor_dtor.c' -o 'C:\src\llvm-project\build.test\runtimes\runtimes-bins\compiler-rt\test\builtins\Unit\X86_64WindowsConfig\Output\ctor_dtor.c.tmp.o'
# .---command stderr------------
# | clang: warning: argument unused during compilation: '-fno-use-init-array' [-Wunused-command-line-argument]
# `-----------------------------
# RUN: at line 4
C:/src/llvm-project/build.test/./bin/clang.exe   -DCOMPILER_RT_HAS_FLOAT16 -fno-builtin -I C:/src/llvm-project/compiler-rt\lib\builtins -nodefaultlibs -o C:\src\llvm-project\build.test\runtimes\runtimes-bins\compiler-rt\test\builtins\Unit\X86_64WindowsConfig\Output\ctor_dtor.c.tmp -no-pie -nostdlib crt1.o crti.o C:/src/llvm-project/build.test/./lib/../lib/clang/23/lib/windows\clang_rt.crtbegin-x86_64.o C:\src\llvm-project\build.test\runtimes\runtimes-bins\compiler-rt\test\builtins\Unit\X86_64WindowsConfig\Output\ctor_dtor.c.tmp.o -lc libgcc.a C:/src/llvm-project/build.test/./lib/../lib/clang/23/lib/windows\clang_rt.crtend-x86_64.o crtn.o
# executed command: C:/src/llvm-project/build.test/./bin/clang.exe -DCOMPILER_RT_HAS_FLOAT16 -fno-builtin -I 'C:/src/llvm-project/compiler-rt\lib\builtins' -nodefaultlibs -o 'C:\src\llvm-project\build.test\runtimes\runtimes-bins\compiler-rt\test\builtins\Unit\X86_64WindowsConfig\Output\ctor_dtor.c.tmp' -no-pie -nostdlib crt1.o crti.o 'C:/src/llvm-project/build.test/./lib/../lib/clang/23/lib/windows\clang_rt.crtbegin-x86_64.o' 'C:\src\llvm-project\build.test\runtimes\runtimes-bins\compiler-rt\test\builtins\Unit\X86_64WindowsConfig\Output\ctor_dtor.c.tmp.o' -lc libgcc.a 'C:/src/llvm-project/build.test/./lib/../lib/clang/23/lib/windows\clang_rt.crtend-x86_64.o' crtn.o
# .---command stderr------------
# | clang: error: no such file or directory: 'crt1.o'
# | clang: error: no such file or directory: 'crti.o'
# | clang: error: no such file or directory: 'C:/src/llvm-project/build.test/./lib/../lib/clang/23/lib/windows\clang_rt.crtbegin-x86_64.o'
# | clang: error: no such file or directory: 'libgcc.a'
# | clang: error: no such file or directory: 'C:/src/llvm-project/build.test/./lib/../lib/clang/23/lib/windows\clang_rt.crtend-x86_64.o'
# | clang: error: no such file or directory: 'crtn.o'
# `-----------------------------
# error: command failed with exit status: 1

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50..
FAIL: Builtins-x86_64-windows :: dso_handle.cpp (1824 of 3056, 3 of 3 attempts)
******************** TEST 'Builtins-x86_64-windows :: dso_handle.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
C:/src/llvm-project/build.test/./bin/clang.exe   -DCOMPILER_RT_HAS_FLOAT16 -fno-builtin -I C:/src/llvm-project/compiler-rt\lib\builtins -nodefaultlibs -g -fno-exceptions -DCRT_SHARED -c C:\src\llvm-project\compiler-rt\test\builtins\Unit\dso_handle.cpp -fPIC -o C:\src\llvm-project\build.test\runtimes\runtimes-bins\compiler-rt\test\builtins\Unit\X86_64WindowsConfig\Output\dso_handle.cpp.tmpshared.o
# executed command: C:/src/llvm-project/build.test/./bin/clang.exe -DCOMPILER_RT_HAS_FLOAT16 -fno-builtin -I 'C:/src/llvm-project/compiler-rt\lib\builtins' -nodefaultlibs -g -fno-exceptions -DCRT_SHARED -c 'C:\src\llvm-project\compiler-rt\test\builtins\Unit\dso_handle.cpp' -fPIC -o 'C:\src\llvm-project\build.test\runtimes\runtimes-bins\compiler-rt\test\builtins\Unit\X86_64WindowsConfig\Output\dso_handle.cpp.tmpshared.o'
# .---command stderr------------
# | clang: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'
# `-----------------------------
# error: command failed with exit status: 1

--
```

dso_handle.cpp also failed on x64 Mac. It didn't run on arm64 because of  `// UNSUPPORTED: target={{(arm|aarch64).*}}`

```
 ******************** TEST 'Builtins-x86_64-darwin :: dso_handle.cpp' FAILED ********************
 Exit Code: 1
 
 Command Output (stdout):
 --
 # RUN: at line 3
 /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang --driver-mode=g++  -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.12 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -mlinker-version=1221.4  -fno-builtin -I /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins -nodefaultlibs -g -fno-exceptions -DCRT_SHARED -c /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/builtins/Unit/dso_handle.cpp -fPIC -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/X86_64DarwinConfig/Output/dso_handle.cpp.tmpshared.o
 # executed command: /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang --driver-mode=g++ -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.12 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -mlinker-version=1221.4 -fno-builtin -I /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins -nodefaultlibs -g -fno-exceptions -DCRT_SHARED -c /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/builtins/Unit/dso_handle.cpp -fPIC -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/X86_64DarwinConfig/Output/dso_handle.cpp.tmpshared.o
 # RUN: at line 4
 /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang --driver-mode=g++  -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.12 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -mlinker-version=1221.4  -fno-builtin -I /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins -nodefaultlibs -g -fno-exceptions -c /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/builtins/Unit/dso_handle.cpp -fPIC -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/X86_64DarwinConfig/Output/dso_handle.cpp.tmp.o
 # executed command: /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang --driver-mode=g++ -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.12 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -mlinker-version=1221.4 -fno-builtin -I /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins -nodefaultlibs -g -fno-exceptions -c /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/builtins/Unit/dso_handle.cpp -fPIC -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/X86_64DarwinConfig/Output/dso_handle.cpp.tmp.o
 # RUN: at line 5
 /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang --driver-mode=g++  -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.12 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -mlinker-version=1221.4  -fno-builtin -I /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins -nodefaultlibs -g -shared -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/X86_64DarwinConfig/Output/dso_handle.cpp.tmp.so -nostdlib crti.o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./lib/../lib/clang/22/lib/darwin/clang_rt.crtbegin-x86_64.o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/X86_64DarwinConfig/Output/dso_handle.cpp.tmpshared.o -lc++ -lc -lm /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/lib/clang/22/lib/darwin/libclang_rt.osx.a /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./lib/../lib/clang/22/lib/darwin/clang_rt.crtend-x86_64.o crtn.o
 # executed command: /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./bin/clang --driver-mode=g++ -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.12 -isysroot /Volumes/Work/s/w/ir/cache/osx_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -mlinker-version=1221.4 -fno-builtin -I /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/builtins -nodefaultlibs -g -shared -o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/X86_64DarwinConfig/Output/dso_handle.cpp.tmp.so -nostdlib crti.o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/./lib/../lib/clang/22/lib/darwin/clang_rt.crtbegin-x86_64.o /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/runtimes/runtimes-bins/compiler-rt/test/builtins/Unit/X86_64DarwinConfig/Output/dso_handle.cpp.tmpshared.o -lc++ -lc -lm /Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm-build/Release+Asserts/lib/clang/22/lib/darwin/libclang_rt.osx.a /Volumes/Work/s/w/ir<truncated>Please see the issue for the entire body.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to