Skip to content

aarch64-linux bootstrap failure on patchelf: undefined reference to `__aarch64_ldadd4_acq_rel' #246147

@trofi

Description

@trofi

Describe the bug

On staging-next:

$ nix build --no-link -f. --argstr system aarch64-linux patchelf -L
...
patchelf> g++ -Wall -std=c++17 -D_FILE_OFFSET_BITS=64     -g -O2   -o patchelf patchelf.o
patchelf> /nix/store/d963146m8sjym81rn2hkvf1mp4zbj25c-binutils-2.40/bin/ld: patchelf.o: in function `__gnu_cxx::__exchange_and_add(int volatile*, int)':
patchelf> /nix/store/c7qmp1dgqf3hh4fjw74y2k662nmaslcy-xgcc-12.3.0/include/c++/12.3.0/ext/atomicity.h:66: undefined reference to `__aarch64_ldadd4_acq_rel'
patchelf> /nix/store/d963146m8sjym81rn2hkvf1mp4zbj25c-binutils-2.40/bin/ld: /nix/store/c7qmp1dgqf3hh4fjw74y2k662nmaslcy-xgcc-12.3.0/include/c++/12.3.0/ext/atomicity.h:66: undefined reference to `__aarch64_ldadd4_acq_rel'
patchelf> /nix/store/d963146m8sjym81rn2hkvf1mp4zbj25c-binutils-2.40/bin/ld: /nix/store/c7qmp1dgqf3hh4fjw74y2k662nmaslcy-xgcc-12.3.0/include/c++/12.3.0/ext/atomicity.h:66: undefined reference to `__aarch64_ldadd4_acq_rel'
patchelf> /nix/store/d963146m8sjym81rn2hkvf1mp4zbj25c-binutils-2.40/bin/ld: /nix/store/c7qmp1dgqf3hh4fjw74y2k662nmaslcy-xgcc-12.3.0/include/c++/12.3.0/ext/atomicity.h:66: undefined reference to `__aarch64_ldadd4_acq_rel'
patchelf> /nix/store/d963146m8sjym81rn2hkvf1mp4zbj25c-binutils-2.40/bin/ld: patchelf.o: in function `__gnu_cxx::__atomic_add(int volatile*, int)':
patchelf> /nix/store/c7qmp1dgqf3hh4fjw74y2k662nmaslcy-xgcc-12.3.0/include/c++/12.3.0/ext/atomicity.h:71: undefined reference to `__aarch64_ldadd4_acq_rel'
patchelf> /nix/store/d963146m8sjym81rn2hkvf1mp4zbj25c-binutils-2.40/bin/ld: patchelf.o:/nix/store/c7qmp1dgqf3hh4fjw74y2k662nmaslcy-xgcc-12.3.0/include/c++/12.3.0/ext/atomicity.h:71: more undefined references to `__aarch64_ldadd4_acq_rel' follow
patchelf> collect2: error: ld returned 1 exit status
patchelf> make[1]: *** [Makefile:353: patchelf] Error 1

Same failure on hydra: https://hydra.nixos.org/build/229663092

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Bisect was a bit unstable, but with enough --rebuilds it seemingly reliably points to commit 3d66844 gcc: revert "do not install sys-include headers for cross-compilers.".

My speculation: before that change g++-12 probably used libgcc_s.so from g++-8 (bad) and c++/include from g++-8 (bad) and happened to work. Now g++-12 still uses libgcc_s.so from g++-8 (bad) and c++/include from g++-12 (good).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions