Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 921728 - sys-devel/lld: segmentation fault when building media-libs/vips-8.15.1 with -flto
Summary: sys-devel/lld: segmentation fault when building media-libs/vips-8.15.1 with -...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-10 21:14 UTC by Denis Strizhkin
Modified: 2024-01-10 22:01 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,305.26 KB, text/x-log)
2024-01-10 21:14 UTC, Denis Strizhkin
Details
emerge --info (info.txt,6.29 KB, text/plain)
2024-01-10 21:15 UTC, Denis Strizhkin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Strizhkin 2024-01-10 21:14:58 UTC
Created attachment 881878 [details]
build.log

Can't compile this package with llvm -flto because lld segfaults:

[41651.301777] ld.lld[64395]: segfault at 18 ip 00007f5b14b6b214 sp 00007ffeed279e40 error 4 in libLLVM-17+libcxx.so[7f5b132b9000+41b6000] likely on CPU 10 (core 4, socket 0)

Stack dump:
0.	Program arguments: /usr/lib/llvm/17/bin/ld.lld --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -shared -o libvips/libvips.so.42.17.1 /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/crti.o /usr/lib/llvm/17/bin/../../../../lib/clang/17/lib/linux/clang_rt.crtbegin-x86_64.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/13 -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/lib -L/lib -L/usr/lib -plugin-opt=mcpu=znver3 -plugin-opt=O3 -z relro libvips/libvips.so.42.17.1.p/meson-generated_.._include_vips_enumtypes.c.o --as-needed --no-undefined --start-group -soname libvips.so.42 --whole-archive libvips/foreign/libnsgif/libnsgif.a libvips/foreign/libforeign.a libvips/arithmetic/libarithmetic.a libvips/resample/libresample.a libvips/colour/libcolour.a libvips/conversion/libconversion.a libvips/convolution/libconvolution.a libvips/freqfilt/libfreqfilt.a libvips/histogram/libhistogram.a libvips/draw/libdraw.a libvips/iofuncs/libiofuncs.a libvips/morphology/libmorphology.a libvips/mosaicing/libmosaicing.a libvips/create/libcreate.a --no-whole-archive -O1 --as-needed -z pack-relative-relocs --as-needed -z nodelete /usr/lib64/libglib-2.0.so /usr/lib64/libgio-2.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libgmodule-2.0.so /usr/lib64/libexpat.so -lm /usr/lib64/libjpeg.so /usr/lib64/libpng16.so /usr/lib64/libhwy.so --end-group -lc++ -lm /usr/lib/llvm/17/bin/../../../../lib/clang/17/lib/linux/libclang_rt.builtins-x86_64.a --as-needed -lunwind --no-as-needed -lpthread -lc /usr/lib/llvm/17/bin/../../../../lib/clang/17/lib/linux/libclang_rt.builtins-x86_64.a --as-needed -lunwind --no-as-needed /usr/lib/llvm/17/bin/../../../../lib/clang/17/lib/linux/clang_rt.crtend-x86_64.o /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/crtn.o
 #0 0x00007f5b13457ca6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17+libcxx.so+0x3a57ca6)
 #1 0x00007f5b13455330 llvm::sys::RunSignalHandlers() (/usr/lib/llvm/17/bin/../lib64/libLLVM-17+libcxx.so+0x3a55330)
 #2 0x00007f5b13458483 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17+libcxx.so+0x3a58483)
 #3 0x00007f5b0f72c1f0 (/usr/lib64/libc.so.6+0x3a1f0)
 #4 0x00007f5b14b6b214 llvm::computeDeadSymbolsAndUpdateIndirectCalls(llvm::ModuleSummaryIndex&, llvm::DenseSet<unsigned long, llvm::DenseMapInfo<unsigned long, void>> const&, llvm::function_ref<llvm::PrevailingType (unsigned long)>) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17+libcxx.so+0x516b214)
 #5 0x00007f5b15214fc9 llvm::lto::LTO::run(std::__1::function<llvm::Expected<std::__1::unique_ptr<llvm::CachedFileStream, std::__1::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::__1::function<llvm::Expected<std::__1::function<llvm::Expected<std::__1::unique_ptr<llvm::CachedFileStream, std::__1::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17+libcxx.so+0x5814fc9)
 #6 0x00007f5b17b8b7d5 lld::elf::BitcodeCompiler::compile() (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+libcxx+0x18b7d5)
 #7 0x00007f5b17affeb4 lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+libcxx+0xffeb4)
 #8 0x00007f5b17af0a95 lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+libcxx+0xf0a95)
 #9 0x00007f5b17aeeee9 lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+libcxx+0xeeee9)
#10 0x00007f5b17d1a29f lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/usr/lib/llvm/17/bin/../lib64/liblldCommon.so.17+libcxx+0xf29f)
#11 0x00005573a251be87 lld_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm/17/bin/ld.lld+0x3e87)
#12 0x00005573a251c772 main (/usr/lib/llvm/17/bin/ld.lld+0x4772)
#13 0x00007f5b0f715eec (/usr/lib64/libc.so.6+0x23eec)
#14 0x00007f5b0f715fa5 __libc_start_main (/usr/lib64/libc.so.6+0x23fa5)
#15 0x00005573a251bc61 _start (/usr/lib/llvm/17/bin/ld.lld+0x3c61)
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: linker command failed due to signal (use -v to see invocation)
Comment 1 Denis Strizhkin 2024-01-10 21:15:31 UTC
Created attachment 881879 [details]
emerge --info
Comment 2 Denis Strizhkin 2024-01-10 21:16:06 UTC
Portage 3.0.61 (python 3.11.7-final-0, default/linux/amd64/23.0/llvm/systemd, gcc-13, glibc-2.38-r9, 6.6.10-gentoo-dist x86_64)
=================================================================
System uname: Linux-6.6.10-gentoo-dist-x86_64-AMD_Ryzen_5_5600X_6-Core_Processor-with-glibc2.38
KiB Mem:    32761016 total,    381700 free
KiB Swap:   65521660 total,  64350972 free
Timestamp of repository gentoo: Wed, 10 Jan 2024 18:48:12 +0000
Head commit of repository gentoo: 879a1bf288e3541fd28efc3709581bd9df605b6e

Timestamp of repository guru: Wed, 10 Jan 2024 11:18:31 +0000
Head commit of repository guru: de4adaef2852467b20a6efb72b85c9e9ddd2cfce

sh bash 5.2_p21-r2
ld GNU ld (Gentoo 2.41 p4) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p21-r2::gentoo
dev-lang/perl:             5.38.2-r1::gentoo
dev-lang/python:           3.11.7::gentoo, 3.12.1_p1::gentoo
dev-lang/rust:             1.74.1::gentoo
dev-util/cmake:            3.28.1-r1::gentoo
dev-util/meson:            1.3.1::gentoo
sys-apps/baselayout:       2.14-r1::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          255.2-r1::gentoo
sys-devel/autoconf:        2.13-r8::gentoo, 2.72-r1::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r4::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           17.0.6::gentoo
sys-devel/gcc:             13.2.1_p20231216::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r2::gentoo
sys-devel/lld:             17.0.6::gentoo
sys-devel/llvm:            17.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r9::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    volatile: False

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    volatile: False

local
    location: /var/db/repos/local
    masters: gentoo
    volatile: False

Installed sets: @den4ik-documents, @den4ik-emulation, @den4ik-kde, @den4ik-portage, @den4ik-python, @den4ik-system, @den4ik-user
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
ADDR2LINE="llvm-addr2line"
AR="llvm-ar"
AS="clang -c"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-O3 -pipe -march=native -flto"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CPP="clang-cpp"
CXX="clang++"
CXXFLAGS="-O3 -pipe -march=native -flto"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O3 -pipe -march=native -flto"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O3 -pipe -march=native -flto"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LD="ld.lld"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j6"
NM="llvm-nm"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RANLIB="llvm-ranlib"
READELF="llvm-readelf"
RUSTFLAGS="-C opt-level=3 -C target-cpu=native"
SHELL="/bin/zsh"
STRINGS="llvm-strings"
STRIP="llvm-strip"
USE="acl amd64 bzip2 clang crypt firewalld gdbm iconv ipv6 libtirpc llvm-libunwind lto lzma ncurses nftables nls nptl pam pcre pipewire pulseaudio readline screencast seccomp ssl systemd test-rust udev unicode vulkan wayland xattr zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" QEMU_SOFTMMU_TARGETS="aarch64 x86_64" QEMU_USER_TARGETS="aarch64" RUBY_TARGETS="ruby31" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, SIZE, YACC, YFLAGS
Comment 3 Denis Strizhkin 2024-01-10 21:17:04 UTC
It does compiles with llvm witout lto. Also it compiles with gcc -flto without any problems.
Comment 4 Ionen Wolkens gentoo-dev 2024-01-10 21:56:32 UTC
I can reproduce so can rule out hardware issues. Only with 8.15.1 though, I did test 8.14.5 before with clang+lto and it was fine (still is). Thought it could be triggered by the new USE=highway but disabling changes nothing, so likely something else that triggers a bug in lld.

Anyhow, re-assigning to lld.

For this package I could filter lto when lld is used meanwhile.
Comment 5 Larry the Git Cow gentoo-dev 2024-01-10 22:01:21 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f9d197f5bd533d2643c19ecbd8a16583240bb43

commit 2f9d197f5bd533d2643c19ecbd8a16583240bb43
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2024-01-10 21:58:40 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2024-01-10 21:59:59 +0000

    media-libs/vips: filter-lto when lld is used
    
    wrt bug #921728, remember to revert this when trying to reproduce.
    
    Bug: https://bugs.gentoo.org/921728
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 media-libs/vips/vips-8.15.1.ebuild | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)