Skip to content

[compiler-rt] Multiple Builtins-sparc-linux tests failing on 64-bit Linux SPARC #77358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
glaubitz opened this issue Jan 8, 2024 · 8 comments

Comments

@glaubitz
Copy link
Contributor

glaubitz commented Jan 8, 2024

A lot of if not all of the Builtins-sparc-linux tests are failing on 64-bit Linux SPARC due to incorrect target settings which results in a linker failure:

--

********************
FAIL: Builtins-sparc-linux :: ctzsi2_test.c (31 of 74554)
******************** TEST 'Builtins-sparc-linux :: ctzsi2_test.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/stage1/./bin/clang   -gline-tables-only  -m32  -fno-builtin -I /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/llvm/compiler-rt/lib/builtins -nodefaultlibs /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/llvm/compiler-rt/test/builtins/Unit/ctzsi2_test.c /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/stage1/./lib/../lib/clang/18/lib/sparcv9-unknown-linux-gnu/libclang_rt.builtins.a -lc -lm -o /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/stage1/projects/compiler-rt/test/builtins/Unit/SPARCLinuxConfig/Output/ctzsi2_test.c.tmp &&  /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/stage1/projects/compiler-rt/test/builtins/Unit/SPARCLinuxConfig/Output/ctzsi2_test.c.tmp
+ /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/stage1/./bin/clang -gline-tables-only -m32 -fno-builtin -I /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/llvm/compiler-rt/lib/builtins -nodefaultlibs /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/llvm/compiler-rt/test/builtins/Unit/ctzsi2_test.c /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/stage1/./lib/../lib/clang/18/lib/sparcv9-unknown-linux-gnu/libclang_rt.builtins.a -lc -lm -o /var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/stage1/projects/compiler-rt/test/builtins/Unit/SPARCLinuxConfig/Output/ctzsi2_test.c.tmp
/usr/bin/ld: sparc:v9 architecture of input file `/var/lib/buildbot/workers/debian-stadler-sparc64/clang-sparc64-linux-multistage/stage1/./lib/../lib/clang/18/lib/sparcv9-unknown-linux-gnu/libclang_rt.builtins.a(ctzsi2.c.o)' is incompatible with sparc:v8plus output
clang: error: linker command failed with exit code 1 (use -v to see invocation)

--

Full build log available at: https://lab.llvm.org/staging/#/builders/159/builds/12

CC @jrtc27 @koachan @thesamesam

@koachan
Copy link
Contributor

koachan commented Jan 14, 2024

Any way I can reproduce this? The log link only gives me an empty page...

@glaubitz
Copy link
Contributor Author

Any way I can reproduce this? The log link only gives me an empty page...

Hmm, for some reason the information for this particular build is no longer available.

Basically, this is with compiler-rt and sanitizers enabled, then the testsuite being run.

I will try to extract the cmake command line.

@glaubitz
Copy link
Contributor Author

Try with:

cmake -G Ninja ../llvm/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=True -DLLVM_LIT_ARGS='-v' -DCMAKE_INSTALL_PREFIX=../stage1.install -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_PARALLEL_LINK_JOBS=4 -DLLVM_TARGETS_TO_BUILD=Sparc -DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;compiler-rt;llvm

This is on Linux (Debian unstable sparc64).

@koachan
Copy link
Contributor

koachan commented Jan 25, 2024

Try with:

cmake -G Ninja ../llvm/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=True -DLLVM_LIT_ARGS='-v' -DCMAKE_INSTALL_PREFIX=../stage1.install -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_PARALLEL_LINK_JOBS=4 -DLLVM_TARGETS_TO_BUILD=Sparc -DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;compiler-rt;llvm

This is on Linux (Debian unstable sparc64).

Hmm, weird. I tried this then followed by ninja check-builtins but I don't see this kind of error?
The only failure I get is this which I don't think is related?

FAIL: Builtins-sparcv9-linux :: compiler_rt_logbl_test.c (95 of 218)                                                                    
******************** TEST 'Builtins-sparcv9-linux :: compiler_rt_logbl_test.c' FAILED ********************                                                                                                                                                                      
Exit Code: 1                                                                                                                            
                                                                                                                                        
Command Output (stdout):                                                                                                                
--                                                                                                                                                                                                                                                                              
error: in __compiler_rt_logbl([BFFF000000000000 0]) = [3FFE000000000000 0] !=  [0 0]                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                
--                                                                                                                                      
Command Output (stderr):                                                                                                                
--                                                                                                                                                                                                                                                                              
RUN: at line 1: /home/k/llvm-debug/src/llvm-project/out/./bin/clang   -gline-tables-only  -m64  -fno-builtin -I /home/k/llvm-debug/src/llvm-project/compiler-rt/lib/builtins -nodefaultlibs /home/k/llvm-debug/src/llvm-project/compiler-rt/test/builtins/Unit/compiler_rt_logbl
_test.c /home/k/llvm-debug/src/llvm-project/out/./lib/../lib/clang/18/lib/sparcv9-unknown-linux-gnu/libclang_rt.builtins.a -lc -lm -o /home/k/llvm-debug/src/llvm-project/out/projects/compiler-rt/test/builtins/Unit/SPARCV9LinuxConfig/Output/compiler_rt_logbl_test.c.tmp && 
 /home/k/llvm-debug/src/llvm-project/out/projects/compiler-rt/test/builtins/Unit/SPARCV9LinuxConfig/Output/compiler_rt_logbl_test.c.tmp 
+ /home/k/llvm-debug/src/llvm-project/out/./bin/clang -gline-tables-only -m64 -fno-builtin -I /home/k/llvm-debug/src/llvm-project/compiler-rt/lib/builtins -nodefaultlibs /home/k/llvm-debug/src/llvm-project/compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c /home/k/ll
vm-debug/src/llvm-project/out/./lib/../lib/clang/18/lib/sparcv9-unknown-linux-gnu/libclang_rt.builtins.a -lc -lm -o /home/k/llvm-debug/src/llvm-project/out/projects/compiler-rt/test/builtins/Unit/SPARCV9LinuxConfig/Output/compiler_rt_logbl_test.c.tmp                      
+ /home/k/llvm-debug/src/llvm-project/out/projects/compiler-rt/test/builtins/Unit/SPARCV9LinuxConfig/Output/compiler_rt_logbl_test.c.tmp                                                                                                                                        
                                                                                                                                                                                                                                                                                
--                                                                                                                                      
                                                                    
********************

@brad0
Copy link
Contributor

brad0 commented Jan 26, 2024

cc @rorth

@rorth
Copy link
Collaborator

rorth commented Jan 31, 2024

I had to clean out previous Linux/sparc64 builds to make root for LLVM 18.1.0 rc1. When doing a runtimes build on main (like test-release.sh would do), I found that in that case the builtins tests still aren't run at all: check-all misses 3200+ compiler-rt tests in runtimes build #72511 .

I'll run a projects build once the release build is done, but the latter is dog slow on my system, on the order of several days.

@rorth
Copy link
Collaborator

rorth commented Aug 13, 2024

The only builtins test that FAILs for me on Linux/sparc64 is

Builtins-sparcv9-linux :: compiler_rt_logbl_test.c

The test errors out with

error: in __compiler_rt_logbl([BFFF000000000000 0]) = [3FFE000000000000 0] !=  [0 0]

Initially, I could reduce the testcase to the attached crlt.c. Looking further, the miscompilation happens at the call to _Qp_itoq. Compiling the testcase with gcc-14 works while compiling the identical testcase withclang-20 breaks.

It's even easier to see with the further reduced ti.c.

Compile with

gcc-14 -m64 -g3 -O0  -fno-builtin -I compiler-rt/lib/builtins -nodefaultlibs crlt.c -lgcc -lc -lm -o crlt

(same with clang-20) or

gcc-14 -m64 -g3 -O0 -o ti ti.c

FWIW, the test always works on Solaris/sparcv9, both with gcc and clang.

@rorth
Copy link
Collaborator

rorth commented Aug 13, 2024

crlt.c.txt
ti.c.txt
Testcases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants