Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 622036 - sys-devel/binutils-2.28-r2 - glibc fails to build on ARM (error "must write pt-vfork for this machine or get IFUNC support")
Summary: sys-devel/binutils-2.28-r2 - glibc fails to build on ARM (error "must write p...
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/git/?p=binutil...
Whiteboard:
Keywords: PATCH
: 622710 626998 627138 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-17 16:46 UTC by Alexander Tsoy
Modified: 2017-09-13 19:01 UTC (History)
9 users (show)

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


Attachments
glibc-2.23-r3:20170617-154415.log.gz (glibc-2.23-r3:20170617-154415.log.gz,173.67 KB, application/gzip)
2017-06-17 16:48 UTC, Alexander Tsoy
Details
Suggested patch for binutils-2.28 (binutils-gdb.git-4b48e2f6a50e85e5acc316289c4a6af693ad98f0.patch,948 bytes, application/mbox)
2017-07-06 22:05 UTC, John Bowler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Tsoy 2017-06-17 16:46:36 UTC
Stable glibc-2.23-r3 fails to build on ARM after stabilization of binutils-2.28-r2. I haven't tried to build glibc on a real hardware yet, but the following fails for me:
- glibc in a cross-toolchain (cross-armv7a-hardfloat-linux-gnueabi/glibc-2.23-r3), building the entire cross-toolchain from scratch also fails;
- glibc in a chroot with qemu-user-arm.

I'm using gcc-6.3.0, the rest of the toolchain is stable.

$ qlist -ICv cross-arm\*
cross-armv7a-hardfloat-linux-gnueabi/binutils-2.28-r2
cross-armv7a-hardfloat-linux-gnueabi/gcc-6.3.0
cross-armv7a-hardfloat-linux-gnueabi/glibc-2.23-r3
cross-armv7a-hardfloat-linux-gnueabi/linux-headers-4.4


bbb ~ # emerge --info
Portage 2.3.5 (python 3.4.5-final-0, hardened/linux/arm/armv7a, gcc-6.3.0, glibc-2.23-r3, 4.9.32-gentoo armv7l)
=================================================================
System uname: Linux-4.9.32-gentoo-armv7l-AMD_Opteron-tm-_Processor_4332_HE-with-gentoo-2.3
KiB Mem:    32993924 total,   2739664 free
KiB Swap:   16777212 total,  16776988 free
Timestamp of repository gentoo: Sat, 17 Jun 2017 00:45:01 +0000
sh dash 0.5.8.2
ld GNU ld (Gentoo 2.28 p1.2) 2.28
distcc 3.2rc1 armv7a-hardfloat-linux-gnueabi [enabled]
app-shells/bash:          4.3_p48-r1::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.7.2::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.24.2::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.26.1::gentoo, 2.28-r2::gentoo
sys-devel/gcc:            6.3.0::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: webrsync
    sync-uri: http://mirror.yandex.ru/gentoo-distfiles/
    priority: -1000

puleglot
    location: /var/db/repos/puleglot
    sync-type: git
    sync-uri: git://puleglot.ru/gentoo/puleglot-overlay.git
    masters: gentoo
    priority: 900

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

ACCEPT_KEYWORDS="arm"
ACCEPT_LICENSE="* -@EULA"
CBUILD="armv7a-hardfloat-linux-gnueabi"
CFLAGS="-O2 -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -mfloat-abi=hard -pipe"
CHOST="armv7a-hardfloat-linux-gnueabi"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -mfloat-abi=hard -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --binpkg-respect-use=y --ask-enter-invalid"
FCFLAGS="-O2 -pipe -march=armv7-a"
FEATURES="assume-digests binpkg-logs buildpkg compress-build-logs config-protect-if-modified distcc distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe -march=armv7-a"
GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/ ftp://mirror.yandex.ru/gentoo-distfiles/"
LANG="ru_RU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/var/cache/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="acl aio alsa arm armv5te armv6 armv6t2 avahi bash-completion berkdb bzip2 caps cli cracklib crypt cxx dbus dri flac gdbm gpm hardened iconv idn ipv6 lz4 lzma modules mp3 ncurses neon nls nptl ogg openmp pam pax_kernel pcre pic pie pulseaudio readline sasl seccomp session ssl ssp systemd tcpd tls udev unicode urandom vim-syntax vorbis xattr xtpax xz zeroconf 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="kexi words flow plan sheets stage tables krita karbon braindump author" 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" L10N="en ru" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US ru ru_RU" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="exynos fbdev omap dummy v4l" 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
Comment 1 Alexander Tsoy 2017-06-17 16:48:03 UTC
Created attachment 476756 [details]
glibc-2.23-r3:20170617-154415.log.gz

configure fails to detect IFUNC support:
...
checking for assembler and linker STT_GNU_IFUNC support... no
...
Comment 2 Alexander Tsoy 2017-06-17 18:22:32 UTC
The following patch fixed this issue for me:
https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=4b48e2f6a50e85e5acc316289c4a6af693ad98f0;hp=7dba9362c172f1073487536eb137feb2da30b0ff

CC-ing @toolchain
Comment 3 Alexandre Ferreira 2017-06-17 23:29:57 UTC
The patch mentioned works for me too on glibc-2.25-r1
Comment 4 Maciej Piechotka 2017-06-20 20:42:10 UTC
I have same error on 32-on-64 build with glibc-2.24-r3.
Comment 5 Jan-Matthias Braun 2017-06-21 15:29:20 UTC
I can confirm the bug to occur for armv6zk-hardfloat-linux-gnueabi and armv7ve-hardfloat-linux-gnueabi, testing with glibc from 2.25-r1, 2.24-rX, and 2.22-r3 (the latter only on armv7).

The proposed patch worked for me too. Thanks!

Another option was to use gcc 5.4.0, with which I was able to compile cross glibc, too.
Comment 6 tt_1 2017-06-23 07:23:46 UTC
Is this fixed for glibc-2.23-r4?
Comment 7 Mike Gilbert gentoo-dev 2017-06-26 17:08:54 UTC
*** Bug 622710 has been marked as a duplicate of this bug. ***
Comment 8 Mike Gilbert gentoo-dev 2017-06-26 17:16:10 UTC
The referenced binutils patch resolved this for me as well.
Comment 9 Maciej Piechotka 2017-07-04 22:42:56 UTC
(In reply to Maciej Piechotka from comment #4)
> I have same error on 32-on-64 build with glibc-2.24-r3.

Linked patch did not solve the issue for me. Should I fill separate bug?
Comment 10 John Bowler 2017-07-06 17:33:42 UTC
Perhaps the problem is that it is not immediately obvious how to apply the patch.  Firstly this bug report only refers to the crossdev build of glibc.

A normal, hosted, ARM build has no issues; I have unpatched, working, builds with:

armv7a-hardfloat-linux-gnueabi (systemd), glibc-2.24-r3,
armv7a-hardfloat-linux-gnueabi (openrc), glibc-2.24-r4,
armv6j-hardfloat-linux-gnueabi (openrc), glibc-2.24-r4,
    binutils 2.28-r2
    gcc-6.3.0

The problem is with the crossdev build of the cross-binutils which, if not patched, causes the crossdev configure of the new glibc to fail (incorrectly).

The patch itself won't apply to binutils-2.28 because the ChangeLog part fails, so it is necessary to strip that out leaving what just a one-line change.  That patch then has to be put into the crossdev overlay for binutils.  The way I did this was to change the crossdev overlay by hand so that rather than having a symbolic link for binutils which points into the portage tree it points at a binutils in my overlay which contains 'binutils-2.28-r3' with the patch.

It may be that crossdev will find the overlay itself if it is re-run; I didn't try that and I don't know enough about crossdev to know.

It would help if the portage binutils-2.28 was rev'ed to include the patch, then the crossdev build would automatically update binutils on the next emerge --update.  Alternatively if that isn't acceptable to the binutils maintainer maybe a crossdev expert could document the correct way to get the patch from a regular overlay.
Comment 11 Alexander Tsoy 2017-07-06 18:11:22 UTC
(In reply to John Bowler from comment #10)
> maybe a crossdev expert could document the correct way to get the
> patch from a regular overlay.

For armv7a-hardfloat-linux-gnueabi the following should work:

# mkdir -p /etc/portage/patches/cross-armv7a-hardfloat-linux-gnueabi/binutils-2.28/
# curl 'https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=4b48e2f6a50e85e5acc316289c4a6af693ad98f0;hp=7dba9362c172f1073487536eb137feb2da30b0ff' > /etc/portage/patches/cross-armv7a-hardfloat-linux-gnueabi/binutils-2.28/ifunc-test-fix.patch

then remove the Changelog chunk from the patch. And then you can build cross tolchain as usual.
Comment 12 John Bowler 2017-07-06 22:01:17 UTC
(In reply to Alexander Tsoy from comment #11)
> For armv7a-hardfloat-linux-gnueabi the following should work:
> 
> # mkdir -p
> /etc/portage/patches/cross-armv7a-hardfloat-linux-gnueabi/binutils-2.28/
> # curl
> 'https://sourceware.org/git/?p=binutils-gdb.git;a=patch;
> h=4b48e2f6a50e85e5acc316289c4a6af693ad98f0;
> hp=7dba9362c172f1073487536eb137feb2da30b0ff' >
> /etc/portage/patches/cross-armv7a-hardfloat-linux-gnueabi/binutils-2.28/
> ifunc-test-fix.patch
> 
> then remove the Changelog chunk from the patch. And then you can build cross
> tolchain as usual.

Plus:

emerge --oneshot cross-armv7a-hardfloat-linux-gnueabi/binutils

Without that binutils won't get updated with the patch because it builds fine without it.

I undid my previous changes and tested that with armv7a and armv6j.  glibc-2.24-r3 cross-built just fine.
Comment 13 John Bowler 2017-07-06 22:05:46 UTC
Created attachment 481484 [details]
Suggested patch for binutils-2.28

This is the same as the original suggested patch but without the "ChangeLog" addition which would otherwise prevent the patch applying to more recent binutils versions.
Comment 14 Matthias Maier gentoo-dev 2017-08-02 00:13:32 UTC
Patch applied in 2.28.1



commit cf5003fe2fc3b45f366d0a3c6fdf834ed9d54321
Author: Matthias Maier <tamiko@gentoo.org>
Date:   Tue Aug 1 19:05:14 2017 -0500

    sys-devel/binutils: version bump to 2.28.1, patchset 1.0
    
    Includes fixes for bugs #622036 #622500 #622886 #624524 #624702
    
    Package-Manager: Portage-2.3.6, Repoman-2.3.3
Comment 15 Philipp Psurek 2017-08-06 16:07:26 UTC
*** Bug 627138 has been marked as a duplicate of this bug. ***
Comment 16 Jory A. Pratt gentoo-dev 2017-08-09 06:14:22 UTC
*** Bug 626998 has been marked as a duplicate of this bug. ***
Comment 17 Andreas K. Hüttel archtester gentoo-dev 2017-09-13 19:01:47 UTC
(In reply to Matthias Maier from comment #14)
> Patch applied in 2.28.1
> 
> 
> 
> commit cf5003fe2fc3b45f366d0a3c6fdf834ed9d54321
> Author: Matthias Maier <tamiko@gentoo.org>
> Date:   Tue Aug 1 19:05:14 2017 -0500
> 
>     sys-devel/binutils: version bump to 2.28.1, patchset 1.0
>     
>     Includes fixes for bugs #622036 #622500 #622886 #624524 #624702
>     
>     Package-Manager: Portage-2.3.6, Repoman-2.3.3

... which is essentially stable now.