Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 657760 - sys-libs/glibc-2.27-r3 doesn't build on ~arm with CFLAGS="-mfpu=neon"
Summary: sys-libs/glibc-2.27-r3 doesn't build on ~arm with CFLAGS="-mfpu=neon"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://sourceware.org/bugzilla/show_...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-10 20:10 UTC by Markus Meier
Modified: 2018-06-26 09:48 UTC (History)
3 users (show)

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


Attachments
sys-libs:glibc-2.27-r3:20180608-192307.log.gz (sys-libs:glibc-2.27-r3:20180608-192307.log.gz,265.52 KB, application/gzip)
2018-06-10 20:10 UTC, Markus Meier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Meier gentoo-dev 2018-06-10 20:10:55 UTC
Created attachment 535600 [details]
sys-libs:glibc-2.27-r3:20180608-192307.log.gz

* Package:    sys-libs/glibc-2.27-r3
 * Repository: gentoo
 * Maintainer: toolchain@gentoo.org
 * USE:        arm elibc_glibc kernel_linux userland_GNU
 * FEATURES:   preserve-libs sandbox test userpriv usersandbox


make[3]: Leaving directory '/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/glibc-2.27/elf'
armv7a-hardfloat-linux-gnueabi-gcc  -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed  -nostdlib -nostartfiles -r -o /mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os '-Wl,-(' /mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/dl-allobjs.os /mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/rtld-libc.a -lgcc '-Wl,-)' \
          -Wl,-Map,/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os.map
armv7a-hardfloat-linux-gnueabi-gcc  -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed  -nostdlib -nostartfiles -shared -o /mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/ld.so.new
              \
          -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,defs -Wl,-z,now  \
          /mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os -Wl,--version-script=/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/ld.map          \
          -Wl,-soname=ld-linux-armhf.so.3                       \
          -Wl,-defsym=_begin=0
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `process_dl_debug':
raise.c:(.text+0x4f0): undefined reference to `memcpy'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `dso_name_valid_for_suid':
raise.c:(.text+0x60c): undefined reference to `memchr'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `_dl_start':
raise.c:(.text+0xc48): undefined reference to `memcpy'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `handle_ld_preload':
raise.c:(.text+0x1124): undefined reference to `memcpy'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `dl_main':
raise.c:(.text+0x1370): undefined reference to `memcpy'
raise.c:(.text+0x2700): undefined reference to `memcpy'
raise.c:(.text+0x3068): undefined reference to `memcpy'
raise.c:(.text+0x3410): undefined reference to `memchr'
raise.c:(.text+0x4068): undefined reference to `memcpy'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `add_name_to_object.isra.4':
raise.c:(.text+0x4e80): undefined reference to `memcpy'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `_dl_map_object_from_fd':
raise.c:(.text+0x5d90): undefined reference to `memcpy'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `open_verify.constprop.7':
raise.c:(.text+0x66d8): undefined reference to `memcpy'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os: In function `open_path':
raise.c:(.text+0x6acc): undefined reference to `memcpy'
/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/librtld.os:raise.c:(.text+0x75b4): more undefined references to `memcpy' follow
/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/7.3.0/../../../../armv7a-hardfloat-linux-gnueabi/bin/ld: /mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/ld.so.new: hidden symbol `memchr' isn't defined
/usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/7.3.0/../../../../armv7a-hardfloat-linux-gnueabi/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:479: /mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl/elf/ld.so] Error 1
make[2]: Leaving directory '/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/glibc-2.27/elf'
make[1]: *** [Makefile:216: elf/subdir_lib] Error 2
make[1]: Leaving directory '/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/glibc-2.27'
make: *** [Makefile:9: all] Error 2
make: Leaving directory '/mnt/distfiles/tmp/portage/sys-libs/glibc-2.27-r3/work/build-arm-armv7a-hardfloat-linux-gnueabi-nptl'
 * ERROR: sys-libs/glibc-2.27-r3::gentoo failed (compile phase):
 *   emake failed
 * 

Portage 2.3.40 (python 2.7.14-final-0, default/linux/arm/13.0/armv7a/desktop, gcc-7.3.0, glibc-2.26-r7, 3.13.6 armv7l)
=================================================================
System uname: Linux-3.13.6-armv7l-ARMv7_Processor_rev_2_-v7l-with-gentoo-2.6
KiB Mem:      505312 total,     33736 free
KiB Swap:    2097148 total,   1907128 free
Timestamp of repository gentoo: Fri, 08 Jun 2018 06:30:01 +0000
Head commit of repository gentoo: 44f87aef074b09e9fc369fcc8a693c2ba8b0b869
sh bash 4.4_p23
ld GNU ld (Gentoo 2.30 p2) 2.30.0
distcc 3.2rc1 armv7a-hardfloat-linux-gnueabi [disabled]
ccache version 3.3.4 [disabled]
app-shells/bash:          4.4_p23::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.14-r2::gentoo, 3.4.6-r1::gentoo, 3.5.5-r1::gentoo
dev-util/ccache:          3.3.4-r1::gentoo
dev-util/cmake:           3.11.2::gentoo
sys-apps/baselayout:      2.6::gentoo
sys-apps/openrc:          0.35.5::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r2::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.28-r2::gentoo, 2.28.1::gentoo, 2.29::gentoo, 2.29.1-r1::gentoo, 2.30-r2::gentoo
sys-devel/gcc:            7.2.0-r1::gentoo, 7.3.0-r3::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.16-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://192.168.1.100/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24

maekke
    location: /home/maekke/git/maekke
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="arm ~arm"
ACCEPT_LICENSE="* -@EULA"
CBUILD="armv7a-hardfloat-linux-gnueabi"
CFLAGS="-O2 -pipe -march=armv7-a -mfpu=neon -mfloat-abi=hard"
CHOST="armv7a-hardfloat-linux-gnueabi"
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-php5.6/ext-active/ /etc/php/apache2-php7.0/ext-active/ /etc/php/apache2-php7.1/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/php/cli-php7.0/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=armv7-a -mfpu=neon -mfloat-abi=hard"
DISTDIR="/mnt/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --jobs=2 --keep-going --backtrack=3"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY 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 -march=armv7-a"
FEATURES="assume-digests binpkg-logs collision-protect compress-build-logs config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict test test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe -march=armv7-a"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j2"
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="/mnt/distfiles/tmp/"
USE="X a52 aac acl acpi alsa arm armv5te armv6 armv6t2 berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam flac fortran gdbm gif glamor gpm gtk iconv ipv6 jpeg lcms ldap libnotify mad mng modules mp3 mp4 mpeg ncurses neon nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt5 readline sdl seccomp spell ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xml xv xvid zlib" 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 plan sheets stage words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp thumb thumb2 v4 v5 v6 v7 vfp" 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" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="ARM" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby21 ruby22 ruby23 ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="fbdev dummy" 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 Sergei Trofimovich (RETIRED) gentoo-dev 2018-06-10 22:19:28 UTC
The link failure when ld is linked. ld should not contain early dependencies on libc (with memcpy) as ld is responsible for loading libc. glibc has a few ways to avoid external memcpy() calls.

To shrink the failure space a bit:

Things that work:
- CFLAGS="-pipe -march=armv7-a -O2"
- CFLAGS="-pipe -march=armv7-a -O2 -mfloat-abi=hard"

Things that fail:
- CFLAGS="-pipe -march=armv7-a -O2 -mfpu=neon"

Only -mfpu=neon seems to affect gcc code generation in a way that triggers gcc to insert memcpy() call. Next step is to check how exactly code generation changes.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2018-06-10 22:50:37 UTC
For some reason string/rtld-memcpy.os is built only for non-neon case.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2018-06-11 10:25:47 UTC
Posted summary and patch to https://sourceware.org/bugzilla/show_bug.cgi?id=23273#c1
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2018-06-12 08:03:23 UTC
The outcome of
    https://sourceware.org/bugzilla/show_bug.cgi?id=23273#c7
is Gentoo needs to make sure ASFLAGS contain at least the same ABI flags of CFLAGS.

Upstream glibc maintainers suggest passing flags to CPPFLAGS as those are used in all ASFLAGS contexts (and in some additionalpreprocessor contests).
Comment 5 Larry the Git Cow gentoo-dev 2018-06-13 20:46:44 UTC
The bug has been closed via the following commit(s):

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

commit 6c3740323094626403ee2e57f4a0c5b1cb4f37bb
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-06-13 20:45:58 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-06-13 20:46:38 +0000

    sys-libs/glibc: fix -mfpu=neon build failure, bug #657760
    
    CFLAGS=-mfpu=neon tricked glibc into not building memcpy()
    implementation. It's caused by the fact that -mfpu=neon
    was passed when building .c files, but was not passed
    when building .S files.
    
    This change passes CFLAGS to CPPFLAGS to apply to .S files.
    
    Reported-by: Markus Meier
    Closes: https://bugs.gentoo.org/657760
    Bug: https://sourceware.org/PR23273
    Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r4.ebuild | 1415 +++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-9999.ebuild    |    6 +
 2 files changed, 1421 insertions(+)
Comment 6 Larry the Git Cow gentoo-dev 2018-06-26 09:48:24 UTC
The bug has been referenced in the following commit(s):

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

commit 3ff56613857700dd0dfe2937539ae13fc3212eb4
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-06-26 07:54:33 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-06-26 09:48:14 +0000

    sys-libs/glibc: pass user's CFLAGS over CC/XX, not CPPFLAGS
    
    Breakage example (before this change):
        # CFLAGS="-O2 -march=core2 -mno-sse4.2" emerge -v1 =glibc-2.27-r4
    
    Here user's CFLAGS were able to override (this bug) glibc's
    CFLAGS additions like:
        sysdeps/i386/i686/multiarch/Makefile:CFLAGS-strspn-c.c += -msse4
    
    'strspn' was built as 'gcc -msse4 -mno-sse4.2' and failed:
        smmintrin.h:631:1: error: inlining failed in call to always_inline
            ‘_mm_cmpistri’: target specific option mismatch
    
    This happens because we passed user's CFLAGS via CPPFLAGS:
       Makerules:COMPILE.c = $(CC) -c $(CFLAGS) $(CPPFLAGS)
    
    To avoid this kind of overrides this change injects user's CFLAGS
    into CC/CXX. Above example will use 'gcc -mno-sse4.2 -msse4' order.
    
    Reported-by: Philipp Psurek
    Bug: https://bugs.gentoo.org/657760
    Closes: https://bugs.gentoo.org/659030
    Package-Manager: Portage-2.3.40, Repoman-2.3.9

 sys-libs/glibc/glibc-2.27-r5.ebuild | 1418 +++++++++++++++++++++++++++++++++++
 sys-libs/glibc/glibc-9999.ebuild    |   16 +-
 2 files changed, 1426 insertions(+), 8 deletions(-)