When building with gold linker, most of the shared object dependencies are missing and the binary doesn't work as a consequence. with gold: ldd /usr/bin/aria2c linux-vdso.so.1 (0x00007ffdfc7c6000) libaria2.so.0 => /usr/lib64/libaria2.so.0 (0x00007f5866a9c000) libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libstdc++.so.6 (0x00007f58666a4000) libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgcc_s.so.1 (0x00007f586648c000) libc.so.6 => /lib64/libc.so.6 (0x00007f58660f4000) libm.so.6 => /lib64/libm.so.6 (0x00007f5865dfc000) /lib64/ld-linux-x86-64.so.2 (0x00007f5866e44000) trying to run /usr/bin/aria2c: /usr/bin/aria2c: symbol lookup error: /usr/lib64/libaria2.so.0: undefined symbol: nettle_sha1 build with bfd linker: ldd /usr/bin/aria2c linux-vdso.so.1 (0x00007fffadbfe000) libaria2.so.0 => /usr/lib64/libaria2.so.0 (0x00007fabac16c000) libz.so.1 => /lib64/libz.so.1 (0x00007fababf54000) libsqlite3.so.0 => /usr/lib64/libsqlite3.so.0 (0x00007fababc44000) libgnutls.so.30 => /usr/lib64/libgnutls.so.30 (0x00007fabab91c000) libssh2.so.1 => /usr/lib64/libssh2.so.1 (0x00007fabac8c4000) libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libstdc++.so.6 (0x00007fabab524000) libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgcc_s.so.1 (0x00007fabab30c000) libc.so.6 => /lib64/libc.so.6 (0x00007fabaaf74000) libm.so.6 => /lib64/libm.so.6 (0x00007fabaac7c000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fabaaa74000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fabaa854000) libicui18n.so.57 => /usr/lib64/libicui18n.so.57 (0x00007fabaa3dc000) libicuuc.so.57 => /usr/lib64/libicuuc.so.57 (0x00007fabaa02c000) libidn.so.11 => /usr/lib64/libidn.so.11 (0x00007faba9df4000) libtasn1.so.6 => /usr/lib64/libtasn1.so.6 (0x00007faba9bdc000) libnettle.so.6 => /usr/lib64/libnettle.so.6 (0x00007faba999c000) libhogweed.so.4 => /usr/lib64/libhogweed.so.4 (0x00007faba9764000) libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007faba94dc000) libssl.so.39 => /usr/lib64/libssl.so.39 (0x00007faba927c000) libcrypto.so.38 => /usr/lib64/libcrypto.so.38 (0x00007faba8e9c000) /lib64/ld-linux-x86-64.so.2 (0x00007fabac6fc000) libicudata.so.57 => /usr/lib64/libicudata.so.57 (0x00007faba741c000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00007faba7204000) and the binary works as expected Reproducible: Always emerge --info Portage 2.3.0 (python 3.5.1-final-0, default/linux/amd64/13.0, gcc-5.4.0, glibc-2.23-r2, 4.7.0-rc6-00148-gee40fb2 x86_64) ================================================================= System uname: Linux-4.7.0-rc6-00148-gee40fb2-x86_64-AMD_PRO_A10-8700B_R6,_10_Compute_Cores_4C+6G-with-gentoo-2.2 KiB Mem: 3767932 total, 995836 free KiB Swap: 4194304 total, 2273628 free Timestamp of repository gentoo: Fri, 08 Jul 2016 05:30:01 +0000 sh bash 4.3_p46 ld GNU gold (Gentoo 2.25.1 p1.1 2.25.1) 1.11 app-shells/bash: 4.3_p46::gentoo dev-lang/perl: 5.24.0-r1::gentoo dev-lang/python: 2.7.11-r2::gentoo, 3.4.4::gentoo, 3.5.1-r3::gentoo dev-util/cmake: 3.5.2-r1::gentoo dev-util/pkgconfig: 0.29.1::gentoo sys-apps/baselayout: 2.2-r1::gentoo sys-apps/openrc: 0.21.2::gentoo sys-apps/sandbox: 2.10-r2::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69-r2::gentoo sys-devel/automake: 1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo sys-devel/binutils: 2.25.1-r1::gentoo sys-devel/gcc: 4.9.3::gentoo, 5.4.0::gentoo sys-devel/gcc-config: 1.8-r1::gentoo sys-devel/libtool: 2.4.6-r2::gentoo sys-devel/make: 4.2.1::gentoo sys-kernel/linux-headers: 4.6::gentoo (virtual/os-headers) sys-libs/glibc: 2.23-r2::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 qt location: /usr/local/portage/qt masters: gentoo priority: 0 kde location: /usr/local/portage/kde masters: gentoo priority: 1 local location: /usr/local/portage/local masters: gentoo priority: 2 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=bdver4 -ftree-vectorize -fvect-cost-model -pipe" 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/php/apache2-php7.0/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cli-php7.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -march=bdver4 -ftree-vectorize -fvect-cost-model -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=n" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j3 -l4" PKGDIR="/usr/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 aac aacplus acl alsa amd64 amr amrenc berkdb bluetooth bzip2 cairo caps celt chm clang cli cracklib crypt cryptsetup cups cxx d3d9 dbus device-mapper djvu dri dvd ebook egl eps epub evdev exif faac ffmpeg flac fortran gdbm gif glamor gold gpg gphoto2 gpm harfbuzz iconv icu id3tag ipv6 jemalloc jpeg kipi lcms lensfun libinput libkms libressl libsamplerate lm_sensors lz4 lzma lzo mad mmx mmxext mobi modern-top modules mp3 multilib mysql ncurses networkmanager nls nptl ogg openal openexr opengl openmp opus pam pcre pcre16 pdf png pulseaudio python qt5 raw readline schroedinger sdl seccomp session sndfile sox speex sqlite sse sse2 ssl svg system-jsoncpp systemd taglib tcpd theora threads thumbnail tiff truetype udev unicode urandom usb user-session vdpau vhosts vorbis vpx wavpack wayland webp x264 x265 xattr xcb xkb xml xmp xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="canon ricoh ricoh_g3" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="avx avx2 fma3 fma4 mmx mmxext sse sse2 sse3 ssse3 sse4_1 sse4_2 xop" CURL_SSL="libressl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-32 efi-64 pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" L10N="de en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="amdgpu" 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_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Well, it looks to be due to libaria2.so and -Wl,--as-needed. The relevant symbols are used within the shared library, while the libraries are passed when linking the executable. Since they're not used in the executable, as-needed strips them. I'm going to report this upstream.
Created attachment 441248 [details, diff] The patch that fixes the problem Hi! I found this patch that fixes that issue. Now it links correctly.
Since the bug has been closed upstream, could you try the newest version, please?