Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 700116 - sys-apps/attr-2.4.48-r3: broken with -Wl,--gc-sections
Summary: sys-apps/attr-2.4.48-r3: broken with -Wl,--gc-sections
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard: Workaround applied in ebuild: -Wl,--n...
Keywords:
Depends on:
Blocks: systemwide-gold LD-is-lld, systemwide-lld 915000
  Show dependency tree
 
Reported: 2019-11-14 22:05 UTC by Constantin Baranov
Modified: 2024-01-14 03:51 UTC (History)
5 users (show)

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


Attachments
output of emerge --info (file_700116.txt,7.25 KB, text/plain)
2019-11-15 12:59 UTC, Nils Freydank
Details
emerge --info output of an unaffected system. (info.txt,7.52 KB, text/plain)
2019-11-15 13:03 UTC, Christian Schmidt
Details
emerge --info of another unaffected system (emerge-info.log,6.31 KB, text/x-log)
2019-11-15 13:08 UTC, needle
Details
append -Wl,--no-gc-sections to LDFLAGS (attr.patch,348 bytes, text/plain)
2019-11-15 19:57 UTC, Alexander Tsoy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Constantin Baranov 2019-11-14 22:05:10 UTC
Did update the @world yesterday, all fine.
Today the new attr arrives, attempted to upgrade.
The attr package itself merged fine. Next merges failed, because sed, install, cp, etc., all segfault.
It was a challenge to debug in place what exactly is broken... I guess, existing acl library is not compatible with new attr. So, whoever uses acl, trigger a segfault.
In order to repair, I copied old libattr.so over into the root, re-emerged sed  and coreutils with USE="-acl -xattr" (not sure why, but this was required as utils kept failing even after libattr.so was reverted), emerged old attr, and finally re-emerged sed and coreutils with USE="acl xattr".

$ emerge --info
Portage 2.3.76 (python 3.6.9-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-9.2.0, glibc-2.29-r2, 4.19.82-gentoo x86_64)
=================================================================
System uname: Linux-4.19.82-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700K_CPU_@_4.00GHz-with-gentoo-2.6
KiB Mem:    65802732 total,   2554752 free
KiB Swap:   67108860 total,  67077628 free
Timestamp of repository gentoo: Thu, 14 Nov 2019 18:00:01 +0000
Head commit of repository gentoo: a51bb03daa7f2c74449464ce7d7f1d95aef88151
Head commit of repository const: 8f83502fffb65a30c7a1076ae7f3eb6d686459f3

sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.9::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            9.2.0-r2::gentoo
sys-devel/gcc-config:     2.1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo
Repositories:

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

const
    location: /opt/portage
    sync-type: git
    sync-uri: https://github.com/const86/portage.git
    masters: gentoo

local
    location: /usr/local/portage
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -g"
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 /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe -g"
DISTDIR="/data/distfiles"
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 cgroup compressdebug config-protect-if-modified distlocks downgrade-backup ebuild-locks fixlafiles installsources ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync xattr"
FFLAGS="-O2 -march=native -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--gc-sections,--sort-common -g"
MAKEOPTS="-j8 -O"
PKGDIR="/var/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 acl acpi activities alsa amd64 branding bzip2 cairo caps cdda cdr cli colord crypt cups curl cxx dbus declarative djvu dri dts dv dvd dvdr emacs emboss encode exif fam ffmpeg fftw flac fontconfig gif git gmp gnome-keyring gtk hscolour iconv icu idn inotify ipv6 jbig jpeg jpeg2k kde kipi kwallet lame lcms libnotify libtirpc linguas_en linguas_en_US linguas_ru lm-sensors lm_sensors lzma lzo mad matroska mms mng modplug mp3 mp4 mpeg multilib musepack ncurses networkmanager nptl ogg openexr opengl openmp pam pango pch pcntl pcre pdf phonon plasma png policykit ppds pulseaudio qml qt5 raw readline sdl seccomp semantic-desktop slp smp speex spell split-usr sqlite sqlite3 ssl startup-notification svg systemd taglib theora threads tiff timidity truetype udev udisks unicode upnp upower usb v4l vaapi vorbis wavpack webp widgets wmf x264 xattr xcb xcomposite xft xml xmp xpm xscreensaver xulrunner xv xvid zlib" ABI_X86="32 64" ADA_TARGET="gnat_2018" 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="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext mpx 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" KERNEL="linux" L10N="en ru" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="x86_64" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="i965 intel iris" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Nils Freydank 2019-11-15 10:58:55 UTC
I can confirm this. Plenty segfaults from elogind to /usr/bin/install as soon as 2.4.48-r3 is emerged. Downgrading via binpkg to 2.4.47-r2 resolves the problem for me.
Comment 2 Nils Freydank 2019-11-15 12:59:10 UTC
Created attachment 596206 [details]
output of emerge --info

Adding the emerge --info for my system.
Comment 3 Christian Schmidt 2019-11-15 13:02:38 UTC
Just to add this here, no issues with this version emerged a few months ago on two ~amd64 systems. I'll attach the emerge --info output just for comparison with affected systems.
Comment 4 Christian Schmidt 2019-11-15 13:03:20 UTC
Created attachment 596208 [details]
emerge --info output of an unaffected system.
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2019-11-15 13:03:42 UTC
I have tested the upgrade on four different stable systems before I filed the stable request bug.
No clue what's going so badly wrong on your systems :-(
Comment 6 needle 2019-11-15 13:08:13 UTC
Created attachment 596210 [details]
emerge --info of another unaffected system

Added emerge --info of another unaffected system. Maybe it might help nail down the source of the issue.
Comment 7 Alexander Tsoy 2019-11-15 14:16:29 UTC
Both affected systems has "-Wl,--gc-sections" in LDFLAGS.
Comment 8 Alexander Tsoy 2019-11-15 14:29:22 UTC
(In reply to Alexander Tsoy from comment #7)
> Both affected systems has "-Wl,--gc-sections" in LDFLAGS.
So this could be basically the same issue as with LTO and/or gold (bug 644048)
Comment 9 Alexander Tsoy 2019-11-15 19:52:08 UTC
I was able to reproduce this with "-Wl,--gc-sections". It eliminates the text section of libattr_la-syscalls.o. Compiling with "-Wl,--gc-sections,--print-gc-sections" gives the following message:

/bin/bash ./libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -include libattr/libattr.h -O2 -march=bdver2 -mtune=bdver2 -mno-tbm -mno-fma4 -mno-xop -mno-lwp -pipe -fvisibility=hidden -Wl,--version-script,/var/tmp/portage/sys-apps/a
ttr-2.4.48-r3/work/attr-2.4.48/exports -Wl,/var/tmp/portage/sys-apps/attr-2.4.48-r3/work/attr-2.4.48/libattr/libattr.lds -version-info 2:2448:1 -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections,--print-gc-sections -o libattr.la -rpath /usr/lib64 
libattr/libattr_la-attr_copy_action.lo libattr/libattr_la-attr_copy_check.lo libattr/libattr_la-attr_copy_fd.lo libattr/libattr_la-attr_copy_file.lo libattr/libattr_la-libattr.lo libattr/libattr_la-syscalls.lo  
libtool: link: x86_64-pc-linux-gnu-gcc -shared  -fPIC -DPIC  libattr/.libs/libattr_la-attr_copy_action.o libattr/.libs/libattr_la-attr_copy_check.o libattr/.libs/libattr_la-attr_copy_fd.o libattr/.libs/libattr_la-attr_copy_file.o libattr/
.libs/libattr_la-libattr.o libattr/.libs/libattr_la-syscalls.o   -Wl,--as-needed  -O2 -march=bdver2 -mtune=bdver2 -mno-tbm -mno-fma4 -mno-xop -mno-lwp -Wl,--version-script -Wl,/var/tmp/portage/sys-apps/attr-2.4.48-r3/work/attr-2.4.48/expo
rts -Wl,/var/tmp/portage/sys-apps/attr-2.4.48-r3/work/attr-2.4.48/libattr/libattr.lds -Wl,-O1 -Wl,--gc-sections -Wl,--print-gc-sections   -Wl,-soname -Wl,libattr.so.1 -o .libs/libattr.so.1.1.2448
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: removing unused section '.text' in file 'libattr/.libs/libattr_la-syscalls.o'

(In reply to Alexander Tsoy from comment #8)
> (In reply to Alexander Tsoy from comment #7)
> > Both affected systems has "-Wl,--gc-sections" in LDFLAGS.
> So this could be basically the same issue as with LTO and/or gold (bug
> 644048)
No, not the same issue (but probably the same root cause?)
Comment 10 Alexander Tsoy 2019-11-15 19:57:16 UTC
Created attachment 596286 [details]
append -Wl,--no-gc-sections to LDFLAGS
Comment 11 Nils Freydank 2019-11-15 20:55:13 UTC
(In reply to Alexander Tsoy from comment #8)
> (In reply to Alexander Tsoy from comment #7)
> > Both affected systems has "-Wl,--gc-sections" in LDFLAGS.
> So this could be basically the same issue as with LTO and/or gold (bug
> 644048)

You were faster than me: Yes, it is triggered by the gc-sections LDFLAGS.
I tried to bisect the problematic upstream git commit, but had not much
success so far (commit to efa0b1ea982261861d64f6d6d620af83d82b02d3 emerge
broken binaries, commits older die with a reference to the lto bug
"symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048", and some even older commits need major refactoring of the ebuild into historical states.

Do you see the cause inside upstreams code?
Comment 12 Alexander Tsoy 2019-11-15 21:29:52 UTC
(In reply to Nils Freydank from comment #11)
> Do you see the cause inside upstreams code?
I didn't verify, but I guess the following sequence of commits caused this bug:
http://git.savannah.nongnu.org/cgit/attr.git/commit/?id=7921157890d07858d092f4003ca4c6bae9fd2c38
http://git.savannah.nongnu.org/cgit/attr.git/commit/?id=efa0b1ea982261861d64f6d6d620af83d82b02d3
Comment 13 Larry the Git Cow gentoo-dev 2019-11-15 23:08:37 UTC
The bug has been referenced in the following commit(s):

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

commit ea36cc2c63ab6c06e1851dc44189e64109e1717d
Author:     Alexander Tsoy <alexander@tsoy.me>
AuthorDate: 2019-11-15 23:07:54 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2019-11-15 23:08:30 +0000

    sys-apps/attr: Add --no-gc-sections to linker flags
    
    Bug: https://bugs.gentoo.org/700116
    Package-Manager: Portage-2.3.79, Repoman-2.3.18
    Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>

 sys-apps/attr/attr-2.4.48-r3.ebuild | 1 +
 1 file changed, 1 insertion(+)
Comment 14 Alexander Miller 2019-11-29 17:01:16 UTC
See bug 644048 comment 38 for a patch that may fix this issue. Please test it and report your success there.
Comment 15 Larry the Git Cow gentoo-dev 2022-06-20 15:28:40 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89b02b4b145ab489734ebcee4d111657473ba560

commit 89b02b4b145ab489734ebcee4d111657473ba560
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-06-20 15:25:35 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-20 15:28:28 +0000

    sys-apps/attr: update EAPI 7 -> 8; use real symbol versioning (fix lld, etc)
    
    This should finally let us fix compatibility with LLD and.. pretty much
    anything other than gcc + bfd + -fno-lto (and even then it wasn't
    technically correct).
    
    Big thanks to Alexander Miller for sorting it out.
    
    Closes: https://bugs.gentoo.org/644048
    Closes: https://bugs.gentoo.org/700116
    Thanks-to: Alexander Miller <alex.miller@gmx.de>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/attr/attr-2.5.1-r1.ebuild              | 109 +++++++++++++++
 sys-apps/attr/attr-9999.ebuild                  |  44 +++---
 sys-apps/attr/files/attr-2.5.1-fix-symver.patch | 173 ++++++++++++++++++++++++
 3 files changed, 308 insertions(+), 18 deletions(-)
Comment 16 Larry the Git Cow gentoo-dev 2024-01-14 03:51:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7db24f070e4b6c04631eebc311098b5b6fd62911

commit 7db24f070e4b6c04631eebc311098b5b6fd62911
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-01-14 03:48:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-01-14 03:51:01 +0000

    sys-apps/attr: add 2.5.2
    
    Thanks vapier!
    
    Bug: https://bugs.gentoo.org/644048
    Bug: https://bugs.gentoo.org/700116
    Closes: https://bugs.gentoo.org/644058
    Closes: https://bugs.gentoo.org/790581
    Closes: https://bugs.gentoo.org/912735
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/attr/Manifest          |  1 +
 sys-apps/attr/attr-2.5.2.ebuild | 73 +++++++++++++++++++++++++++++++++++++++++
 sys-apps/attr/attr-9999.ebuild  | 32 +++---------------
 3 files changed, 78 insertions(+), 28 deletions(-)