Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 683074 - cross-aarch64-unknown-linux-gnu/glibc-2.29-r2 - /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: .../work/build-arm64-aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: error adding symbols: file in wrong format
Summary: cross-aarch64-unknown-linux-gnu/glibc-2.29-r2 - /usr/libexec/gcc/aarch64-unkn...
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:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-11 04:53 UTC by hanetzer
Modified: 2019-04-19 07:35 UTC (History)
1 user (show)

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


Attachments
build.log.gz (build.log.gz,255.66 KB, application/gzip)
2019-04-11 04:54 UTC, hanetzer
Details
emerge --info output (file_683074.txt,5.17 KB, text/plain)
2019-04-18 06:40 UTC, rhn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hanetzer 2019-04-11 04:53:23 UTC
Seems to get almost all the way to the end but fails at link time.
Running file against the offending file shows it to be a 'ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped' so something is
definitely going wrong here.

I've passed --lenv 'CFLAGS="-O2 -pipe"\nCXXFLAGS="-O2 -pipe"' to crossdev
in order to filter out my -march=znver1 from host's make.conf

> /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /tmp/portage/cross-aarch64-unknown-linux-gnu/glibc-2.29-r2/work/build-arm64
-aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: Relocations in generic ELF (EM: 62)
> /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /tmp/portage/cross-aarch64-unknown-linux-gnu/glibc-2.29-r2/work/build-arm64
-aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: Relocations in generic ELF (EM: 62)
> /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /tmp/portage/cross-aarch64-unknown-linux-gnu/glibc-2.29-r2/work/build-arm64
-aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: Relocations in generic ELF (EM: 62)
> /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /tmp/portage/cross-aarch64-unknown-linux-gnu/glibc-2.29-r2/work/build-arm64
-aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: error adding symbols: file in wrong format
Comment 1 hanetzer 2019-04-11 04:54:34 UTC
Created attachment 572436 [details]
build.log.gz
Comment 2 hanetzer 2019-04-11 05:23:44 UTC
Investigating the build.log shows that links-dso-program.o is being
built with x86_64-pc-linux-gnu-g++
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-04-11 09:34:31 UTC
> *       Manual CC:   aarch64-unknown-linux-gnu-gcc  -pipe -O2 -fno-strict-aliasing -Wl,-O1 -Wl,--as-needed
> *      Manual CXX:   x86_64-pc-linux-gnu-g++  -pipe -O2 -fno-strict-aliasing

CC/CXX discrepancy does not look correct. Why CXX points to host compiler?
Please post your 'emerge --info' and 'cat /etc/portage/env/cross-aarch64-unknown-linux-gnu/glibc.conf'
Comment 4 rhn 2019-04-18 06:40:46 UTC
Created attachment 573232 [details]
emerge --info output

As asked on IRC, this is some data when hitting the same issue on crossdev --target arm-linux-gnueabi with a fresh Docker image based on amd64 stage3.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2019-04-18 06:43:08 UTC
Here is my suspiction (unchecked): glibc used not to require c++ during bootstrap and now it does require it.

Gentoo does not enable c++ for gcc for stage1 gcc as it does not work if you don't have libc yet.

Perhaps newer glibc actually started using c++ detection and uses it as:

x86_64-pc-linux-gnu-g++  -pipe -O2 -fno-strict-aliasing links-dso-program.cc -c ...

We should get rid of c++ depend somehow. I'll try to find the change that started the trigger.
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2019-04-18 06:48:12 UTC
Probably added in glibc-2.29 in:
    https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=561b0bec4448f0302cb4915bf67c919bde4a1c57

+ifeq (,$(CXX))
+LINKS_DSO_PROGRAM = links-dso-program-c
+else
+LINKS_DSO_PROGRAM = links-dso-program
+endif

In theory unsetting CXX explicitly during initial bootstrap should be enough.
Comment 7 rhn 2019-04-18 10:31:51 UTC
Building the toolchain using `crossdev -S --target arm-linux-gnueabi --libc '=2.28-r6'` succeeded.
Comment 8 Larry the Git Cow gentoo-dev 2019-04-19 07:35:51 UTC
The bug has been closed via the following commit(s):

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

commit 15fbfc075d699e498d73701b6f2a3f62d7dcabba
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2019-04-19 07:32:12 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2019-04-19 07:35:38 +0000

    sys-libs/glibc: disable c++ detection for cross-case, bug #683074
    
    https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=561b0bec4448f0302cb4915bf67c919bde4a1c57
    in unstream glibc repo added optional dependency on CXX compiler.
    
    Unfortunately ./configure tries hard to pass some g++ as CXX:
    either ${CTARGET}-g++ (ok) or ${CBUILD}+g++ (bad).
    
    During toolchain bootstrap ${CTARGET}-g++ does not yet exist
    as we only have stage1-gcc without c++ (or libc) support.
    
    To restore toolchain bootstrap we force-disable c++ detection
    by setting cache variable:
        libc_cv_cxx_link_ok=no
    
    c++ is force disables only for cross-compilation case
    (CHOST != CTARGET). Cross-building case (CHOST = CTRAGET)
    is unchanged as we should already have c++ capable toolchain
    by then.
    
    Reported-by: hanetzer@startmail.com
    Reported-by: rhn
    Closes: https://bugs.gentoo.org/683074
    Package-Manager: Portage-2.3.63, Repoman-2.3.12
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-libs/glibc/glibc-2.29-r2.ebuild | 11 +++++++++++
 sys-libs/glibc/glibc-9999.ebuild    | 11 +++++++++++
 2 files changed, 22 insertions(+)