Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 791544

Summary: media-libs/dav1d-0.9.0[asm]: multiple undefined references with binutils:2.36 and -flto
Product: Gentoo Linux Reporter: Craig Andrews <candrews>
Component: Current packagesAssignee: Luca Barbato <lu_zero>
Status: RESOLVED FIXED    
Severity: normal CC: candrews, ionen, sam, soap, toolchain, web
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=801172
https://github.com/gentoo/gentoo/pull/22584
https://github.com/gentoo/gentoo/pull/22588
https://github.com/gentoo/gentoo/pull/22621
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 618550    
Attachments: build.log

Description Craig Andrews gentoo-dev 2021-05-22 20:52:25 UTC
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/libdav1d.so.5.1.0.p/ipred16_avx2.obj: warning: relocation against `_dav1d_filter_intra_taps' in read-only section `.text'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/media-libs/dav1d-0.9.0/temp/cc9VV9sy.ltrans0.ltrans.o: in function `check_decode_bool_adapt':
<artificial>:(.text+0x1d3d): undefined reference to `checkasm_stack_clobber'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text+0x1d84): undefined reference to `checkasm_checked_call'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/media-libs/dav1d-0.9.0/temp/cc9VV9sy.ltrans0.ltrans.o: in function `check_decode_bool_equi':
<artificial>:(.text+0x2209): undefined reference to `checkasm_stack_clobber'
Comment 1 Craig Andrews gentoo-dev 2021-05-22 20:52:39 UTC
Created attachment 710358 [details]
build.log
Comment 2 Craig Andrews gentoo-dev 2021-05-22 20:53:01 UTC
$ emerge --info
Portage 3.0.18 (python 3.9.5-final-0, default/linux/amd64/17.1/systemd, gcc-11.1.0, glibc-2.33, 5.12.1-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-5.12.1-gentoo-x86_64-x86_64-Intel-R-_Core-TM-_i5-6500_CPU_@_3.20GHz-with-glibc2.33
KiB Mem:    16074648 total,    242696 free
KiB Swap:    8036348 total,   6353332 free
Timestamp of repository gentoo: Sat, 22 May 2021 19:30:01 +0000
Head commit of repository gentoo: 1a4f789579c89b68d9219dd5a5a1f8fd79fff5b1
sh bash 5.1_p8
ld GNU ld (Gentoo 2.36.1 p3) 2.36.1
ccache version 4.3 [enabled]
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0::gentoo
dev-lang/python:          3.8.10_p1::gentoo, 3.9.5_p1::gentoo, 3.10.0_beta1::gentoo
dev-lang/rust:            1.52.1::gentoo
dev-util/ccache:          4.3::gentoo
dev-util/cmake:           3.20.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7-r2::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.3-r1::gentoo
sys-devel/binutils:       2.36.1-r1::gentoo
sys-devel/gcc:            11.1.0::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.12::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33::gentoo
Repositories:

gentoo
    location: /var/cache/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

flatpak-overlay
    location: /var/lib/layman/flatpak-overlay
    sync-type: laymansync
    sync-uri: https://github.com/fosero/flatpak-overlay.git
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    sync-type: laymansync
    sync-uri: https://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 50

wayland-desktop
    location: /var/lib/layman/wayland-desktop
    sync-type: laymansync
    sync-uri: https://github.com/epsilon-0/wayland-desktop.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA Intel-SDP Oracle-BCLA-JavaSE Oracle-EADLA AMD-GPU-PRO-EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -fuse-linker-plugin -flto -Wl,-flto -ftree-vectorize -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-common"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /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/php/apache2-php8.0/ext-active/ /etc/php/cgi-php8.0/ext-active/ /etc/php/cli-php8.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe -fuse-linker-plugin -flto -Wl,-flto -ftree-vectorize -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-common"
DISTDIR="/var/cache/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=4.5"
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"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance candy ccache cgroup clean-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync mount-sandbox multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -flto -Wl,--hash-style=gnu"
LINGUAS="en"
MAKEOPTS="-j5"
PKGDIR="/var/cache/portage/packages"
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"
USE="X a52 aac aacs acl acpi aiglx alac alsa amd64 amr amrnb amrwb animation apache2 apng argon2 artworkextra asf aspnet2 asyncns authdaemond avahi avi bash-completion bcmath berkdb bitmap-fonts bluetooth bluray bmp bonjour brotli btrfs bzip2 cairo caps cdda cddb cdparanoia cdr celt chm clang cli crypt cryptsetup css cups curl daap dav1d dbus device-mapper dga dhclient dirac divx4linux dlloader dns dnssec dovecot-sasl dpms dri dri3 dts dv dvb dvd dvdr dvdread egl enca encode exif ext4 faac fame fat fbcondecor fbsplash ffmpeg fftw firefox flac fontconfig foomaticdb fortran freetype ftp fuse gaim gd gdbm geoip gif gimpprint glamor gles gles1 gles2 glib glibc-omitfp glitz glut gost gphoto2 graphite gsm gstreamer gstreamer10 gtk gtk2 gudev hardenedphp hbci howl howl-compat http2 https hwdb iconv icu idn imagemagick imap imlib innodb ipv6 java java5 javafx jbig jce joystick jpeg jpeg2k junit kdbus kdehiddenvisibility kvm lapack lcms libfame libglvnd libkms libnotify librtmp libtirpc libusb live llvm lm_sensors lvm lz4 lzma lzo mad maildir mdadm mdnsresponder-compat metalink mjpeg mmap mms mng motif mozilla mozsvg mp3 mpeg mpeg2 mplayer mpx multilib musepack mysql mythtv natspec ncurses nemesi network networkmanager nls nptl nptlonly ntfs nvme ocl-icd offensive ofx ogg oggvorbis openal opencl openexr opengl openmp openvg opus pam pango pcre pcre16 pcre32 pcsc-lite pdf pdflib perl pgo phonon pic pie png pnp policykit ppd ppds pulseaudio python quicktime quvi rar readline rtc rtmp schroedinger screensaver sctp sdl seccomp session sftp sharedmem shout smp sna sni sox speex spell split-usr sqlite srt ssh ssl steamruntime suspend2 svg systemd theora threads tiff tls transcode truetype truetype-fonts type-fonts udev udisks unicode unzip upnp ups usb user-session uxa v4l2 vaapi vcd videos virgl vorbis vpx vulkan wayland webdav webp webservices wifi win32codecs wmf wv x264 x265 xanim xattr xcb xcomposite xdg xinerama xml xml2 xpm xprint xrandr xv xvfb xvid xvmc zeroconf zip zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel" APACHE2_MODULES="actions alias auth_basic authn_core authz_core authn_socache cache_disk authn_alias authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex brotli cache dav dav_fs dav_lock dconf deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation remoteip rewrite setenvif speling status unique_id userdir usertrack vhost_alias auth_digest proxy proxy_ajp proxy_connect proxy_http proxy_fcgi reqtimeout cgi cgid unixd socache_shmcb proxy_html xml2enc" APACHE2_MPMS="event" 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 sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="openssl" 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" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="libinput evdev joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="userspace" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" NGINX_MODULES_HTTP="access auth_basic autoindex brotli browser charset empty_gif fastcgi geo grpc gunzip gzip limit_conn limit_req map memcached mirror proxy referer rewrite scgi split_clients ssi upstream_hash upstream_ip_hash upstream_keepalive upstream_least_conn upstream_zone userid uwsgi" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-0" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8 python3_9" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="intel i965 iris amdgpu radeon radeonsi" 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:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 3 Ionen Wolkens gentoo-dev 2021-05-22 21:52:29 UTC
There's a few factors here, but seems binutils:2.36 is what broke it.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2021-05-24 22:13:46 UTC
Fun fact: '-flto -g1' works for me, -flto -g0' does not. Looks like a bug in sybdol emission/collection (possibly in gcc).
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2021-05-24 22:38:20 UTC
Ah, no. -flto tricks meson to mis-detect need for symbol prefixing on linux (-g1 is correct):

$ diff -u dav1d-0.9.0_g{0,1}/work/dav1d-0.9.0-abi_x86_64.amd64/config.h
--- dav1d-0.9.0_g0/work/dav1d-0.9.0-abi_x86_64.amd64/config.h   2021-05-24 23:12:15.887718898 +0100
+++ dav1d-0.9.0_g1/work/dav1d-0.9.0-abi_x86_64.amd64/config.h   2021-05-24 23:12:53.625673332 +0100
@@ -37,7 +37,5 @@

 #define HAVE_UNISTD_H 1

-#define PREFIX 1
-
 #define STACK_ALIGNMENT 32

The detection comes from meson.build directly:

  if cc.symbols_have_underscore_prefix()
    cdata.set10('PREFIX', true)
    cdata_asm.set10('PREFIX', true)
  endif

https://mesonbuild.com/Release-notes-for-0-37-0.html#new-compiler-function-symbols_have_underscore_prefix

My guess is that meson does not handle -flto case: it's defined at https://github.com/mesonbuild/meson/blob/master/mesonbuild/compilers/mixins/clike.py#L922 as a grep over an ELF(?) file for prefixed symbol.

Note: meson searches for first underscored or non-underscored entry.

My guess is that it effectively greps for zlib/zstd dictionary contents of LTO gimple bytecode and finds whatever it wants. While -g1 also inserts debug symbols not directly related to exported symbols.

Not a very robust way of inspecting generated symbols.

A few workarounds would be:
1. workaround the heuristic and hard code lack of prefix on linux
2. use -flto-fat-objects if -flto is enabled (a bit tricky to decide when it's neded)
3. Use -fno-lto either in that particular meson test or project-wide
Comment 6 INODE64 Sistemas 2021-10-15 07:10:46 UTC
Create fix in https://github.com/gentoo/gentoo/pull/22584
Comment 7 INODE64 Sistemas 2021-10-18 07:05:10 UTC
Sorry, I made a new pull, the previous one was not signed :-(
https://github.com/gentoo/gentoo/pull/22621
Comment 8 INODE64 Sistemas 2021-10-18 07:05:22 UTC
Sorry, I made a new pull, the previous one was not signed :-(
https://github.com/gentoo/gentoo/pull/22621
Comment 9 Larry the Git Cow gentoo-dev 2021-10-31 03:39:39 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=647a8643d2941d4f20a6cb2b4799fc35bbc26c36

commit 647a8643d2941d4f20a6cb2b4799fc35bbc26c36
Author:     Francisco Javier FĂ©lix <web@inode64.com>
AuthorDate: 2021-10-18 06:57:28 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-10-31 03:39:32 +0000

    media-libs/dav1d: fix build, support xxhash
    
    * Require minimum nasm 2.15.05
    * Disable test by default
    * Fix build, see bug https://code.videolan.org/videolan/dav1d/-/issues/370 and
    patch https://code.videolan.org/videolan/dav1d/-/commit/c6a08b3aa1ee99dade53e5e32033bc1d14455a22
    the same problem with versions of gcc 10.3.0 and gcc 11.2.0, from dav1d 0.8.2 to 0.9.2.
    
    Closes: https://bugs.gentoo.org/738726
    Closes: https://bugs.gentoo.org/791544
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: INODE64 <ffelix@inode64.com>
    Closes: https://github.com/gentoo/gentoo/pull/22621
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/dav1d/dav1d-0.8.2.ebuild                | 12 ++++++--
 media-libs/dav1d/dav1d-0.9.0.ebuild                | 12 ++++++--
 media-libs/dav1d/dav1d-0.9.1.ebuild                | 12 ++++++--
 media-libs/dav1d/dav1d-0.9.2.ebuild                | 12 ++++++--
 media-libs/dav1d/dav1d-9999.ebuild                 | 11 ++++++--
 ...id-meson-s-symbols_have_underscore_prefix.patch | 32 ++++++++++++++++++++++
 media-libs/dav1d/metadata.xml                      |  1 +
 7 files changed, 77 insertions(+), 15 deletions(-)