s117 / anycore-riscv

The AnyCore toolset targetting the RISC-V ISA
Other
0 stars 0 forks source link

471.omnetpp_ref and 483.xalancbmk_ref failed due to missing system call #22

Closed s117 closed 10 months ago

s117 commented 10 months ago

See the log below:

spike -m256 -s100000000  +strace=./syscall.trace +std-dump=./console  +chroot=./simenv +target-cwd=/app pk   omnetpp_base.llvm omnetpp.ini
Requesting target memory 0x10000000
******* Resetting core ********** 
****Initializing the processor system****
******* Resetting core ********** 
******* Resetting core ********** 
****Initialization complete****
bad syscall array_size 1063 #98->0!
******* Resetting core ********** 
$ spike -m512 -s100000000  +strace=./syscall.trace +std-dump=./console  +chroot=./simenv +target-cwd=/app pk   Xalan_base.llvm -v t5.xml xalanc.xsl
Requesting target memory 0x20000000
******* Resetting core ********** 
****Initializing the processor system****
******* Resetting core ********** 
******* Resetting core ********** 
****Initialization complete****
bad syscall array_size 1063 #98->0!
******* Resetting core ********** 
s117 commented 10 months ago

Syscall 98 is futex for rv64: https://github.com/s117/riscv-glibc/blob/37694b4bd22eccb79409039b7a38fe1f23a0509d/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h#L64

s117 commented 10 months ago

futex was called because glibc was compiled with multithread support (thread model: posix).

$ riscv64-unknown-linux-gnu-clang -v          
clang version 17.0.2 (https://github.com/llvm/llvm-project.git b2417f51dbbd7435eb3aaf203de24de6754da50e)
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/s117/Research/toolchain/anycore/gcc13.2.0_clang17.0.2/install-linux/bin
Found candidate GCC installation: /home/s117/Research/toolchain/anycore/gcc13.2.0_clang17.0.2/install-linux/bin/../sysroot/lib/gcc/riscv64-unknown-linux-gnu/13.2.0
Selected GCC installation: /home/s117/Research/toolchain/anycore/gcc13.2.0_clang17.0.2/install-linux/bin/../sysroot/lib/gcc/riscv64-unknown-linux-gnu/13.2.0

$ riscv64-unknown-linux-gnu-gcc -v  
Using built-in specs.
COLLECT_GCC=riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/s117/Research/toolchain/anycore/gcc13.2.0_clang17.0.2/install-linux/libexec/gcc/riscv64-unknown-linux-gnu/13.2.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /home/s117/Research/toolchain/anycore/gcc13.2.0_clang17.0.2/riscv-gnu-toolchain/build_linux/../gcc/configure --target=riscv64-unknown-linux-gnu --prefix=/home/s117/Research/toolchain/anycore/gcc13.2.0_clang17.0.2/install-linux --with-sysroot=/home/s117/Research/toolchain/anycore/gcc13.2.0_clang17.0.2/install-linux/sysroot --with-pkgversion=gc891d8dc23e --with-system-zlib --enable-shared --enable-tls --enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libsanitizer --disable-nls --disable-bootstrap --src=../../gcc --disable-multilib --with-abi=lp64d --with-arch=rv64imafd --with-tune=rocket --with-isa-spec=20191213 'CFLAGS_FOR_TARGET=-O2 -g -g  -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2 -g -g  -mcmodel=medlow'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (gc891d8dc23e) 

image

Since PK is a single-threaded environment, multithread support should be disabled in the compiler and glibc.

Related links on how to set the thread model to single: https://gcc.gnu.org/install/configure.html https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html https://gcc.gnu.org/onlinedocs/gcc-4.8.5/libstdc++/manual/manual/using_concurrency.html https://llvm.org/docs/CMake.html

s117 commented 10 months ago

Fixed by adc2fe2