Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 708340 - <sys-devel/binutils-2.34-r1: gc-nm does not report symbol types (was: app-crypt/p11-kit-0.23.20: ./libtool: eval: line 1720: syntax error near unexpected token `|')
Summary: <sys-devel/binutils-2.34-r1: gc-nm does not report symbol types (was: app-cry...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard: wait for binutils-2.34-r1
Keywords:
Depends on:
Blocks: lto 712396 713200 714610
  Show dependency tree
 
Reported: 2020-02-05 13:43 UTC by Craig Andrews
Modified: 2020-09-25 07:56 UTC (History)
9 users (show)

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


Attachments
build.log (build.log,183.93 KB, text/x-log)
2020-02-05 13:44 UTC, Craig Andrews
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Andrews gentoo-dev 2020-02-05 13:43:49 UTC
libtool: link: ( cd ".libs" && rm -f "libtrust-data.la" && ln -s "../libtrust-data.la" "libtrust-data.la" )
/bin/sh ./libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -DP11_DEFAULT_TRUST_PREFIX=DATA_DIR -DP11_SYSTEM_TRUST_PREFIX=SYSCONFDIR  -O2 -march=native -pipe -fuse-linker-plugin -flto -Wl,-flto -ftree-vectorize -ftree-slp-vectorize -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-common                 -Wall -Wstrict-prototypes -Wmissing-declarations                -Wmissing-prototypes -Wnested-externs -Wpointer-arith           -Wdeclaration-after-statement -Wformat=2 -Winit-self            -Waggregate-return -Wno-missing-format-attribute                -fno-strict-aliasing -fno-common -Wmissing-include-dirs -Wundef -no-undefined -module -avoid-version -version-info 3:0:3 -export-symbols-regex 'C_GetFunctionList'  -Wl,-O1 -Wl,--as-needed -flto -Wl,--hash-style=gnu -o p11-kit-trust.la -rpath /usr/lib64/pkcs11 trust/p11_kit_trust_la-builder.lo trust/p11_kit_trust_la-digest.lo trust/p11_kit_trust_la-index.lo trust/p11_kit_trust_la-parser.lo trust/p11_kit_trust_la-persist.lo trust/p11_kit_trust_la-module.lo trust/p11_kit_trust_la-save.lo trust/p11_kit_trust_la-session.lo trust/p11_kit_trust_la-token.lo  trust/p11_kit_trust_la-module-init.lo libtrust-data.la libp11-library.la libp11-common.la -ltasn1   -ldl -lpthread 
libtool: link: /usr/bin/gcc-nm  trust/.libs/p11_kit_trust_la-builder.o trust/.libs/p11_kit_trust_la-digest.o trust/.libs/p11_kit_trust_la-index.o trust/.libs/p11_kit_trust_la-parser.o trust/.libs/p11_kit_trust_la-persist.o trust/.libs/p11_kit_trust_la-module.o trust/.libs/p11_kit_trust_la-save.o trust/.libs/p11_kit_trust_la-session.o trust/.libs/p11_kit_trust_la-token.o trust/.libs/p11_kit_trust_la-module-init.o   ./.libs/libtrust-data.a ./.libs/libp11-library.a ./.libs/libp11-common.a |  | /usr/bin/sed 's/.* //' | sort | uniq > .libs/p11-kit-trust.exp
./libtool: eval: line 1720: syntax error near unexpected token `|'
./libtool: eval: line 1720: `/usr/bin/gcc-nm  trust/.libs/p11_kit_trust_la-builder.o trust/.libs/p11_kit_trust_la-digest.o trust/.libs/p11_kit_trust_la-index.o trust/.libs/p11_kit_trust_la-parser.o trust/.libs/p11_kit_trust_la-persist.o trust/.libs/p11_kit_trust_la-module.o trust/.libs/p11_kit_trust_la-save.o trust/.libs/p11_kit_trust_la-session.o trust/.libs/p11_kit_trust_la-token.o trust/.libs/p11_kit_trust_la-module-init.o   ./.libs/libtrust-data.a ./.libs/libp11-library.a ./.libs/libp11-common.a |  | /usr/bin/sed 's/.* //' | sort | uniq > .libs/p11-kit-trust.exp'
make[2]: *** [Makefile:2855: p11-kit-trust.la] Error 2
make[2]: *** Waiting for unfinished jobs....
libtool: link: /usr/bin/gcc-nm  p11-kit/.libs/client_la-client.o p11-kit/.libs/client_la-client-init.o   ./.libs/libp11-kit-internal.a ./.libs/libp11-common.a ./.libs/libp11-library.a |  | /usr/bin/sed 's/.* //' | sort | uniq > .libs/p11-kit-client.exp
./libtool: eval: line 1720: syntax error near unexpected token `|'
./libtool: eval: line 1720: `/usr/bin/gcc-nm  p11-kit/.libs/client_la-client.o p11-kit/.libs/client_la-client-init.o   ./.libs/libp11-kit-internal.a ./.libs/libp11-common.a ./.libs/libp11-library.a |  | /usr/bin/sed 's/.* //' | sort | uniq > .libs/p11-kit-client.exp'
make[2]: *** [Makefile:2832: p11-kit-client.la] Error 2
libtool: link: x86_64-pc-linux-gnu-gcc -shared  -fPIC -DPIC  p11-kit/.libs/libp11_kit_la-proxy.o p11-kit/.libs/libp11_kit_la-proxy-init.o p11-kit/.libs/libp11_kit_la-rpc-server.o  -Wl,--whole-archive ./.libs/libp11-kit-internal.a ./.libs/libp11-common.a ./.libs/libp11-library.a -Wl,--no-whole-archive  -lffi -ldl -lpthread  -O2 -march=native -fuse-linker-plugin -flto -Wl,-flto -Wl,--version-script=/var/tmp/portage/app-crypt/p11-kit-0.23.20/work/p11-kit-0.23.20/p11-kit/libp11-kit.map -Wl,-O1 -Wl,--as-needed -flto -Wl,--hash-style=gnu   -Wl,-soname -Wl,libp11-kit.so.0 -o .libs/libp11-kit.so.0.3.0
libtool: link: (cd ".libs" && rm -f "libp11-kit.so.0" && ln -s "libp11-kit.so.0.3.0" "libp11-kit.so.0")
libtool: link: (cd ".libs" && rm -f "libp11-kit.so" && ln -s "libp11-kit.so.0.3.0" "libp11-kit.so")
libtool: link: ( cd ".libs" && rm -f "libp11-kit.la" && ln -s "../libp11-kit.la" "libp11-kit.la" )
make[2]: Leaving directory '/var/tmp/portage/app-crypt/p11-kit-0.23.20/work/p11-kit-0.23.20-abi_x86_64.amd64'
make[1]: *** [Makefile:4767: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/app-crypt/p11-kit-0.23.20/work/p11-kit-0.23.20-abi_x86_64.amd64'
make: *** [Makefile:2323: all] Error 2


Reproducible: Always




# emerge --info
Portage 2.3.87 (python 3.8.1-final-0, default/linux/amd64/17.1/systemd, gcc-9.2.0, glibc-2.30-r3, 5.4.0-rc6 x86_64)
=================================================================
System uname: Linux-5.4.0-rc6-x86_64-Intel-R-_Core-TM-_i5-6500_CPU_@_3.20GHz-with-glibc2.4
KiB Mem:    16141608 total,   1585864 free
KiB Swap:   12337144 total,  11757816 free
Timestamp of repository gentoo: Wed, 05 Feb 2020 12:30:01 +0000
Head commit of repository gentoo: ec9d988a9afbe8ef9f6e2e3111786e964ce170ce
sh bash 5.0_p11
ld GNU ld (Gentoo 2.34 p1) 2.34.0
ccache version 3.7.7 [enabled]
app-shells/bash:          5.0_p11::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.17-r1::gentoo, 3.7.6::gentoo, 3.8.1::gentoo
dev-util/ccache:          3.7.7::gentoo
dev-util/cmake:           3.16.3::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.1-r2::gentoo
sys-devel/binutils:       2.34::gentoo
sys-devel/gcc:            9.2.0-r3::gentoo
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.5::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r3::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-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes

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

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 -ftree-slp-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-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe -fuse-linker-plugin -flto -Wl,-flto -ftree-vectorize -ftree-slp-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="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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 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 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 cxx daap 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 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 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 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 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="evdev joystick keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="userspace" 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="php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_7 python3_8" 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 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
Comment 1 Craig Andrews gentoo-dev 2020-02-05 13:44:19 UTC
Created attachment 611770 [details]
build.log
Comment 2 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2020-02-05 14:11:34 UTC
your toolchain looks somehow broken to me (binutils). In the log it is seen you got:

checking for BSD- or MS-compatible name lister (nm)... /usr/bin/gcc-nm

while normally it should be:


checking for BSD- or MS-compatible name lister (nm)... /usr/bin/x86_64-pc-linux-gnu-nm -B

the same for archiver, and ranlib

(yes, I know these are symlinks).

Could you pleaser test against stable binutils?
Comment 3 Craig Andrews gentoo-dev 2020-02-05 14:19:33 UTC
I'm using ~amd64 binutils:
[ebuild   R    ] sys-devel/binutils-2.34:2.34::gentoo  USE="gold nls plugins -default-gold -doc -multitarget -static-libs -test"

# ls -la /usr/bin/x86_64-pc-linux-gnu-nm /usr/bin/gcc-nm
lrwxrwxrwx 1 root root 45 Jan 27 07:39 /usr/bin/gcc-nm -> /usr/x86_64-pc-linux-gnu/gcc-bin/9.2.0/gcc-nm
lrwxrwxrwx 1 root root 31 Feb  3 17:15 /usr/bin/x86_64-pc-linux-gnu-nm -> /usr/x86_64-pc-linux-gnu/bin/nm

I'm not having trouble compiling any other packages (as far I'm aware, at least)...

What other info can I provide to help?
Comment 4 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2020-02-05 15:22:29 UTC
@toolchain, any idea?

I do get different configure output using latest binutils than shown in the configure stage.
Comment 5 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2020-02-05 15:40:55 UTC
oh wait, one more guess which also may "work". Could you please disable ccache?
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-05 21:33:18 UTC
gcc-nm is fine to have if make.conf/package.env sets those explicitly. I don't see any details mentioned (what did fail so libtool got confused)? Let's see if I can find anything.

Can you attach config.log meanwhile?
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-05 21:57:28 UTC
The below is enough to trigger the same failure for me:

app-crypt/p11-kit $ CFLAGS="-O2 -flto" LDFLAGS="-Wl,-O1 -Wl,--as-needed -flto -Wl,--hash-style=gnu" ebuild p11-kit-0.23.20.ebuild clean compile
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-05 22:25:34 UTC
Comparing config.log and build.log of 'CFLAGS="-O2 -flto"' and 'CFLAGS="-O2"' we can see the problem:

Good:

configure:6821: checking command to parse /usr/bin/x86_64-pc-linux-gnu-nm -B output from x86_64-pc-linux-gnu-gcc object
configure:6974: x86_64-pc-linux-gnu-gcc -c -O2  conftest.c >&5
configure:6977: $? = 0
configure:6981: /usr/bin/x86_64-pc-linux-gnu-nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | sed '/ __gnu_lto/d' \> conftest.nm
configure:6984: $? = 0
configure:7050: x86_64-pc-linux-gnu-gcc -o conftest -O2  -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu conftest.c conftstm.o >&5
configure:7053: $? = 0
configure:7091: result: ok

Bad:

configure:6821: checking command to parse /usr/bin/x86_64-pc-linux-gnu-nm -B output from x86_64-pc-linux-gnu-gcc object
configure:6974: x86_64-pc-linux-gnu-gcc -c -O2 -flto  conftest.c >&5
configure:6977: $? = 0
configure:6981: /usr/bin/x86_64-pc-linux-gnu-nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | sed '/ __gnu_lto/d' \> conftest.nm
configure:6984: $? = 0
configure:7050: x86_64-pc-linux-gnu-gcc -o conftest -O2 -flto  -Wl,-O1 -Wl,--as-needed -flto -Wl,--hash-style=gnu conftest.c conftstm.o >&5
conftest.c:18:12: error: variable 'nm_test_var' redeclared as function
   18 | extern int nm_test_var();
      |            ^
conftest.c:4:6: note: previously declared here
    4 |    relocations are performed -- see ld's documentation on pseudo-relocs.  */
      |      ^
lto1: fatal error: errors during merging of translation units
compilation terminated.
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-gcc returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/10.0.1/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
configure:7053: $? = 1
configure:6974: x86_64-pc-linux-gnu-gcc -c -O2 -flto  conftest.c >&5
configure:6977: $? = 0
configure:6981: /usr/bin/x86_64-pc-linux-gnu-nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | sed '/ __gnu_lto/d' \> conftest.nm
configure:6984: $? = 0
cannot run sed -n -e 's/^.*[	 ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[	 ][	 ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | sed '/ __gnu_lto/d'
configure:7088: result: failed

This leads to two libtool variables left undefined:

Good:

lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[	 ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[	 ][	 ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'' | sed '\''/ __gnu_lto/d'\'''
lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW][ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\'''

Bad:

lt_cv_sys_global_symbol_pipe=
lt_cv_sys_global_symbol_to_cdecl=

That's why you see '| |' call without contents there: ./configure did not find a working 'nm' tool as configure test is broken.

'nm_test_var' comes from p11-kit-0.23.20/build/m4/libtool.m4's '_LT_CMD_GLOBAL_SYMBOLS' macro. It looks like mostly up-to-date http://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4

You might want to extract minimal test and report it to libtool people.

My guess would be that you need to avoid reuse of 'nm_test_var' as function and variable at the same time in a single object.
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-05 22:46:39 UTC
At a glance libtool test tries to link together the following 2 files and indeed 'nm_test_var' has two conflicting declarations. 

// file 1
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(void);
void nm_test_func(void){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}

// file 2
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
   relocations are performed -- see ld's documentation on pseudo-relocs.  */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data.  */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif

#ifdef __cplusplus
extern "C" {
#endif

extern int nm_test_func();
extern int nm_test_var();

/* The mapping between symbol names and symbols.  */
LT_DLSYM_CONST struct {
  const char *name;
  void       *address;
}
lt__PROGRAM__LTX_preloaded_symbols[] =
{
  { "@PROGRAM@", (void *) 0 },
  {"nm_test_func", (void *) &nm_test_func},
  {"nm_test_var", (void *) &nm_test_var},
  {0, (void *) 0}
};

/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
  return lt__PROGRAM__LTX_preloaded_symbols;
}
#endif

#ifdef __cplusplus
}
#endif
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-05 22:59:17 UTC
Normally libtool known how to distinguish between code and data:

  lt_cv_sys_global_symbol_to_cdecl="sed -n"\
  $lt_cdecl_hook\
  " -e 's/^T .* \(.*\)$/extern int \1();/p'"\
  " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"


Note:
- T is translated to 'extern int foo()'
 - anything else is translated to 'extern char foo;'

It's where -flto -fno-common suddenly has the difference:

$ gcc -c a.c -o a.o -flto && gcc-nm a.o
00000000 T nm_test_func
00000000 C nm_test_var

T/C: ok

$ gcc -c a.c -o a.o && gcc-nm a.o
0000000000000000 T nm_test_func
0000000000000001 C nm_test_var

T/C: ok

$ gcc -c a.c -o a.o -flto && gcc-nm a.o
00000000 T nm_test_func
00000000 C nm_test_var

T/C: ok

$ gcc -c a.c -o a.o -fno-common && gcc-nm a.o
0000000000000000 T nm_test_func
0000000000000000 B nm_test_var

T/B: ok

$ gcc -c a.c -o a.o -fno-common -flto && gcc-nm a.o
00000000 T nm_test_func
00000000 T nm_test_var

T/T: bad

I think it's a gcc-nm bug.
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-05 23:26:26 UTC
Filed upstream https://gcc.gnu.org/PR93609
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-06 09:11:48 UTC
It's a limitation in LTO API between gcc and binutils without a nice short workaround: https://sourceware.org/PR25355. Up to you how you want to handle it.
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-11 22:36:54 UTC
The fix will be in binutils-2.35
Comment 14 Cănărău Constantin 2020-05-08 06:39:43 UTC
With gcc-10 launched and in the portage tree, as lto user, what should I do ?
The back-ported patch to 2.34 does not apply clean, or I am doing something wrong.
For now, I am using binutils-9999, but it is not safe.
Comment 15 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-08 08:55:13 UTC
(In reply to Cănărău Constantin from comment #14)
> With gcc-10 launched and in the portage tree, as lto user, what should I do ?
> The back-ported patch to 2.34 does not apply clean, or I am doing something
> wrong.
> For now, I am using binutils-9999, but it is not safe.

I would say it's expected for system-wide LTO not to work in quite a few corner cases. As well as -O3.

Using binutils-9999 sounds reasonable. We can also package binutils snapshot to get a better baseline for others. Or update binutils-2.34 to rebase against current 2.34 branch. https://gcc.gnu.org/PR93609#c5 notes there are fixes for this issue. I'm not sure how safe it is to use it given that it took a few iterations upstream to get it working.
Comment 16 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-08 18:23:32 UTC
Unkeyworded binutils-2.34-r1 contains all the 2.34 branch fixes including this one: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99fab1f056c44b2f568895262eaebc859319932c

I didn't try it myself. You can try and check if it helps.
Comment 17 Cănărău Constantin 2020-05-08 19:43:38 UTC
I will start a full rebuild tomorrow with binutils-2.34-r1 and report back.
Comment 18 Craig Andrews gentoo-dev 2020-05-08 20:17:36 UTC
I've emerged sys-devel/binutils-2.34-r1.

I've confirmed that curl now emerges successfully, so bug 713200 is fixed.
media-libs/libbluray also emerged, so bug 714610 is fixed too.

I'll emerge a bunch of other random stuff too; if I experience any problems, I'll report back.
Comment 19 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-08 20:35:26 UTC
Woohoo! Thanks for the test everyone!
Comment 20 Cănărău Constantin 2020-05-09 08:33:30 UTC
I did a full system rebuild. No problem regarding binutils encountered, just a few -fno-common issues.

Thank you for your work!
Comment 21 Craig Andrews gentoo-dev 2020-05-10 13:53:31 UTC
(In reply to Sergei Trofimovich from comment #19)
> Woohoo! Thanks for the test everyone!

Is it time to add keywords to binutils-2.34-r1 and make this issue resolved?
Comment 22 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-10 15:27:07 UTC
(In reply to Craig Andrews from comment #21)
> (In reply to Sergei Trofimovich from comment #19)
> > Woohoo! Thanks for the test everyone!
> 
> Is it time to add keywords to binutils-2.34-r1 and make this issue resolved?

dilfridge@ planned to look at the testsuite failures this weekend before rekeywording.
Comment 23 Craig Andrews gentoo-dev 2020-05-18 16:48:16 UTC
(In reply to Sergei Trofimovich from comment #22)
> (In reply to Craig Andrews from comment #21)
> > (In reply to Sergei Trofimovich from comment #19)
> > > Woohoo! Thanks for the test everyone!
> > 
> > Is it time to add keywords to binutils-2.34-r1 and make this issue resolved?
> 
> dilfridge@ planned to look at the testsuite failures this weekend before
> rekeywording.

How's this going?

(I'm really looking forward to this bug being closed :) )
Comment 24 Craig Andrews gentoo-dev 2020-05-24 15:28:10 UTC
What can we do to get keywords added to close this bug?

Thanks again!
Comment 25 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-24 17:05:05 UTC
(In reply to Craig Andrews from comment #24)
> What can we do to get keywords added to close this bug?
> 
> Thanks again!

I believe it was already added in https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-devel/binutils/binutils-2.34-r1.ebuild?id=f57c6e8fd308d3a395848737c49d7619d4936438