This series disables CONFIG_X86_X32_ABI=y with llvm-objcopy, which has
had two outstanding issues, which are further outlined in the second
patch:
https://github.com/ClangBuiltLinux/linux/issues/514
https://github.com/ClangBuiltLinux/linux/issues/1141
The first patch is from Masahiro, which moves the CONFIG_X86_X32_ABI
back into Kconfig proper. It was initially pushed as an RFC:
https://lore.kernel.org/r/[email protected]/
The conclusion of that thread was that the check was still needed
because of the two issues above. However, with the introduction of
IBT, specifically commit 41c5ef31ad71 ("x86/ibt: Base IBT bits"), the
second issue linked above becomes visible with allmodconfig, which
heavily impacts automated testing.
The second patch builds on the first by just universally disabling
CONFIG_X86_X32_ABI when using llvm-objcopy at configuration time so that
neither issue is visible.
While it is unlikely that these issues will be fixed in LLVM, this could
eventually become a version check.
This is based on -tip x86/core and I would like for both patches to go
with the IBT changes so that there is no build breakage.
Masahiro Yamada (1):
x86: Remove toolchain check for X32 ABI capability
Nathan Chancellor (1):
x86/Kconfig: Do not allow CONFIG_X86_X32_ABI=y with llvm-objcopy
arch/x86/Kconfig | 13 +++++++------
arch/x86/Makefile | 16 ----------------
arch/x86/entry/syscalls/Makefile | 2 +-
arch/x86/include/asm/syscall_wrapper.h | 6 +++---
arch/x86/include/asm/vdso.h | 2 +-
arch/x86/kernel/process_64.c | 2 +-
fs/fuse/ioctl.c | 2 +-
fs/xfs/xfs_ioctl32.c | 2 +-
sound/core/control_compat.c | 16 ++++++++--------
sound/core/pcm_compat.c | 20 ++++++++++----------
10 files changed, 33 insertions(+), 48 deletions(-)
base-commit: f8afc9d88e65d189653f363eacc1f3131216ef7c
--
2.35.1
There are two outstanding issues with CONFIG_X86_X32_ABI and
llvm-objcopy, with similar root causes:
1. llvm-objcopy does not properly convert .note.gnu.property when going
from x86_64 to x86_x32, resulting in a corrupted section when
linking:
https://github.com/ClangBuiltLinux/linux/issues/1141
2. llvm-objcopy produces corrupted compressed debug sections when going
from x86_64 to x86_x32, also resulting in an error when linking:
https://github.com/ClangBuiltLinux/linux/issues/514
After commit 41c5ef31ad71 ("x86/ibt: Base IBT bits"), the
.note.gnu.property section is always generated when
CONFIG_X86_KERNEL_IBT is enabled, which causes the first issue to become
visible with an allmodconfig build:
ld.lld: error: arch/x86/entry/vdso/vclock_gettime-x32.o:(.note.gnu.property+0x1c): program property is too short
To avoid this error, do not allow CONFIG_X86_X32_ABI to be selected when
using llvm-objcopy. If the two issues ever get fixed in llvm-objcopy,
this can be turned into a feature check.
Signed-off-by: Nathan Chancellor <[email protected]>
---
arch/x86/Kconfig | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b903bfcd713c..0f0672d2c816 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2864,6 +2864,11 @@ config IA32_AOUT
config X86_X32_ABI
bool "x32 ABI for 64-bit mode"
depends on X86_64
+ # llvm-objcopy does not convert x86_64 .note.gnu.property or
+ # compressed debug sections to x86_x32 properly:
+ # https://github.com/ClangBuiltLinux/linux/issues/514
+ # https://github.com/ClangBuiltLinux/linux/issues/1141
+ depends on $(success,$(OBJCOPY) --version | head -n1 | grep -qv llvm)
help
Include code to run binaries for the x32 native 32-bit ABI
for 64-bit processors. An x32 process gets access to the
--
2.35.1
The following commit has been merged into the x86/core branch of tip:
Commit-ID: aaeed6ecc1253ce1463fa1aca0b70a4ccbc9fa75
Gitweb: https://git.kernel.org/tip/aaeed6ecc1253ce1463fa1aca0b70a4ccbc9fa75
Author: Nathan Chancellor <[email protected]>
AuthorDate: Mon, 14 Mar 2022 12:48:42 -07:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Tue, 15 Mar 2022 10:32:48 +01:00
x86/Kconfig: Do not allow CONFIG_X86_X32_ABI=y with llvm-objcopy
There are two outstanding issues with CONFIG_X86_X32_ABI and
llvm-objcopy, with similar root causes:
1. llvm-objcopy does not properly convert .note.gnu.property when going
from x86_64 to x86_x32, resulting in a corrupted section when
linking:
https://github.com/ClangBuiltLinux/linux/issues/1141
2. llvm-objcopy produces corrupted compressed debug sections when going
from x86_64 to x86_x32, also resulting in an error when linking:
https://github.com/ClangBuiltLinux/linux/issues/514
After commit 41c5ef31ad71 ("x86/ibt: Base IBT bits"), the
.note.gnu.property section is always generated when
CONFIG_X86_KERNEL_IBT is enabled, which causes the first issue to become
visible with an allmodconfig build:
ld.lld: error: arch/x86/entry/vdso/vclock_gettime-x32.o:(.note.gnu.property+0x1c): program property is too short
To avoid this error, do not allow CONFIG_X86_X32_ABI to be selected when
using llvm-objcopy. If the two issues ever get fixed in llvm-objcopy,
this can be turned into a feature check.
Signed-off-by: Nathan Chancellor <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
arch/x86/Kconfig | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b903bfc..0f0672d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2864,6 +2864,11 @@ config IA32_AOUT
config X86_X32_ABI
bool "x32 ABI for 64-bit mode"
depends on X86_64
+ # llvm-objcopy does not convert x86_64 .note.gnu.property or
+ # compressed debug sections to x86_x32 properly:
+ # https://github.com/ClangBuiltLinux/linux/issues/514
+ # https://github.com/ClangBuiltLinux/linux/issues/1141
+ depends on $(success,$(OBJCOPY) --version | head -n1 | grep -qv llvm)
help
Include code to run binaries for the x32 native 32-bit ABI
for 64-bit processors. An x32 process gets access to the