Open ms178 opened 1 week ago
I've tried a newer Clang-20 revision (fc3e6a81868a0c84e405622a64756e57f020ca37) and without -fexcess-precision=fast -freciprocal-math -fcx-limited-range -fvisibility=hidden
without success. However I did observe some differences without -g3 -mllvm -vp-counters-per-site=6
. But I still did get the following crash with the 64-bit mesa-git build:
[1691/1691] Linking target src/gallium/targets/va/libgallium_drv_video.so
FAILED: src/gallium/targets/va/libgallium_drv_video.so
clang++ -o src/gallium/targets/va/libgallium_drv_video.so src/gallium/targets/va/libgallium_drv_video.so.p/va_target.c.o -Wl,--as-needed -Wl,--allow-shlib-undefined -fuse-ld=lld -Wl,-O1 -shared -fPIC -Wl,-soname,libgallium_drv_video.so -Wl,--whole-archive -Wl,--start-group src/gallium/frontends/va/libva_st.a -Wl,--no-whole-archive -Wl,--gc-sections -Wl,--icf=all -Wl,--lto-O3,-O3,-Bsymbolic-functions,--as-needed -flto -fwhole-program-vtables -fuse-ld=lld -Wl,-zmax-page-size=0x200000 -fprofile-use=/home/marcus/Downloads/mesa.profdata -Wl,--push-state -Wl,-whole-archive -lmimalloc -Wl,--pop-state -lpthread -lstdc++ -lm -ldl -Wl,-z,now -Wl,-z,relro -Wl,-z,pack-relative-relocs -Wl,--hash-style=gnu -O3 -march=native -mtune=native -mllvm -inline-threshold=1500 -mllvm -extra-vectorizer-passes -mllvm -enable-cond-stores-vec -mllvm -slp-vectorize-hor-store -mllvm -enable-loopinterchange -mllvm -enable-loop-distribute -mllvm -enable-unroll-and-jam -mllvm -enable-loop-flatten -mllvm -unroll-runtime-multi-exit -mllvm -aggressive-ext-opt -mllvm -enable-interleaved-mem-accesses -mllvm -enable-masked-interleaved-mem-accesses -fno-math-errno -fno-trapping-math -falign-functions=32 -funroll-loops -fno-semantic-interposition -fcf-protection=none -mharden-sls=none -fomit-frame-pointer -mprefer-vector-width=256 -flto -fwhole-program-vtables -fsplit-lto-unit -mllvm -adce-remove-loops -mllvm -enable-ext-tsp-block-placement=1 -mllvm -enable-gvn-hoist=1 -mllvm -enable-dfa-jump-thread=1 -Wno-error -fprofile-use=/home/marcus/Downloads/mesa.profdata -fdata-sections -ffunction-sections -fno-unique-section-names -fsplit-machine-functions -mtls-dialect=gnu2 -w -fno-plt -Wp,-U_GLIBCXX_ASSERTIONS -D_FORTIFY_SOURCE=0 src/gallium/auxiliary/libgalliumvlwinsys.a src/util/libmesa_util.a src/util/libmesa_util_sse41.a src/util/blake3/libblake3.a src/c11/impl/libmesa_util_c11.a src/gallium/auxiliary/libgalliumvl.a src/compiler/nir/libnir.a src/compiler/libcompiler.a src/gallium/auxiliary/libgallium.a src/gallium/auxiliary/pipe-loader/libpipe_loader_static.a src/loader/libloader.a src/util/libxmlconfig.a src/gallium/winsys/sw/null/libws_null.a src/gallium/winsys/sw/wrapper/libwsw.a src/gallium/winsys/sw/dri/libswdri.a src/gallium/winsys/sw/kms-dri/libswkmsdri.a src/gallium/drivers/radeonsi/libradeonsi_gfx6.a src/amd/compiler/libaco.a src/gallium/drivers/radeonsi/libradeonsi_gfx7.a src/gallium/drivers/radeonsi/libradeonsi_gfx8.a src/gallium/drivers/radeonsi/libradeonsi_gfx9.a src/gallium/drivers/radeonsi/libradeonsi_gfx10.a src/gallium/drivers/radeonsi/libradeonsi_gfx103.a src/gallium/drivers/radeonsi/libradeonsi_gfx11.a src/gallium/drivers/radeonsi/libradeonsi_gfx115.a src/gallium/drivers/radeonsi/libradeonsi_gfx12.a src/gallium/drivers/radeonsi/libradeonsi.a src/gallium/winsys/radeon/drm/libradeonwinsys.a src/gallium/winsys/amdgpu/drm/libamdgpuwinsys.a src/amd/addrlib/libaddrlib.a src/amd/common/libamd_common.a src/amd/llvm/libamd_common_llvm.a src/amd/vpelib/liblibvpe.a.a -Wl,--version-script /tmp/makepkg/mesa-tkg-git/src/_build64/src/gallium/targets/va/va.sym -Wl,--dynamic-list /tmp/makepkg/mesa-tkg-git/src/mesa/src/gallium/targets/va/../dri.dyn -Wl,--gc-sections -Wl,--build-id=sha1 /usr/lib/libdrm.so /usr/lib/libz-ng.so -pthread /usr/lib/libzstd.so /usr/lib/libxcb-sync.so /usr/lib/libxcb-present.so /usr/lib/libxshmfence.so /usr/lib/libxcb-xfixes.so /usr/lib/libxcb-dri3.so -lLLVM-20git -lsensors /usr/lib/libexpat.so /usr/lib/libxcb.so /usr/lib/libxcb-randr.so -lLLVM-20git /usr/lib/libdrm_radeon.so -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git /usr/lib/libdrm_amdgpu.so /usr/lib/libelf.so -lLLVM-20git /usr/lib/libX11-xcb.so /usr/lib/libX11.so /usr/lib/libxcb-dri2.so -Wl,--end-group
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /usr/bin/ld.lld --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -shared -o src/gallium/targets/va/libgallium_drv_video.so /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64/crti.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1/crtbeginS.o -L/usr/bin/../lib/x86_64-pc-linux-gnu -L/usr/lib/clang/20/lib/x86_64-pc-linux-gnu -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1 -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib -plugin-opt=mcpu=alderlake -plugin-opt=O3 -plugin-opt=-function-sections=1 -plugin-opt=-data-sections=1 -plugin-opt=-split-machine-functions -plugin-opt=cs-profile-path=/home/marcus/Downloads/mesa.profdata -plugin-opt=-enable-tlsdesc src/gallium/targets/va/libgallium_drv_video.so.p/va_target.c.o --as-needed --allow-shlib-undefined -O1 -soname libgallium_drv_video.so --whole-archive --start-group src/gallium/frontends/va/libva_st.a --no-whole-archive --gc-sections --icf=all --lto-O3 -O3 -Bsymbolic-functions --as-needed -zmax-page-size=0x200000 --push-state -whole-archive -lmimalloc --pop-state -lpthread -lstdc++ -lm -ldl -z now -z relro -z pack-relative-relocs --hash-style=gnu src/gallium/auxiliary/libgalliumvlwinsys.a src/util/libmesa_util.a src/util/libmesa_util_sse41.a src/util/blake3/libblake3.a src/c11/impl/libmesa_util_c11.a src/gallium/auxiliary/libgalliumvl.a src/compiler/nir/libnir.a src/compiler/libcompiler.a src/gallium/auxiliary/libgallium.a src/gallium/auxiliary/pipe-loader/libpipe_loader_static.a src/loader/libloader.a src/util/libxmlconfig.a src/gallium/winsys/sw/null/libws_null.a src/gallium/winsys/sw/wrapper/libwsw.a src/gallium/winsys/sw/dri/libswdri.a src/gallium/winsys/sw/kms-dri/libswkmsdri.a src/gallium/drivers/radeonsi/libradeonsi_gfx6.a src/amd/compiler/libaco.a src/gallium/drivers/radeonsi/libradeonsi_gfx7.a src/gallium/drivers/radeonsi/libradeonsi_gfx8.a src/gallium/drivers/radeonsi/libradeonsi_gfx9.a src/gallium/drivers/radeonsi/libradeonsi_gfx10.a src/gallium/drivers/radeonsi/libradeonsi_gfx103.a src/gallium/drivers/radeonsi/libradeonsi_gfx11.a src/gallium/drivers/radeonsi/libradeonsi_gfx115.a src/gallium/drivers/radeonsi/libradeonsi_gfx12.a src/gallium/drivers/radeonsi/libradeonsi.a src/gallium/winsys/radeon/drm/libradeonwinsys.a src/gallium/winsys/amdgpu/drm/libamdgpuwinsys.a src/amd/addrlib/libaddrlib.a src/amd/common/libamd_common.a src/amd/llvm/libamd_common_llvm.a src/amd/vpelib/liblibvpe.a.a --version-script /tmp/makepkg/mesa-tkg-git/src/_build64/src/gallium/targets/va/va.sym --dynamic-list /tmp/makepkg/mesa-tkg-git/src/mesa/src/gallium/targets/va/../dri.dyn --gc-sections --build-id=sha1 /usr/lib/libdrm.so /usr/lib/libz-ng.so /usr/lib/libzstd.so /usr/lib/libxcb-sync.so /usr/lib/libxcb-present.so /usr/lib/libxshmfence.so /usr/lib/libxcb-xfixes.so /usr/lib/libxcb-dri3.so -lLLVM-20git -lsensors /usr/lib/libexpat.so /usr/lib/libxcb.so /usr/lib/libxcb-randr.so -lLLVM-20git /usr/lib/libdrm_radeon.so -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git -lLLVM-20git /usr/lib/libdrm_amdgpu.so /usr/lib/libelf.so -lLLVM-20git /usr/lib/libX11-xcb.so /usr/lib/libX11.so /usr/lib/libxcb-dri2.so --end-group -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1/crtendS.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64/crtn.o
1. Running pass "verify" on module "ld-temp.o"
#0 0x00007e6c98d4eea8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/bin/../lib/libLLVM.so.20.0git+0x314eea8)
#1 0x00007e6c98d4e9bc (/usr/bin/../lib/libLLVM.so.20.0git+0x314e9bc)
#2 0x00007e6c95845f50 (/usr/bin/../lib/libc.so.6+0x45f50)
#3 0x00007e6c99020db9 (/usr/bin/../lib/libLLVM.so.20.0git+0x3420db9)
#4 0x00007e6c9901fbee (/usr/bin/../lib/libLLVM.so.20.0git+0x341fbee)
#5 0x00007e6c98a36df7 (/usr/bin/../lib/libLLVM.so.20.0git+0x2e36df7)
#6 0x00007e6c98a30c52 llvm::verifyModule(llvm::Module const&, llvm::raw_ostream*, bool*) (/usr/bin/../lib/libLLVM.so.20.0git+0x2e30c52)
#7 0x00007e6c9903ab03 llvm::VerifierAnalysis::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x343ab03)
#8 0x00007e6c9b92712e (/usr/bin/../lib/libLLVM.so.20.0git+0x5d2712e)
#9 0x00007e6c987dff71 llvm::AnalysisManager<llvm::Module>::getResultImpl(llvm::AnalysisKey*, llvm::Module&) (/usr/bin/../lib/libLLVM.so.20.0git+0x2bdff71)
#10 0x00007e6c9903ab99 llvm::VerifierPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x343ab99)
#11 0x00007e6c9a5d4d8d (/usr/bin/../lib/libLLVM.so.20.0git+0x49d4d8d)
#12 0x00007e6c986ab1c5 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x2aab1c5)
#13 0x00007e6c9a5d2cf3 llvm::lto::opt(llvm::lto::Config const&, llvm::TargetMachine*, unsigned int, llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*, std::vector<unsigned char, std::allocator<unsigned char>> const&) (/usr/bin/../lib/libLLVM.so.20.0git+0x49d2cf3)
#14 0x00007e6c9a5d4f95 llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/usr/bin/../lib/libLLVM.so.20.0git+0x49d4f95)
#15 0x00007e6c98946182 llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/usr/bin/../lib/libLLVM.so.20.0git+0x2d46182)
#16 0x00007e6c98944a3f llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/usr/bin/../lib/libLLVM.so.20.0git+0x2d44a3f)
#17 0x000057bdc52c00ac lld::elf::BitcodeCompiler::compile() (/usr/bin/ld.lld+0x4c00ac)
#18 0x000057bdc51f8d98 (/usr/bin/ld.lld+0x3f8d98)
#19 0x000057bdc51df5aa lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/bin/ld.lld+0x3df5aa)
#20 0x000057bdc51dbc63 lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/usr/bin/ld.lld+0x3dbc63)
#21 0x000057bdc50e5d49 lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/usr/bin/ld.lld+0x2e5d49)
#22 0x000057bdc50dfae6 lld_main(int, char**, llvm::ToolContext const&) (/usr/bin/ld.lld+0x2dfae6)
#23 0x000057bdc50df99e main (/usr/bin/ld.lld+0x2df99e)
#24 0x00007e6c95826187 (/usr/bin/../lib/libc.so.6+0x26187)
#25 0x00007e6c95826237 __libc_start_main (/usr/bin/../lib/libc.so.6+0x26237)
#26 0x000057bdc50e3841 _start (/usr/bin/ld.lld+0x2e3841)
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: linker command failed due to signal (use -v to see invocation)
In the end, I had succes to build both the 64-bit and 32-bit Mesa-git without -g3 -mllvm -vp-counters-per-site=6
and using Mold instead of LLD:
export CC=clang
export CXX=clang++
export CC_LD=mold
export CXX_LD=mold
export AR=llvm-ar
export NM=llvm-nm
export STRIP=llvm-strip
export OBJCOPY=llvm-objcopy
export OBJDUMP=llvm-objdump
export READELF=llvm-readelf
export RANLIB=llvm-ranlib
export HOSTCC=clang
export HOSTCXX=clang++
export HOSTAR=llvm-ar
export CPPFLAGS="-D_FORTIFY_SOURCE=0"
export CFLAGS="-O3 -march=native -mtune=native -mllvm -inline-threshold=1500 -mllvm -extra-vectorizer-passes -mllvm -enable-cond-stores-vec -mllvm -slp-vectorize-hor-store -mllvm -enable-loopinterchange -mllvm -enable-loop-distribute -mllvm -enable-unroll-and-jam -mllvm -enable-loop-flatten -mllvm -unroll-runtime-multi-exit -mllvm -aggressive-ext-opt -mllvm -enable-interleaved-mem-accesses -mllvm -enable-masked-interleaved-mem-accesses -fno-math-errno -fno-trapping-math -falign-functions=32 -funroll-loops -fno-semantic-interposition -fcf-protection=none -mharden-sls=none -fomit-frame-pointer -mprefer-vector-width=256 -flto -fwhole-program-vtables -fsplit-lto-unit -mllvm -adce-remove-loops -mllvm -enable-ext-tsp-block-placement=1 -mllvm -enable-gvn-hoist=1 -mllvm -enable-dfa-jump-thread=1 -Wno-error -fprofile-use=/home/marcus/Downloads/all.profdata -fdata-sections -ffunction-sections -fno-unique-section-names -fsplit-machine-functions -mtls-dialect=gnu2 -w -fno-plt -fexcess-precision=fast -freciprocal-math -fcx-limited-range -fgnuc-version=10.5.0 -fvisibility=hidden"
export CXXFLAGS="${CFLAGS} -Wp,-U_GLIBCXX_ASSERTIONS"
export LDFLAGS="-Wl,--gc-sections -Wl,--icf=all -Wl,--lto-O3,-O3,-Bsymbolic-functions,--as-needed -flto -fwhole-program-vtables -fuse-ld=mold -Wl,-zmax-page-size=0x200000 -fprofile-use=/home/marcus/Downloads/all.profdata -Wl,--push-state -Wl,-whole-archive -lmimalloc -Wl,--pop-state -lpthread -lstdc++ -lm -ldl -Wl,-z,now -Wl,-z,relro -Wl,-z,pack-relative-relocs -Wl,--hash-style=gnu -fvisibility=hidden"
export CCLDFLAGS="$LDFLAGS"
export CXXLDFLAGS="$LDFLAGS"
export ASFLAGS="-D__AVX__=1 -D__AVX2__=1 -D__FMA__=1"
Using clang version 20.0.0git (4fef204ac42eb84e167d43ce076c9a167eae3be0), I see the following crash compiling lib32-mesa-git on a Intel Raptor Lake system. From the diagnostic, this seems to be a problem in the loop-vectorize pass.