Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.init.data has both ordered and unordered sections #1507

Closed
nathanchance opened this issue Nov 17, 2021 · 10 comments
Closed

.init.data has both ordered and unordered sections #1507

nathanchance opened this issue Nov 17, 2021 · 10 comments
Assignees
Labels
[ARCH] arm64 This bug impacts ARCH=arm64 [FIXED][LINUX] 5.18 This bug was fixed in Linux 5.18 GNU Binutils Interop non-LLVM=1 usage

Comments

@nathanchance
Copy link
Member

@roxell reported on IRC:

$ make -skj"$(nproc)" ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-gnu- distclean defconfig

$ scripts/config -e FTRACE  -e STACK_TRACER

$ make -skj"$(nproc)" ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-gnu- olddefconfig vmlinux
aarch64-linux-gnu-ld: .init.data has both ordered [`__patchable_function_entries' in init/main.o] and unordered [`.meminit.data' in mm/sparse.o] sections
aarch64-linux-gnu-ld: final link failed: bad value
...

$ aarch64-linux-gnu-ld --version
GNU ld (GNU Binutils for Debian) 2.35.2
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

$ clang --version
Debian clang version 13.0.1-++20211029101439+08e3a5ccd952-1~exp1~20211029222017.20
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

I reproduced it via the TuxMake arm64 clang-13 image (docker.io/tuxmake/arm64_clang-13) and it is reproducible on the clang-nightly image as well. A locally produced clang-13 image based on Ubuntu 21.10 did not reproduce the issue:

$ aarch64-linux-gnu-ld --version
GNU ld (GNU Binutils for Ubuntu) 2.37
Copyright (C) 2021 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

$ clang --version
Ubuntu clang version 13.0.0-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

The issue is not present with LLVM=1.

@nathanchance nathanchance added [BUG] Untriaged Something isn't working [ARCH] arm64 This bug impacts ARCH=arm64 labels Nov 17, 2021
@nickdesaulniers nickdesaulniers added the GNU Binutils Interop non-LLVM=1 usage label Nov 17, 2021
@ihalip
Copy link

ihalip commented Nov 17, 2021

Could be related to the binutils version? https://sourceware.org/bugzilla/show_bug.cgi?id=26256 apparently fixed in 2.36.
I reproduced this too with 2.34.

@nathanchance
Copy link
Member Author

Yes, that is what I was thinking and that seems very likely as the root cause of the issue. It is possible that we can turn off this combination of configuration options in Kconfig, or just recommend LLVM=1 over CC=clang.

@nickdesaulniers
Copy link
Member

Is this an issue with newer GCC that supports -fpatchable-function-entries and older GNU binutils (2.34)? Or just newer clang plus older binutils? If the former, then perhaps the kconfig for -fpatchable-function-entries can be tied to binutils version. Otherwise, we may need kconfig checks for clang plus (lld or newer bfd).

@nathanchance
Copy link
Member Author

This problem was also reported by Will Deacon:

https://lore.kernel.org/20220408115407.GA27685@willie-the-truck/

I suggested a diff to resolve it:

https://lore.kernel.org/YlBuH2ScVeRO93AG@dev-arch.thelio-3990X/

@nathanchance nathanchance added [PATCH] Exists There is a patch that fixes this issue and removed [BUG] Untriaged Something isn't working labels Apr 8, 2022
@nathanchance
Copy link
Member Author

@nickdesaulniers
Copy link
Member

please cc the ML!

@nathanchance
Copy link
Member Author

please cc the ML!

Sorry, I did for this comment but then I replied to Will in a separate subthread and forgot to do it there :( will make sure to include it for any subsequent follow ups and patches.

@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [PATCH] Submitted A patch has been submitted for review and removed [PATCH] Exists There is a patch that fixes this issue labels Apr 13, 2022
@nathanchance
Copy link
Member Author

Patch accepted for the current merge window: https://git.kernel.org/arm64/c/45bd8951806eb5e857772c593de021b09057950d

@nathanchance nathanchance added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Apr 14, 2022
@nathanchance
Copy link
Member Author

Merged into mainline: https://git.kernel.org/linus/45bd8951806eb5e857772c593de021b09057950d

@nathanchance nathanchance added [FIXED][LINUX] 5.18 This bug was fixed in Linux 5.18 and removed [PATCH] Accepted A submitted patch has been accepted upstream labels Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] arm64 This bug impacts ARCH=arm64 [FIXED][LINUX] 5.18 This bug was fixed in Linux 5.18 GNU Binutils Interop non-LLVM=1 usage
Projects
None yet
Development

No branches or pull requests

3 participants