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

Bug 644048

Summary: sys-apps/attr-2.4.48: quotes in linker script mishandled by ld.gold & ld.lld
Product: Gentoo Linux Reporter: Chris Smith <chris>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: alex.miller, alexander, althorion, amit.ugol, ansla80, arthur, b.buschinski, che, CoelacanthusHex, const, Dessa, emacsray, esigra, eugene.shalygin, floppym, gwendal, johannes-schmidt, leio, sam, sarnex, steffen, toralf, tsmksubc, unhappy-ending, vapier, vivo75
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.llvm.org/show_bug.cgi?id=51961
https://sourceware.org/bugzilla/show_bug.cgi?id=28385
https://bugs.gentoo.org/show_bug.cgi?id=700116
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 269315, 731004, 915000    
Attachments: attr-2.4.48:20180109-213447.log.gz
attr-2.4.48-r1-build.log
install image
attr build log
attr-2.4.48-use-asm-symver.patch
attr-2.4.48-r4.ebuild
info of latest build
attr-symver.patch

Description Chris Smith 2018-01-09 18:49:07 UTC
sys-apps/attr-2.4.48 appears to be the last thing that successfully installed 
now all packages fail the unpack stage with:

sed: relocation error: /lib64/libacl.so.1: symbol getxattr, version ATTR_1.0 not defined in file libattr.so.1 with link time reference
Comment 1 Chris Smith 2018-01-09 19:18:40 UTC
Changed Importance levels as system is pretty well hosed right now.
Name resolution stopped working.
Comment 2 Jana Saout 2018-01-09 19:33:27 UTC
I ran into this too. The symbol is strangely messed up:

leto:/var/tmp/portage/sys-apps/attr-2.4.48/work/attr-2.4.48-abi_x86_64.amd64/.libs # nm libattr.so.1.1.2448 | grep getxattr
0000000000000000 A fgetxattr@ATTR_1.0
                 U fgetxattr@@GLIBC_2.3
0000000000000000 A getxattr@ATTR_1.0
                 U getxattr@@GLIBC_2.3
0000000000000000 A lgetxattr@ATTR_1.0
                 U lgetxattr@@GLIBC_2.3

Whereas the working one looks like this:
leto:/var/tmp/portage/sys-apps/attr-2.4.47-r2/work/attr-2.4.47-abi_x86_64.amd64/libattr/.libs # nm libattr.so.1.1.0 | grep getxattr
0000000000001740 T fgetxattr
0000000000001780 T getxattr
0000000000001760 T lgetxattr

Note that in 2.4.47 it says "to be moved to glibc".
To me this looks like an attempt to somehow forward the symbols from "getxattr@ATTR_1.0" to "getxattr@@GLIBC_2.3". (the latter indeed exists in libc.so.6), but this isn't working. I donÄt have a wizardry diploma in dynamic linker magic, so... :-/
Comment 3 Richard Freeman gentoo-dev 2018-01-09 20:07:47 UTC
I added a mask until this can be sorted out.
Comment 4 Michael Cook 2018-01-09 20:10:17 UTC
Also ran into issues with attr/xattr.h not existing anymore (stuff worked fine otherwise)
Comment 5 Bernd Buschinski 2018-01-09 20:22:00 UTC
How to recover:

- wget http://packages.gentooexperimental.org/packages/amd64-unstable/sys-apps/attr-2.4.47-r2.tbz2
- busybox tar xpvf attr-2.4.47-r2.tbz2 -C /


What caused the issue?
ld.gold, (after recover) I switched back to ld.bfd, it worked.
Switched back to ld.gold and its broken again.

It seems sys-apps/attr-2.4.48 + ld.gold don't like each other.
Comment 6 Mike Gilbert gentoo-dev 2018-01-09 20:30:12 UTC
*** Bug 644060 has been marked as a duplicate of this bug. ***
Comment 7 Mike Gilbert gentoo-dev 2018-01-09 20:32:01 UTC
*** Bug 644056 has been marked as a duplicate of this bug. ***
Comment 8 Holger Hoffstätte 2018-01-09 21:08:01 UTC
(In reply to Bernd Buschinski from comment #5)

> What caused the issue?
> ld.gold, (after recover) I switched back to ld.bfd, it worked.
> Switched back to ld.gold and its broken again.
> 
> It seems sys-apps/attr-2.4.48 + ld.gold don't like each other.

+1 confirmed; built with -fuse-ld=bfd and the exported symbols are visible.

As it turns out clang + lld causes the same problem. :(
Comment 9 Francesco Riosa 2018-01-09 21:49:09 UTC
Created attachment 514030 [details]
attr-2.4.48:20180109-213447.log.gz

build log, not directly using gold, but lto

# emerge --info sys-apps/attr 
Portage 2.3.13 (python 3.6.3-final-0, features/boot, gcc-7.2.0, glibc-2.25-r9, 4.14.12 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.14.12-x86_64-Intel-R-_Xeon-R-_CPU_E5-2630_v4_@_2.20GHz-with-gentoo-2.4.1
KiB Mem:   131912296 total,  76649356 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 09 Jan 2018 19:45:01 +0000
Head commit of repository gentoo: 91aeea7ad4b07872cdb51d5f74a44a97ac80347a
Timestamp of repository vivovl: Sun, 17 Dec 2017 16:38:06 +0000
Head commit of repository vivovl: d504fed0e3671137e37d7a1fabcf7ec22a1ef511
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.24.3::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.6.3-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            7.2.0-r1::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r9::gentoo
Repositories:

gentoo
    location: /srv/portage/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.de.gentoo.org/gentoo-portage/
    priority: -1000
    sync-rsync-extra-opts:

vivovl
    location: /srv/portage/repos/vivovl
    sync-type: rsync
    sync-uri: rsync://transfer/gentoo-repos/vivovl
    masters: gentoo
    sync-rsync-extra-opts:

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=corei7 -pipe -frecord-gcc-switches -fdiagnostics-color=never"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/mtab /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=corei7 -pipe -frecord-gcc-switches -fdiagnostics-color=never"
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=n --ask-enter-invalid --getbinpkg"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs compress-build-logs compressdebug config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles merge-sync multilib-strict news noinfo parallel-fetch preserve-libs protect-owned sandbox sfperms split-elog split-log splitdebug 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"
LINGUAS="en"
MAKEOPTS="-j8"
PKGDIR="/var/portage/packages"
PORTAGE_COMPRESS="xz"
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="acl acpi amd64 bash-completion berkdb bitmap-fonts bzip2 caps cli cracklib crypt cxx dri gdbm hpn iconv idm ipv6 isdnlog lzma midi mmx modules mudflap ncurses nptl nptlonly openmp pam pcre perl pgo ppds pppd python readline reflection seccomp session snmp spl sqlite sse sse2 sse3 ssl static-libs tcpd threads truetype-fonts type1-fonts udev unicode urandom userlocales vim-syntax vivovl-s01 xattr xorg 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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock 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 efi-32 qemu" INPUT_DEVICES="evdev libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="i965 intel" 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_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

sys-apps/attr-2.4.47-r2::gentoo was built with the following:
USE="(static-libs) (vivovl-s01) (-nls)"
Comment 10 Mike Gilbert gentoo-dev 2018-01-09 22:51:33 UTC
*** Bug 644076 has been marked as a duplicate of this bug. ***
Comment 11 Constantin Baranov 2018-01-09 23:02:52 UTC
+1. Bricks the whole system since libattr is a transitive dependency of many many things.
Comment 12 Larry the Git Cow gentoo-dev 2018-01-10 07:19:08 UTC
The bug has been referenced in the following commit(s):

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

commit 8656e779db776059e1760754844be6ca6ca4942b
Author:     Lars Wendler <polynomial-c@gentoo.org>
AuthorDate: 2018-01-10 07:17:54 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2018-01-10 07:17:54 +0000

    sys-apps/attr: Don't use ld.gold
    
    Bug: https://bugs.gentoo.org/644048
    Package-Manager: Portage-2.3.19, Repoman-2.3.6

 sys-apps/attr/attr-2.4.48.ebuild | 2 ++
 1 file changed, 2 insertions(+)}
Comment 13 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-01-10 07:23:07 UTC
Okay, can someone using ld.gold please check if =sys-appas/attr-2.4.48 now no longer break the system?

Dunno what to do about clang + lld though. Any ideas?
Comment 14 Holger Hoffstätte 2018-01-10 10:14:35 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #13)
> Okay, can someone using ld.gold please check if =sys-appas/attr-2.4.48 now
> no longer break the system?

I synced, unmasked =2.4.48, set binutils-config to ld.gold, updated
and everything is fine. 

There is the remaining difference/problem with headers though, since
xattr.h went missing.

2.4.47>epm -ql attr | sort | grep .h$
/usr/include/attr/attributes.h
/usr/include/attr/error_context.h
/usr/include/attr/libattr.h
/usr/include/attr/xattr.h

2.4.48>epm -ql attr | sort | grep .h$
/usr/include/attr/attributes.h
/usr/include/attr/error_context.h
/usr/include/attr/libattr.h

I tried rebuilding a few dependents of attr (acl, patch, pyxattr),
and patch worked while the others failed with missing attr/xattr.h
errors, so this release seems busted either way.

> Dunno what to do about clang + lld though. Any ideas?

No :(
Comment 15 Mike Gilbert gentoo-dev 2018-01-10 18:00:53 UTC
(In reply to Holger Hoffstätte from comment #14)

Thanks for testing. I have re-opened bug 644060 to track the missing attr/xattr.h issue.
Comment 16 Francesco Riosa 2018-01-10 18:12:41 UTC
my default linker is ld.bfd

 ls -i /usr/x86_64-pc-linux-gnu/binutils-bin/2.29.1/ld*
1340935 /usr/x86_64-pc-linux-gnu/binutils-bin/2.29.1/ld
1340935 /usr/x86_64-pc-linux-gnu/binutils-bin/2.29.1/ld.bfd
1340613 /usr/x86_64-pc-linux-gnu/binutils-bin/2.29.1/ld.gold

When compiled with the following flags:
CFLAGS="-O3 -march=corei7 -pipe -flto=4 -fuse-linker-plugin -fno-fat-lto-objects  -grecord-gcc-switches -frecord-gcc-switches"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1,--sort-common,--hash-style=gnu,--as-needed,-z,now ${CFLAGS}"

the result is the following for 2.4.{47,48}, notice the difference for fgetxattr(), I've not tested the library merged to the system.

==============================================================

objdump -tTrRC /var/tmp/portage/sys-apps/attr-2.4.48/image/lib64/libattr.so.1.1.2448


/var/tmp/portage/sys-apps/attr-2.4.48/image/lib64/libattr.so.1.1.2448:     formato del file elf64-x86-64

SYMBOL TABLE:
nessun simbolo


DYNAMIC SYMBOL TABLE:
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3.4 __strcat_chk
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 free
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 __errno_location
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strncpy
0000000000000000  w   D  *UND*	0000000000000000              _ITM_deregisterTMCloneTable
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   flistxattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 ferror
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 fread
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   fsetxattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   llistxattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   fremovexattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 fclose
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   lgetxattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   listxattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 dcgettext
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strlen
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.4   __stack_chk_fail
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 fnmatch
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strspn
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strcspn
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strndup
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 feof
0000000000000000  w   D  *UND*	0000000000000000              __gmon_start__
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 malloc
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   lsetxattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   fgetxattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 realloc
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3.4 __strcpy_chk
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   removexattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 fopen
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   getxattr
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   setxattr
0000000000000000  w   D  *UND*	0000000000000000              _ITM_registerTMCloneTable
0000000000000000  w   DF *UND*	0000000000000000  GLIBC_2.2.5 __cxa_finalize
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3   lremovexattr
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   lsetxattr
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   setxattr
00000000000014e0 g    DF .text	00000000000002c2  ATTR_1.2    attr_listf
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   removexattr
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   lremovexattr
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   llistxattr
00000000000027f0 g    DF .text	000000000000069b  ATTR_1.1    attr_copy_file
0000000000002e90 g    DF .text	000000000000067e  ATTR_1.1    attr_copy_fd
0000000000001ad0 g    DF .text	000000000000017b  ATTR_1.0    attr_removef
00000000000024b0 g    DF .text	000000000000021b  ATTR_1.0    attr_get
00000000000017b0 g    DF .text	0000000000000311  ATTR_1.2    attr_list
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   flistxattr
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   lgetxattr
0000000000002190 g    DF .text	00000000000001fb  ATTR_1.0    attr_getf
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   fsetxattr
0000000000002390 g    DF .text	0000000000000119  ATTR_1.0    attr_multif
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   getxattr
0000000000001df0 g    DF .text	00000000000001ba  ATTR_1.0    attr_setf
0000000000001fb0 g    DF .text	00000000000001da  ATTR_1.0    attr_set
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   fremovexattr
0000000000000000 g    DO *ABS*	0000000000000000  ATTR_1.0    ATTR_1.0
0000000000000000 g    DO *ABS*	0000000000000000  ATTR_1.1    ATTR_1.1
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   listxattr
0000000000000000 g    DO *ABS*	0000000000000000  ATTR_1.2    ATTR_1.2
0000000000000000 g    DO *ABS*	0000000000000000  ATTR_1.3    ATTR_1.3
00000000000038c0 g    DF .text	0000000000000016  ATTR_1.1    attr_copy_check_permissions
0000000000001c50 g    DF .text	000000000000019b  ATTR_1.0    attr_remove
00000000000026d0 g    DF .text	0000000000000119  ATTR_1.0    attr_multi
0000000000000000 g    D  *ABS*	0000000000000000 (ATTR_1.0)   fgetxattr
0000000000003510 g    DF .text	00000000000003ae  ATTR_1.3    attr_copy_action


DYNAMIC RELOCATION RECORDS
OFFSET           TYPE              VALUE 
0000000000204c70 R_X86_64_RELATIVE  *ABS*+0x00000000000014d0
0000000000204c78 R_X86_64_RELATIVE  *ABS*+0x0000000000001490
0000000000205000 R_X86_64_RELATIVE  *ABS*+0x0000000000205000
0000000000204fc8 R_X86_64_GLOB_DAT  _ITM_deregisterTMCloneTable
0000000000204fd0 R_X86_64_GLOB_DAT  lgetxattr@GLIBC_2.3
0000000000204fd8 R_X86_64_GLOB_DAT  attr_copy_check_permissions@@ATTR_1.1
0000000000204fe0 R_X86_64_GLOB_DAT  __gmon_start__
0000000000204fe8 R_X86_64_GLOB_DAT  getxattr@GLIBC_2.3
0000000000204ff0 R_X86_64_GLOB_DAT  _ITM_registerTMCloneTable
0000000000204ff8 R_X86_64_GLOB_DAT  __cxa_finalize@GLIBC_2.2.5
0000000000204ea8 R_X86_64_JUMP_SLOT  __strcat_chk@GLIBC_2.3.4
0000000000204eb0 R_X86_64_JUMP_SLOT  free@GLIBC_2.2.5
0000000000204eb8 R_X86_64_JUMP_SLOT  __errno_location@GLIBC_2.2.5
0000000000204ec0 R_X86_64_JUMP_SLOT  strncpy@GLIBC_2.2.5
0000000000204ec8 R_X86_64_JUMP_SLOT  attr_getf@@ATTR_1.0
0000000000204ed0 R_X86_64_JUMP_SLOT  flistxattr@GLIBC_2.3
0000000000204ed8 R_X86_64_JUMP_SLOT  ferror@GLIBC_2.2.5
0000000000204ee0 R_X86_64_JUMP_SLOT  fread@GLIBC_2.2.5
0000000000204ee8 R_X86_64_JUMP_SLOT  fsetxattr@GLIBC_2.3
0000000000204ef0 R_X86_64_JUMP_SLOT  llistxattr@GLIBC_2.3
0000000000204ef8 R_X86_64_JUMP_SLOT  fremovexattr@GLIBC_2.3
0000000000204f00 R_X86_64_JUMP_SLOT  fclose@GLIBC_2.2.5
0000000000204f08 R_X86_64_JUMP_SLOT  listxattr@GLIBC_2.3
0000000000204f10 R_X86_64_JUMP_SLOT  attr_set@@ATTR_1.0
0000000000204f18 R_X86_64_JUMP_SLOT  dcgettext@GLIBC_2.2.5
0000000000204f20 R_X86_64_JUMP_SLOT  strlen@GLIBC_2.2.5
0000000000204f28 R_X86_64_JUMP_SLOT  __stack_chk_fail@GLIBC_2.4
0000000000204f30 R_X86_64_JUMP_SLOT  attr_get@@ATTR_1.0
0000000000204f38 R_X86_64_JUMP_SLOT  fnmatch@GLIBC_2.2.5
0000000000204f40 R_X86_64_JUMP_SLOT  strspn@GLIBC_2.2.5
0000000000204f48 R_X86_64_JUMP_SLOT  strcspn@GLIBC_2.2.5
0000000000204f50 R_X86_64_JUMP_SLOT  attr_setf@@ATTR_1.0
0000000000204f58 R_X86_64_JUMP_SLOT  strndup@GLIBC_2.2.5
0000000000204f60 R_X86_64_JUMP_SLOT  feof@GLIBC_2.2.5
0000000000204f68 R_X86_64_JUMP_SLOT  attr_remove@@ATTR_1.0
0000000000204f70 R_X86_64_JUMP_SLOT  malloc@GLIBC_2.2.5
0000000000204f78 R_X86_64_JUMP_SLOT  lsetxattr@GLIBC_2.3
0000000000204f80 R_X86_64_JUMP_SLOT  fgetxattr@GLIBC_2.3
0000000000204f88 R_X86_64_JUMP_SLOT  attr_copy_action@@ATTR_1.3
0000000000204f90 R_X86_64_JUMP_SLOT  realloc@GLIBC_2.2.5
0000000000204f98 R_X86_64_JUMP_SLOT  __strcpy_chk@GLIBC_2.3.4
0000000000204fa0 R_X86_64_JUMP_SLOT  removexattr@GLIBC_2.3
0000000000204fa8 R_X86_64_JUMP_SLOT  fopen@GLIBC_2.2.5
0000000000204fb0 R_X86_64_JUMP_SLOT  setxattr@GLIBC_2.3
0000000000204fb8 R_X86_64_JUMP_SLOT  lremovexattr@GLIBC_2.3
0000000000204fc0 R_X86_64_JUMP_SLOT  attr_removef@@ATTR_1.0


==============================================================

objdump -tTrRC /lib64/libattr.so.1.1.0



/lib64/libattr.so.1.1.0:     formato del file elf64-x86-64

SYMBOL TABLE:
nessun simbolo


DYNAMIC SYMBOL TABLE:
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3.4 __strcat_chk
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 free
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 __errno_location
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strncpy
0000000000000000  w   D  *UND*	0000000000000000              _ITM_deregisterTMCloneTable
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 ferror
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 fread
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 fclose
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 dcgettext
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strlen
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.4   __stack_chk_fail
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 fnmatch
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strspn
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strcspn
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strndup
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 syscall
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 feof
0000000000000000  w   D  *UND*	0000000000000000              __gmon_start__
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 fopen64
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 malloc
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 realloc
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.3.4 __strcpy_chk
0000000000000000  w   D  *UND*	0000000000000000              _ITM_registerTMCloneTable
0000000000000000  w   DF *UND*	0000000000000000  GLIBC_2.2.5 __cxa_finalize
00000000000036b0 g    DF .text	0000000000000024  ATTR_1.0    lsetxattr
0000000000205158 g    D  .data	0000000000000000  Base        _edata
0000000000205158 g    D  .bss	0000000000000000  Base        __bss_start
0000000000003680 g    DF .text	0000000000000024  ATTR_1.0    setxattr
0000000000002130 g    DF .text	00000000000002b2  ATTR_1.2    attr_listf
00000000000037f0 g    DF .text	000000000000001b  ATTR_1.0    lremovexattr
00000000000037d0 g    DF .text	000000000000001b  ATTR_1.0    removexattr
0000000000003790 g    DF .text	0000000000000015  ATTR_1.0    llistxattr
0000000000002c50 g    DF .text	000000000000066b  ATTR_1.1    attr_copy_file
00000000000025f0 g    DF .text	000000000000065e  ATTR_1.1    attr_copy_fd
0000000000001cc0 g    DF .text	000000000000016b  ATTR_1.0    attr_removef
0000000000001450 g    DF .text	00000000000001ba  ATTR_1.0    attr_get
0000000000001e30 g    DF .text	00000000000002f1  ATTR_1.2    attr_list
00000000000037b0 g    DF .text	0000000000000014  ATTR_1.0    flistxattr
0000000000205168 g    D  .bss	0000000000000000  Base        _end
0000000000003730 g    DF .text	0000000000000018  ATTR_1.0    lgetxattr
0000000000001610 g    DF .text	000000000000019a  ATTR_1.0    attr_getf
00000000000036e0 g    DF .text	0000000000000023  ATTR_1.0    fsetxattr
00000000000024f0 g    DF .text	00000000000000f6  ATTR_1.0    attr_multif
000000000000382c g    DF .fini	0000000000000000  Base        _fini
0000000000003710 g    DF .text	0000000000000018  ATTR_1.0    getxattr
00000000000010c8 g    DF .init	0000000000000000  Base        _init
0000000000001980 g    DF .text	00000000000001aa  ATTR_1.0    attr_setf
00000000000017b0 g    DF .text	00000000000001ca  ATTR_1.0    attr_set
0000000000003810 g    DF .text	000000000000001a  ATTR_1.0    fremovexattr
0000000000000000 g    DO *ABS*	0000000000000000  ATTR_1.0    ATTR_1.0
0000000000000000 g    DO *ABS*	0000000000000000  ATTR_1.1    ATTR_1.1
0000000000003770 g    DF .text	0000000000000015  ATTR_1.0    listxattr
0000000000000000 g    DO *ABS*	0000000000000000  ATTR_1.2    ATTR_1.2
00000000000032c0 g    DF .text	0000000000000016  ATTR_1.1    attr_copy_check_permissions
0000000000001b30 g    DF .text	000000000000018b  ATTR_1.0    attr_remove
00000000000023f0 g    DF .text	00000000000000f6  ATTR_1.0    attr_multi
0000000000003750 g    DF .text	0000000000000017  ATTR_1.0    fgetxattr
00000000000032e0 g    DF .text	0000000000000396  Base        attr_copy_action


DYNAMIC RELOCATION RECORDS
OFFSET           TYPE              VALUE 
0000000000204dd8 R_X86_64_RELATIVE  *ABS*+0x0000000000001440
0000000000204de0 R_X86_64_RELATIVE  *ABS*+0x0000000000001400
0000000000205150 R_X86_64_RELATIVE  *ABS*+0x0000000000205150
0000000000204fd8 R_X86_64_GLOB_DAT  _ITM_deregisterTMCloneTable
0000000000204fe0 R_X86_64_GLOB_DAT  attr_copy_check_permissions@@ATTR_1.1
0000000000204fe8 R_X86_64_GLOB_DAT  __gmon_start__
0000000000204ff0 R_X86_64_GLOB_DAT  _ITM_registerTMCloneTable
0000000000204ff8 R_X86_64_GLOB_DAT  __cxa_finalize@GLIBC_2.2.5
0000000000205018 R_X86_64_JUMP_SLOT  lremovexattr@@ATTR_1.0
0000000000205020 R_X86_64_JUMP_SLOT  __strcat_chk@GLIBC_2.3.4
0000000000205028 R_X86_64_JUMP_SLOT  free@GLIBC_2.2.5
0000000000205030 R_X86_64_JUMP_SLOT  __errno_location@GLIBC_2.2.5
0000000000205038 R_X86_64_JUMP_SLOT  strncpy@GLIBC_2.2.5
0000000000205040 R_X86_64_JUMP_SLOT  flistxattr@@ATTR_1.0
0000000000205048 R_X86_64_JUMP_SLOT  getxattr@@ATTR_1.0
0000000000205050 R_X86_64_JUMP_SLOT  setxattr@@ATTR_1.0
0000000000205058 R_X86_64_JUMP_SLOT  attr_getf@@ATTR_1.0
0000000000205060 R_X86_64_JUMP_SLOT  listxattr@@ATTR_1.0
0000000000205068 R_X86_64_JUMP_SLOT  ferror@GLIBC_2.2.5
0000000000205070 R_X86_64_JUMP_SLOT  fread@GLIBC_2.2.5
0000000000205078 R_X86_64_JUMP_SLOT  fsetxattr@@ATTR_1.0
0000000000205080 R_X86_64_JUMP_SLOT  fclose@GLIBC_2.2.5
0000000000205088 R_X86_64_JUMP_SLOT  attr_set@@ATTR_1.0
0000000000205090 R_X86_64_JUMP_SLOT  dcgettext@GLIBC_2.2.5
0000000000205098 R_X86_64_JUMP_SLOT  strlen@GLIBC_2.2.5
00000000002050a0 R_X86_64_JUMP_SLOT  __stack_chk_fail@GLIBC_2.4
00000000002050a8 R_X86_64_JUMP_SLOT  llistxattr@@ATTR_1.0
00000000002050b0 R_X86_64_JUMP_SLOT  attr_get@@ATTR_1.0
00000000002050b8 R_X86_64_JUMP_SLOT  fnmatch@GLIBC_2.2.5
00000000002050c0 R_X86_64_JUMP_SLOT  strspn@GLIBC_2.2.5
00000000002050c8 R_X86_64_JUMP_SLOT  strcspn@GLIBC_2.2.5
00000000002050d0 R_X86_64_JUMP_SLOT  lgetxattr@@ATTR_1.0
00000000002050d8 R_X86_64_JUMP_SLOT  attr_setf@@ATTR_1.0
00000000002050e0 R_X86_64_JUMP_SLOT  strndup@GLIBC_2.2.5
00000000002050e8 R_X86_64_JUMP_SLOT  syscall@GLIBC_2.2.5
00000000002050f0 R_X86_64_JUMP_SLOT  feof@GLIBC_2.2.5
00000000002050f8 R_X86_64_JUMP_SLOT  fopen64@GLIBC_2.2.5
0000000000205100 R_X86_64_JUMP_SLOT  removexattr@@ATTR_1.0
0000000000205108 R_X86_64_JUMP_SLOT  fgetxattr@@ATTR_1.0
0000000000205110 R_X86_64_JUMP_SLOT  attr_remove@@ATTR_1.0
0000000000205118 R_X86_64_JUMP_SLOT  malloc@GLIBC_2.2.5
0000000000205120 R_X86_64_JUMP_SLOT  attr_copy_action@@Base
0000000000205128 R_X86_64_JUMP_SLOT  realloc@GLIBC_2.2.5
0000000000205130 R_X86_64_JUMP_SLOT  __strcpy_chk@GLIBC_2.3.4
0000000000205138 R_X86_64_JUMP_SLOT  lsetxattr@@ATTR_1.0
0000000000205140 R_X86_64_JUMP_SLOT  fremovexattr@@ATTR_1.0
0000000000205148 R_X86_64_JUMP_SLOT  attr_removef@@ATTR_1.0
Comment 17 Steffen Hau 2018-06-19 13:10:10 UTC
After todays emerge -uvDU @world, my systems are all broken because of:

relocation error: /lib64/libacl.so.1: symbol fgetxattr version ATTR_1.0 not defined in file libattr.so.1 with link time reference

These are the flags used to build attr-2.4.48-r1 (grepped from environment file):
declare -x CFLAGS="-march=native -O3 -pipe -flto=5 -fuse-linker-plugin"
declare -x CXXFLAGS="-march=native -O3 -pipe -flto=5 -fuse-linker-plugin -fno-delete-null-pointer-checks -flifetime-dse=1"
declare -x LDFLAGS="-march=native -O3 -pipe -flto=5 -fuse-linker-plugin -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--gc-sections -fuse-ld=bfd"


I had to downgrade to 2.4.27 (with workaround from comment 5) in order to have a usable system. Please let me know what else you need to know.
Comment 18 Jacek Fraczek 2018-06-19 13:49:17 UTC
I'm not able to boot after this update...
Comment 19 SpanKY gentoo-dev 2018-06-19 14:25:17 UTC
please attach your full build logs and what versions of acl/attr you're using

gold is still disabled in attr-2.4.48, and the symbol is still exported in it.

$ readelf -sW /lib64/libattr.so.1 | grep getxattr
 13: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lgetxattr@GLIBC_2.3 (7)
 27: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fgetxattr@GLIBC_2.3 (7)
 33: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getxattr@GLIBC_2.3 (7)
 50: 0000000000003360 0 FUNC GLOBAL DEFAULT  12 lgetxattr@ATTR_1.0
 54: 0000000000003358 0 FUNC GLOBAL DEFAULT  12 getxattr@ATTR_1.0
 66: 0000000000003368 0 FUNC GLOBAL DEFAULT  12 fgetxattr@ATTR_1.0
Comment 20 Holger Hoffstätte 2018-06-19 14:40:59 UTC
(In reply to SpanKY from comment #19)
> gold is still disabled in attr-2.4.48, and the symbol is still exported in
> it.

It also works fine when built regularly (i.e. gcc8, no ricer options). Is there a chance that tc-ld-disable-gold gets overridden by explicit LTO, silently re-enabling ld.gold?
Comment 21 Steffen Hau 2018-06-19 14:44:54 UTC
Created attachment 536334 [details]
attr-2.4.48-r1-build.log
Comment 22 Steffen Hau 2018-06-19 14:46:43 UTC
As mentioned I've downgraded to attr-2.4.47. acl was updated to 2.2.53.
Comment 23 SpanKY gentoo-dev 2018-06-19 14:56:01 UTC
what if you remove all the lto settings from your CFLAGS ?

what does `readelf -sW` show on the libattr files ?
Comment 24 Larry the Git Cow gentoo-dev 2018-06-19 19:09:04 UTC
The bug has been referenced in the following commit(s):

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

commit 8071cfdfab2d1de53bc2963098ac9df0c73a59bd
Author:     Mike Frysinger <vapier@gentoo.org>
AuthorDate: 2018-06-19 19:07:46 +0000
Commit:     Mike Frysinger <vapier@gentoo.org>
CommitDate: 2018-06-19 19:08:35 +0000

    sys-apps/attr: add some symbol sanity checks #644048
    
    Bug: https://bugs.gentoo.org/644048

 sys-apps/attr/attr-2.4.48-r1.ebuild | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
Comment 25 Eugene Shalygin 2018-06-19 20:49:59 UTC
The sanity check did not save me: the package was updated and now
$ readelf -sW /lib/libattr.so.1 | grep getxattr
    13: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.3 (8)
    26: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.3 (8)
    32: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.3 (8)
    44: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS fgetxattr@ATTR_1.0
    55: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS getxattr@ATTR_1.0
    63: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS lgetxattr@ATTR_1.0
/usr/bin/coreutils: relocation error: /lib64/libacl.so.1: symbol getxattr version ATTR_1.0 not defined in file libattr.so.1 with link time reference                        
sed: relocation error: /lib64/libacl.so.1: symbol getxattr version ATTR_1.0 not defined in file libattr.so.1 with link time reference
/usr/bin/coreutils: relocation error: /lib64/libacl.so.1: symbol getxattr version ATTR_1.0 not defined in file libattr.so.1 with link time reference
Comment 26 SpanKY gentoo-dev 2018-06-19 22:02:35 UTC
(In reply to Eugene Shalygin from comment #25)

can you create a binpkg/tarball of the libattr files and attach them here ?
Comment 27 Eugene Shalygin 2018-06-19 22:58:34 UTC
Created attachment 536484 [details]
install image

Sure, please.
Comment 28 Steffen Hau 2018-06-21 07:18:37 UTC
(In reply to SpanKY from comment #23)
> what if you remove all the lto settings from your CFLAGS ?
> 
> what does `readelf -sW` show on the libattr files ?

Without LTO:
readelf -sW ./lib64/libattr.so.1 | grep getxattr
    13: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.3 (8)
    27: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.3 (8)
    32: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.3 (8)
    49: 0000000000000040     0 FUNC    GLOBAL DEFAULT  ABS lgetxattr@ATTR_1.0
    53: 0000000000000030     0 FUNC    GLOBAL DEFAULT  ABS getxattr@ATTR_1.0
    65: 0000000000000050     0 FUNC    GLOBAL DEFAULT  ABS fgetxattr@ATTR_1.0

With LTO:
readelf -sW ./lib64/libattr.so.1 | grep getxattr
    13: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.3 (8)
    26: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.3 (8)
    32: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.3 (8)
    49: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS lgetxattr@ATTR_1.0
    53: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS getxattr@ATTR_1.0
    65: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS fgetxattr@ATTR_1.0
Comment 29 SpanKY gentoo-dev 2018-06-22 19:36:26 UTC
(In reply to Eugene Shalygin from comment #27)

oddly that seems to work for me on my system.  is it still failing on yours ?

(In reply to Steffen Hau from comment #28)

does the runtime fail with & w/out LTO enabled ?
Comment 30 Eugene Shalygin 2018-06-22 20:00:30 UTC
(In reply to SpanKY from comment #29)
> is it still failing on yours ?

I already recompiled sys-apps/acl and can't tell, sorry.
Comment 31 SpanKY gentoo-dev 2018-06-22 20:19:09 UTC
(In reply to Eugene Shalygin from comment #30)

so your system is no longer broken w/attr-2.4.48-r1+ ?
Comment 32 Eugene Shalygin 2018-06-22 20:21:15 UTC
(In reply to SpanKY from comment #31)
> so your system is no longer broken w/attr-2.4.48-r1+ ?

Yes, it works. I was complaining only about the check in the ebuild.
Comment 33 Dominic Jänichen 2018-07-03 10:34:13 UTC
Still a problem, despite the safeguard. Have system-default ld.gold and LTO in make.conf.

Working 2.4.47-r2:

# readelf -sW /lib/libattr.so.1.1.0 | grep getxattr
    33: 00003288    40 FUNC    GLOBAL DEFAULT   11 fgetxattr@@ATTR_1.0
    50: 00003238    40 FUNC    GLOBAL DEFAULT   11 getxattr@@ATTR_1.0
    57: 00003260    40 FUNC    GLOBAL DEFAULT   11 lgetxattr@@ATTR_1.0


Broken 2.4.48-r2:

 # readelf -sW lib/libattr.so.1.1.2448 | grep getxattr
    12: 00000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.4 (6)
    23: 00000000     0 NOTYPE  GLOBAL DEFAULT  ABS getxattr@ATTR_1.0
    31: 00000000     0 NOTYPE  GLOBAL DEFAULT  ABS lgetxattr@ATTR_1.0
    32: 00000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.4 (6)
    57: 00000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.4 (6)
    66: 00000000     0 NOTYPE  GLOBAL DEFAULT  ABS fgetxattr@ATTR_1.0

This did pass the safeguard, breaking the system. Luckily I was onsite.

Will save the tbz2 if needed.
Comment 34 Dominic Jänichen 2018-07-05 09:14:13 UTC
Disabling lto flags results in a library with

# readelf -sW ./lib/libattr.so.1.1.2448 | grep getxattr
    12: 00000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.4 (6)
    23: 000033c0     0 FUNC    GLOBAL DEFAULT   11 getxattr@ATTR_1.0
    31: 000033c4     0 FUNC    GLOBAL DEFAULT   11 lgetxattr@ATTR_1.0
    32: 00000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.4 (6)
    57: 00000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.4 (6)
    66: 000033c8     0 FUNC    GLOBAL DEFAULT   11 fgetxattr@ATTR_1.0

which works fine.
Comment 35 Kevin 2018-07-14 19:42:53 UTC
Created attachment 539574 [details]
attr build log

I cannot build attr with gold either
Comment 36 Steffen Hau 2018-10-21 19:24:03 UTC
I just compiled the 2.4.48-r3 again to check the current state. The issue is still present:

LTO:
readelf -sW lib64/libattr.so.1 | grep getxattr
    13: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.3 (8)
    26: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.3 (8)
    32: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.3 (8)
    49: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS lgetxattr@ATTR_1.0
    53: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS getxattr@ATTR_1.0
    65: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  ABS fgetxattr@ATTR_1.0

NO-LTO:
readelf -sW lib64/libattr.so.1 | grep getxattr
    13: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.3 (8)
    27: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.3 (8)
    32: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.3 (8)
    49: 00000000000000b0     0 FUNC    GLOBAL DEFAULT  ABS lgetxattr@ATTR_1.0
    53: 0000000000000090     0 FUNC    GLOBAL DEFAULT  ABS getxattr@ATTR_1.0
    65: 00000000000000d0     0 FUNC    GLOBAL DEFAULT  ABS fgetxattr@ATTR_1.0



sys-devel/binutils:       2.31.1-r1::gentoo
sys-devel/gcc:            8.2.0-r3::gentoo
sys-kernel/linux-headers: 4.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r6::gentoo
Comment 37 Larry the Git Cow gentoo-dev 2019-11-13 13:23:25 UTC
The bug has been referenced in the following commit(s):

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

commit d63097786533e6391deab70cef3150e59324cb8c
Author:     Lars Wendler <polynomial-c@gentoo.org>
AuthorDate: 2019-11-13 13:23:02 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2019-11-13 13:23:19 +0000

    sys-apps/attr: Filter out -flto* in order to get functional binaries
    
    Bug: https://bugs.gentoo.org/644048
    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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 38 Alexander Miller 2019-11-29 16:47:27 UTC
Created attachment 597912 [details, diff]
attr-2.4.48-use-asm-symver.patch

Here is my attempt to finally fix this issue. In the attached patch I use a more standard approach to set symbol versions for the legacy syscalls. It works for me, but since there are many different flags and linkers that cause issues (-flto, -Wl,--gc-sections, gold, lld, ...) I haven't tested all combinations.
So please test this patch and report whether it works for you. If it fixes all linking issues we can send it upstream.

Note that you have to remove the safeguards from the current ebuild to actually enable a (formerly) problematic toolchain configuration for your test.
Comment 39 Alexander Miller 2019-11-29 16:54:59 UTC
Created attachment 597914 [details]
attr-2.4.48-r4.ebuild

This is a modified ebuild you can use to test the patch from the previous comment. It expects attachment 597912 [details, diff] saved as ${FILESDIR}/attr-2.4.48-use-asm-symver.patch and doesn't filter the problematic flags. (I tried to improve the sanity check for the final library, too.)
Comment 40 gwendal grignou 2020-02-13 02:11:16 UTC
I confirm this patch in https://bugs.gentoo.org/644048#c38 fixes the issue. 
attr-2.4.48-r3 generate an invalid /usr/lib64/libattr.so.1xxx
Comment 41 Larry the Git Cow gentoo-dev 2021-09-24 21:06:58 UTC
The bug has been referenced in the following commit(s):

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

commit 6b27b725d5f53a9c1d95166e08187dda38601512
Author:     Mike Frysinger <vapier@chromium.org>
AuthorDate: 2021-09-25 01:45:03 +0000
Commit:     Mike Frysinger <vapier@gentoo.org>
CommitDate: 2021-09-25 02:05:40 +0000

    sys-apps/attr: force use of bfd all the time #644048
    
    Force use of the bfd linker instead of just disabling gold since lld
    is also buggy when handling quoted symbols in linker scripts.
    
    Bug: https://bugs.gentoo.org/644048
    Signed-off-by: Mike Frysinger <vapier@gentoo.org>

 sys-apps/attr/attr-2.5.1.ebuild | 2 +-
 sys-apps/attr/attr-9999.ebuild  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 42 SpanKY gentoo-dev 2021-09-24 22:57:03 UTC
sent some testcases to gold & lld upstreams
Comment 43 Amit Ugol 2021-11-24 07:46:43 UTC
Created attachment 755794 [details]
info of latest build

Compiled with clang, lld and thin lto with no issue. Forcing bfd would not pass the configure stage as clang did not accept bfd and it would report that the C compiler cannot compile programs.
Comment 44 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-24 08:30:56 UTC
(In reply to Amit Ugol from comment #43)
> Created attachment 755794 [details]
> info of latest build
> 
> Compiled with clang, lld and thin lto with no issue. Forcing bfd would not
> pass the configure stage as clang did not accept bfd and it would report
> that the C compiler cannot compile programs.

We would need to see the build.log and config.log for that.
Comment 45 SpanKY gentoo-dev 2021-11-24 19:53:30 UTC
(In reply to Amit Ugol from comment #43)

the problem was never that people couldn't build the attr package.  the problem is that the attr package is miscompiled and breaks other packages.  so i don't know how you're defining "with no issue".

we've been building attr in CrOS with llvm/clang for a long time, and the latest round of fixes i landed were need to unbreak there.

plus, upstream llvm acknowledged that <=llvm-13 had multiple KI with their linker script parsing, and llvm-14 isn't released yet to retest.
Comment 46 unhappy-ending 2022-01-27 20:33:49 UTC
As of 2.5.1 Clang 13 + LLD 13 + -flto seems to build correctly.

readelf -sW /lib64/libattr.so.1 | grep getxattr
 19: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.3 (7)
 24: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.3 (7)
 26: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.3 (7)
 41: 0000000000005340     0 FUNC    GLOBAL DEFAULT   14 getxattr@ATTR_1.0@ATTR_1.0
 42: 0000000000005320     0 FUNC    GLOBAL DEFAULT   14 getxattr@ATTR_1.0@ATTR_1.0
 52: 0000000000005300     0 FUNC    GLOBAL DEFAULT   14 getxattr@ATTR_1.0@ATTR_1.0

dev-python/pyxattr and sys-apps/acl builds and passes tests fine.

Can we remove the restrictions now?
Comment 47 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-27 20:38:47 UTC
(In reply to unhappy-ending from comment #46)
> As of 2.5.1 Clang 13 + LLD 13 + -flto seems to build correctly.
> 
> readelf -sW /lib64/libattr.so.1 | grep getxattr
>  19: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.3
> (7)
>  24: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.3
> (7)
>  26: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.3
> (7)
>  41: 0000000000005340     0 FUNC    GLOBAL DEFAULT   14
> getxattr@ATTR_1.0@ATTR_1.0
>  42: 0000000000005320     0 FUNC    GLOBAL DEFAULT   14
> getxattr@ATTR_1.0@ATTR_1.0
>  52: 0000000000005300     0 FUNC    GLOBAL DEFAULT   14
> getxattr@ATTR_1.0@ATTR_1.0
> 
> dev-python/pyxattr and sys-apps/acl builds and passes tests fine.
> 
> Can we remove the restrictions now?

I'd prefer to wait until maskray's fixes land in LLVM 14: https://bugs.llvm.org/show_bug.cgi?id=51961#c3.
Comment 48 unhappy-ending 2022-01-27 22:19:12 UTC
Appreciated, I'll follow up in March.
Comment 49 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-24 20:36:57 UTC
I'd appreciate it if the affected people (CC'd) who have commented in this bug in the past could try again with LLVM 14 with the workarounds removed from the ebuild.

Please try building applications which use sys-apps/attr too.
Comment 50 Alexander Miller 2022-06-07 16:18:29 UTC
Ok, a quick status update:

* With lld-14.0.4 I get the same result as with lld-13.0.1: the library has weird symbols with double version suffix (e.g. getxattr@ATTR_1.0@ATTR_1.0) that don't work as intended. So it's still broken with lld.

* By now consumers should have switched to the symbols from glibc. These binaries should still work with a broken library (as only the compat symbols are affected), so in practice you won't notice the breakage any more unless you haven't updated your system in years. (At least I didn't find a single binary on my system that still uses the compat symbols. To test, I had to build a program that deliberately forced the compat symver.)

* I've sent an updated version of my patch to upstream's mailing list (see https://lists.nongnu.org/archive/html/acl-devel/2022-05/msg00000.html) 10 days ago, but didn't get any reaction yet. (The patched library works correctly in any configuration I've tested: gcc/clang, bfd/gold/lld, plain/-flto/--gc-sections)
Comment 51 unhappy-ending 2022-06-08 01:26:49 UTC
(In reply to Alexander Miller from comment #50)
> * With lld-14.0.4 I get the same result as with lld-13.0.1: the library has
> weird symbols with double version suffix (e.g. getxattr@ATTR_1.0@ATTR_1.0)
> that don't work as intended. So it's still broken with lld.

Can confirm, I get the same exact output as with LLD 13.0.1 like my previous post with the double version suffix. I didn't even notice the double suffix previously. Otherwise, like the previous post I made, pyxattr and acl still builds fine and passes tests and no bricked system.
Comment 52 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-17 12:18:38 UTC
(In reply to Alexander Miller from comment #50)
> * I've sent an updated version of my patch to upstream's mailing list (see
> https://lists.nongnu.org/archive/html/acl-devel/2022-05/msg00000.html) 10
> days ago, but didn't get any reaction yet. (The patched library works
> correctly in any configuration I've tested: gcc/clang, bfd/gold/lld,
> plain/-flto/--gc-sections)

Thanks a bunch. Could I ask if you'd mind attaching the patch here (may need some rebasing onto last release)?
Comment 53 Alexander Miller 2022-06-20 12:52:27 UTC
Created attachment 786446 [details, diff]
attr-symver.patch

The updated patch, applies cleanly to v2.5.1 and git master.
(Still heard nothing from upstream.)
Comment 54 Larry the Git Cow gentoo-dev 2022-06-20 15:28:39 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 55 unhappy-ending 2022-06-21 04:29:41 UTC
I know this is resolved but I wanted to report to verify that with LLD 14.0.5 and Clang, Alex's patch fixers the double symbol error.

readelf -sW /lib64/libattr.so.1 | grep getxattr
    21: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fgetxattr@GLIBC_2.3 (7)
    25: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lgetxattr@GLIBC_2.3 (7)
    27: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getxattr@GLIBC_2.3 (7)
    46: 0000000000005380    24 FUNC    GLOBAL DEFAULT   13 getxattr@ATTR_1.0
    56: 00000000000053a0    24 FUNC    GLOBAL DEFAULT   13 lgetxattr@ATTR_1.0
    57: 00000000000053c0    23 FUNC    GLOBAL DEFAULT   13 fgetxattr@ATTR_1.0

Thank you Alex, appreciate your work.
Comment 56 Larry the Git Cow gentoo-dev 2024-01-14 03:51:38 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(-)