Since the last update to the qemu update compiling with the static-user flag and -flto causes the RAM and swap to fill up until the process exits. System has 16GB RAM and 16GB swap and has worked as early as previous build in this setup. This even happens when reducing MAKEOPTS to -j1. I did wonder if using Mold was causing the issue as I found a bug on it on their tracker but disabling Mold has the same effect. Reproducible: Always Steps to Reproduce: 1. enable -flto in make config 2. add static-user flag to qemu 3. emerge -va app-emulation/qemu Actual Results: FAILED: qemu-ppc x86_64-pc-linux-gnu-g++ -m64 -mcx16 -o qemu-ppc libcommon.fa.p/hw_core_cpu-common.c.o libcommon.fa.p/hw_core_machine-smp.c.o libcommon.fa.p/cpus-common.c.o libcommon.fa.p/page-vary-common.c.o libcommon.fa.p/accel_accel-user.c.o libcommon.fa.p/common-user_safe-syscall.S.o libcommon.fa.p/common-user_safe-syscall-error.c.o libqemu-ppc-linux-user.fa.p/linux-user_ppc_signal.c.o libqemu-ppc-linux-user.fa.p/linux-user_ppc_cpu_loop.c.o libqemu-ppc-linux-user.fa.p/target_ppc_cpu-models.c.o libqemu-ppc-linux-user.fa.p/target_ppc_cpu.c.o libqemu-ppc-linux-user.fa.p/target_ppc_cpu_init.c.o libqemu-ppc-linux-user.fa.p/target_ppc_excp_helper.c.o libqemu-ppc-linux-user.fa.p/target_ppc_gdbstub.c.o libqemu-ppc-linux-user.fa.p/target_ppc_helper_regs.c.o libqemu-ppc-linux-user.fa.p/target_ppc_dfp_helper.c.o libqemu-ppc-linux-user.fa.p/target_ppc_fpu_helper.c.o libqemu-ppc-linux-user.fa.p/target_ppc_int_helper.c.o libqemu-ppc-linux-user.fa.p/target_ppc_mem_helper.c.o libqemu-ppc-linux-user.fa.p/target_ppc_misc_helper.c.o libqemu-ppc-linux-user.fa.p/target_ppc_timebase_helper.c.o libqemu-ppc-linux-user.fa.p/target_ppc_translate.c.o libqemu-ppc-linux-user.fa.p/target_ppc_power8-pmu.c.o libqemu-ppc-linux-user.fa.p/libdecnumber_decContext.c.o libqemu-ppc-linux-user.fa.p/libdecnumber_decNumber.c.o libqemu-ppc-linux-user.fa.p/libdecnumber_dpd_decimal128.c.o libqemu-ppc-linux-user.fa.p/libdecnumber_dpd_decimal32.c.o libqemu-ppc-linux-user.fa.p/libdecnumber_dpd_decimal64.c.o libqemu-ppc-linux-user.fa.p/target_ppc_kvm-stub.c.o libqemu-ppc-linux-user.fa.p/target_ppc_user_only_helper.c.o libqemu-ppc-linux-user.fa.p/trace_control-target.c.o libqemu-ppc-linux-user.fa.p/cpu.c.o libqemu-ppc-linux-user.fa.p/disas.c.o libqemu-ppc-linux-user.fa.p/gdbstub.c.o libqemu-ppc-linux-user.fa.p/page-vary.c.o libqemu-ppc-linux-user.fa.p/tcg_optimize.c.o libqemu-ppc-linux-user.fa.p/tcg_region.c.o libqemu-ppc-linux-user.fa.p/tcg_tcg.c.o libqemu-ppc-linux-user.fa.p/tcg_tcg-common.c.o libqemu-ppc-linux-user.fa.p/tcg_tcg-op.c.o libqemu-ppc-linux-user.fa.p/tcg_tcg-op-gvec.c.o libqemu-ppc-linux-user.fa.p/tcg_tcg-op-vec.c.o libqemu-ppc-linux-user.fa.p/fpu_softfloat.c.o libqemu-ppc-linux-user.fa.p/accel_accel-common.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_tcg-all.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_cpu-exec-common.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_cpu-exec.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_tcg-runtime-gvec.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_tcg-runtime.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_translate-all.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_translator.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_user-exec.c.o libqemu-ppc-linux-user.fa.p/accel_tcg_user-exec-stub.c.o libqemu-ppc-linux-user.fa.p/linux-user_elfload.c.o libqemu-ppc-linux-user.fa.p/linux-user_exit.c.o libqemu-ppc-linux-user.fa.p/linux-user_fd-trans.c.o libqemu-ppc-linux-user.fa.p/linux-user_linuxload.c.o libqemu-ppc-linux-user.fa.p/linux-user_main.c.o libqemu-ppc-linux-user.fa.p/linux-user_mmap.c.o libqemu-ppc-linux-user.fa.p/linux-user_signal.c.o libqemu-ppc-linux-user.fa.p/linux-user_strace.c.o libqemu-ppc-linux-user.fa.p/linux-user_syscall.c.o libqemu-ppc-linux-user.fa.p/linux-user_thunk.c.o libqemu-ppc-linux-user.fa.p/linux-user_uaccess.c.o libqemu-ppc-linux-user.fa.p/linux-user_uname.c.o libqemu-ppc-linux-user.fa.p/meson-generated_.._ppc-linux-user-gdbstub-xml.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--whole-archive libhwcore.fa libqom.fa -Wl,--start-group libevent-loop-base.a -Wl,--no-whole-archive -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -static -fstack-protector-strong -march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32 -fuse-ld=mold -Wl,-O1 -Wl,--as-needed libqemuutil.a libhwcore.fa libqom.fa -lrt -lm -pthread -lgthread-2.0 -lglib-2.0 -lpcre2-8 -lstdc++ -Wl,--end-group x86_64-pc-linux-gnu-g++: fatal error: Killed signal terminated program lto1 compilation terminated. lto-wrapper: fatal error: x86_64-pc-linux-gnu-g++ returned 1 exit status Portage 3.0.38.1 (python 3.10.8-final-0, default/linux/amd64/17.1/desktop, gcc-12, glibc-2.36-r5, 5.19.16-gentoo-dist x86_64) ================================================================= System uname: Linux-5.19.16-gentoo-dist-x86_64-Intel-R-_Core-TM-_i7-6700K_CPU_@_4.00GHz-with-glibc2.36 KiB Mem: 16349072 total, 14970904 free KiB Swap: 16777212 total, 15519536 free Head commit of repository gentoo: a162bfe06a77b81a258a80cf4bbb79a5bd577c9b Timestamp of repository steam-overlay: Sat, 26 Nov 2022 21:17:38 +0000 Head commit of repository steam-overlay: 7725952b048be2987eb0a39b2641a03b30df8f44 Timestamp of repository vortex: Sat, 26 Nov 2022 21:17:39 +0000 Head commit of repository vortex: 2aab4102b263f29a928207ce203bea6535fede00 sh bash 5.1_p16-r2 ld GNU ld (Gentoo 2.39 p5) 2.39.0 distcc 3.4 x86_64-pc-linux-gnu [disabled] app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r2::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.36.0-r1::gentoo dev-lang/python: 3.10.8_p3::gentoo, 3.11.0_p2::gentoo, 3.12.0_alpha1_p2::gentoo dev-lang/rust: 1.65.0::gentoo dev-util/cmake: 3.24.3::gentoo dev-util/meson: 0.64.0::gentoo sys-apps/baselayout: 2.9::gentoo sys-apps/openrc: 0.45.2-r1::gentoo sys-apps/sandbox: 2.29::gentoo sys-devel/autoconf: 2.13-r7::gentoo, 2.71-r5::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.39-r4::gentoo sys-devel/binutils-config: 5.4.1::gentoo sys-devel/clang: 14.0.6-r1::gentoo, 15.0.4::gentoo sys-devel/gcc: 12.2.1_p20221008::gentoo sys-devel/gcc-config: 2.8::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/lld: 14.0.6-r1::gentoo, 15.0.4::gentoo sys-devel/llvm: 14.0.6-r2::gentoo, 15.0.4::gentoo sys-devel/make: 4.4::gentoo sys-kernel/linux-headers: 6.0::gentoo (virtual/os-headers) sys-libs/glibc: 2.36-r5::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: https://github.com/gentoo/gentoo.git sync-user: portage:portage priority: -1000 cinnamon location: /var/db/repos/cinnamon masters: gentoo steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/steam-overlay.git masters: gentoo vortex location: /var/db/repos/vortex sync-type: git sync-uri: https://github.com/gentoo-mirror/vortex.git masters: gentoo ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /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 /etc/terminfo" CXXFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY 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="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -flto=8 -fuse-linker-plugin -falign-functions=32" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_GB.utf8" LDFLAGS="-fuse-ld=mold -Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j1" 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="/home/portage" RUSTFLAGS="-C target-cpu=native" SHELL="/bin/bash" USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cli crypt cups d3d9 dbus dist-kernel dri dts dvd dvdr elogind encode evdev exif flac fortran gdbm gif gpm graphite gtk gtk3 gui iconv icu introspection ipv6 jpeg lcms libglvnd libnotify libtirpc lto mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf pgo png policykit ppds pulseaudio readline sdl seccomp spell split-usr ssl startup-notification svg test-rust tiff truetype udev udisks unicode upower usb vaapi vdpau vorbis vulkan vulkan-overlay wxwidgets x264 xattr xcb xinerama xml xv xvid zlib" ABI_X86="64 32" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache 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="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="lininput evdev joystick" KERNEL="linux" L10N="en en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" QEMU_SOFTMMU_TARGETS="ppc ppc64le mips mipsel mips64 x86_64 i386" QEMU_USER_TARGETS="i386 ppc64le ppc ppc64 riscv32 riscv64 x86_64 mips mipsel mips64" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="nvidia intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS
Created attachment 837959 [details] build.log
I doubt we can do anything about this. With static libs, LTO does more because it can glob the whole together. Clang thinlto is likely to work better or not passing =n as you are.
Clang sounds the better solution however I'll test the nthreads idea once my system frees up.
I've now tried multiple settings to limit the threads LTO uses and even forcing it to 1 causes the same error until OoM.
Yeah, it is my perspective that LTO with GCC is good at consuming far more resources than it seems like it should. Not sure we can do anything about that.
I wonder if you can use: append-ldflags -Wl,--no-keep-memory or append-ldflags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads when gcc+bfd(|gold) is detected. Firefox also does static linking and these options should help. https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/firefox/firefox-107.0.1.ebuild#n969 (uhh.. actually why is this only enabled for arm?)
(In reply to Joonas Niilola from comment #6) > I wonder if you can use: > append-ldflags -Wl,--no-keep-memory > > or > append-ldflags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads > > when gcc+bfd(|gold) is detected. Firefox also does static linking and these > options should help. > > https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/firefox/firefox- > 107.0.1.ebuild#n969 > > (uhh.. actually why is this only enabled for arm?) My guess is because it'll use a bit more disk I/O but it's still a very confusing choice -- it'd be better to just do it unconditionally for gcc builds as we know they explode.
(In reply to Joonas Niilola from comment #6) > I wonder if you can use: > append-ldflags -Wl,--no-keep-memory > > or > append-ldflags -Wl,--no-keep-memory -Wl,--reduce-memory-overheads > > when gcc+bfd(|gold) is detected. Firefox also does static linking and these > options should help. > > https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/firefox/firefox- > 107.0.1.ebuild#n969 > > (uhh.. actually why is this only enabled for arm?) I've adding both of these and the same error occurs although it does get quite a bit further before OoM.
heh. I tried on machine with 64GB RAM + 740 GB NVMe swap. without MAKEOPTS="-l1" CXXFLAGS="-flto=1" it creates 3 tasks for ppc, ppc64, ppc64bl. and than consumes roughly the same amount of RAM for each. sorry, but I couldn't wait too long, maybe try later. It consumed after 2 hours roughly 235 GB of "RAM" at some point. It may be not a limit for it. Maybe I'll try set it for a weekends to see if it even possible.