x86: remove toolchain check for X32 ABI capability
Subsystems (5)
RFC PATCH 1/1 x86: remove toolchain check for X32 ABI capability
This commit reverts 0bf6276392e9 ("x32: Warn and disable rather than error if binutils too old").
The help text in arch/x86/Kconfig says enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23 according to Documentation/process/changes.rst.
I would not say I am not familiar with toolchain configuration, but I checked the configure.tgt code in binutils. The elf32_x86_64 emulation mode seems to be included when it is configured for the x86_64-*-linux-* target.
I also tried lld and llvm-objcopy, and succeeded in building x32 VDSO.
I removed the compile-time check in arch/x86/Makefile, in the hope of elf32_x86_64 being always supported.
With this, CONFIG_X86_X32 and CONFIG_X86_X32_ABI will be equivalent. Rename the former to the latter.
---
arch/x86/Kconfig | 8 ++------ arch/x86/Makefile | 16 ---------------- arch/x86/include/asm/syscall_wrapper.h | 6 +++--- arch/x86/include/asm/vdso.h | 2 +- arch/x86/kernel/process_64.c | 2 +- fs/fuse/file.c | 2 +- fs/xfs/xfs_ioctl32.c | 2 +- sound/core/control_compat.c | 16 ++++++++-------- sound/core/pcm_compat.c | 20 ++++++++++---------- 9 files changed, 27 insertions(+), 47 deletions(-)
arch/x86/Kconfig +2 -6
@@ -2865,7 +2865,7 @@ config IA32_AOUT help Support old a.out binaries in the 32bit emulation. -config X86_X32 +config X86_X32_ABI bool "x32 ABI for 64-bit mode" depends on X86_64 help
@@ -2874,10 +2874,6 @@ config X86_X32 full 64-bit register file and wide data path while leaving pointers at 32 bits for smaller memory footprint. - You will need a recent binutils (2.22 or later) with - elf32_x86_64 support enabled to compile a kernel with this - option set. - config COMPAT_32 def_bool y depends on IA32_EMULATION || X86_32
@@ -2886,7 +2882,7 @@ config COMPAT_32 config COMPAT def_bool y - depends on IA32_EMULATION || X86_X32 + depends on IA32_EMULATION || X86_X32_ABI if COMPAT config COMPAT_FOR_U64_ALIGNMENT
arch/x86/Makefile +0 -16
@@ -125,22 +125,6 @@ else KBUILD_CFLAGS += -mcmodel=kernel endif -ifdef CONFIG_X86_X32 - x32_ld_ok := $(call try-run,\ - /bin/echo -e '1: .quad 1b' | \ - $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ - $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ - $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) - ifeq ($(x32_ld_ok),y) - CONFIG_X86_X32_ABI := y - KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI - KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI - else - $(warning CONFIG_X86_X32 enabled but no binutils support) - endif -endif -export CONFIG_X86_X32_ABI - # # If the function graph tracer is used with mcount instead of fentry, # '-maccumulate-outgoing-args' is needed to prevent a GCC bug
arch/x86/include/asm/syscall_wrapper.h +3 -3
@@ -158,7 +158,7 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);#endif /* CONFIG_IA32_EMULATION */ -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* * For the x32 ABI, we need to create a stub for compat_sys_*() which is aware * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common
@@ -176,12 +176,12 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);#define __X32_COMPAT_SYS_NI (name) \ __SYS_NI(x32, compat_sys_##name) -#else /* CONFIG_X86_X32 */ +#else /* CONFIG_X86_X32_ABI */ #define __X32_COMPAT_SYS_STUB0 (name)#define __X32_COMPAT_SYS_STUBx (x, name, ...)#define __X32_COMPAT_COND_SYSCALL (name)#define __X32_COMPAT_SYS_NI (name) -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ #ifdef CONFIG_COMPAT
arch/x86/include/asm/vdso.h +1 -1
@@ -37,7 +37,7 @@ struct vdso_image {extern const struct vdso_image vdso_image_64;#endif -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI extern const struct vdso_image vdso_image_x32;#endif
arch/x86/kernel/process_64.c +1 -1
@@ -656,7 +656,7 @@ void set_personality_64bit(void)static void __set_personality_x32 (void ) { -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (current->mm) current->mm->context.flags =0 ;
fs/fuse/file.c +1 -1
@@ -2797,7 +2797,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,#else if (flags &FUSE_IOCTL_COMPAT ) { inarg.flags |=FUSE_IOCTL_32BIT ; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ()) inarg.flags |=FUSE_IOCTL_COMPAT_X32 ;#endif
fs/xfs/xfs_ioctl32.c +1 -1
@@ -233,7 +233,7 @@ xfs_compat_ioc_fsbulkstat(inumbers_fmt_pf inumbers_func = xfs_fsinumbers_fmt_compat;bulkstat_one_fmt_pf bs_one_func = xfs_fsbulkstat_one_fmt_compat; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ()) {/* * ... but on x32 the input xfs_fsop_bulkreq has pointers
sound/core/control_compat.c +8 -8
@@ -153,7 +153,7 @@ struct snd_ctl_elem_value32 {unsigned char reserved[128 ]; }; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* x32 has a different alignment for 64bit values from ia32 */ struct snd_ctl_elem_value_x32 { struct snd_ctl_elem_id id;
@@ -165,7 +165,7 @@ struct snd_ctl_elem_value_x32 { } value;unsigned char reserved[128 ]; }; -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* get the value type and count of the control */ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,
@@ -350,7 +350,7 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file,return ctl_elem_write_user (file, data32, &data32->value); } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI static int snd_ctl_elem_read_user_x32 (struct snd_card *card,struct snd_ctl_elem_value_x32 __user *data32) {
@@ -362,7 +362,7 @@ static int snd_ctl_elem_write_user_x32(struct snd_ctl_file *file, {return ctl_elem_write_user (file, data32, &data32->value); } -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* add or replace a user control */ static int snd_ctl_elem_add_compat(struct snd_ctl_file *file,
@@ -421,10 +421,10 @@ enum { SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32), SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32), SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32), -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI SNDRV_CTL_IOCTL_ELEM_READ_X32 = _IOWR('U', 0x12, struct snd_ctl_elem_value_x32), SNDRV_CTL_IOCTL_ELEM_WRITE_X32 = _IOWR('U', 0x13, struct snd_ctl_elem_value_x32), -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ };static inline long snd_ctl_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg)
@@ -463,12 +463,12 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsreturn snd_ctl_elem_add_compat (ctl, argp,0 );case SNDRV_CTL_IOCTL_ELEM_REPLACE32 :return snd_ctl_elem_add_compat (ctl, argp,1 ); -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI case SNDRV_CTL_IOCTL_ELEM_READ_X32 :return snd_ctl_elem_read_user_x32 (ctl->card, argp);case SNDRV_CTL_IOCTL_ELEM_WRITE_X32 :return snd_ctl_elem_write_user_x32 (ctl, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ }down_read (&snd_ioctl_rwsem);
sound/core/pcm_compat.c +10 -10
@@ -147,13 +147,13 @@ static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substreamreturn err; } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* X32 ABI has the same struct as x86-64 for snd_pcm_channel_info */ static int snd_pcm_channel_info_user (struct snd_pcm_substream *substream,struct snd_pcm_channel_info __user *src);#define snd_pcm_ioctl_channel_info_x32 (s, p) \ snd_pcm_channel_info_user(s, p) -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ struct compat_snd_pcm_status64 {snd_pcm_state_t state;
@@ -373,7 +373,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,return err; } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* X32 ABI has 64bit timespec and 64bit alignment */ struct snd_pcm_mmap_status_x32 { snd_pcm_state_t state;
@@ -464,7 +464,7 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, return 0; } -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* */
@@ -484,10 +484,10 @@ enum { SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32), SNDRV_PCM_IOCTL_STATUS_COMPAT64 = _IOR('A', 0x20, struct compat_snd_pcm_status64), SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 = _IOWR('A', 0x24, struct compat_snd_pcm_status64), -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 = _IOR('A', 0x32, struct snd_pcm_channel_info), SNDRV_PCM_IOCTL_SYNC_PTR_X32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr_x32), -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ };static long snd_pcm_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg)
@@ -531,10 +531,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned lcase __SNDRV_PCM_IOCTL_SYNC_PTR32:return snd_pcm_common_ioctl (file, substream, cmd, argp);case __SNDRV_PCM_IOCTL_SYNC_PTR64: -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ())return snd_pcm_ioctl_sync_ptr_x32 (substream, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ return snd_pcm_common_ioctl (file, substream, cmd, argp);case SNDRV_PCM_IOCTL_HW_REFINE32 :return snd_pcm_ioctl_hw_params_compat (substream,1 , argp);
@@ -566,10 +566,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned lreturn snd_pcm_status_user_compat64 (substream, argp, false);case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 :return snd_pcm_status_user_compat64 (substream, argp, true); -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 :return snd_pcm_ioctl_channel_info_x32 (substream, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ }return -ENOIOCTLCMD ;
Signature · 1 line
2.27.0
Quoted 9 lines · Masahiro Yamada
This commit reverts
0bf6276392e9("x32: Warn and disable rather than error if binutils too old").The help text in
arch/x86/Kconfigsays enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23 according toDocumentation/process/changes.rst.I would not say I am not familiar with toolchain configuration, but
I mean:
I would not say I am familiar ...
That is why I added RFC.
I appreciate comments from people who are familiar with toolchains (binutils, llvm).
If this change is not safe,
we can move this check to Kconfig at least.
Quoted 314 lines
I checked the configure.tgt code in binutils. The
elf32_x86_64emulation mode seems to be included when it is configured for the x86_64-*-linux-* target.I also tried lld and llvm-objcopy, and succeeded in building x32 VDSO.
I removed the compile-time check in
arch/x86/Makefile, in the hope ofelf32_x86_64being always supported.With this,
CONFIG_X86_X32andCONFIG_X86_X32_ABIwill be equivalent. Rename the former to the latter.Signed-off-by Masahiro Yamada <[email protected]>---
arch/x86/Kconfig | 8 ++------ arch/x86/Makefile | 16 ---------------- arch/x86/include/asm/syscall_wrapper.h | 6 +++--- arch/x86/include/asm/vdso.h | 2 +- arch/x86/kernel/process_64.c | 2 +- fs/fuse/file.c | 2 +- fs/xfs/xfs_ioctl32.c | 2 +- sound/core/control_compat.c | 16 ++++++++-------- sound/core/pcm_compat.c | 20 ++++++++++---------- 9 files changed, 27 insertions(+), 47 deletions(-)arch/x86/Kconfig +2
-6@@ -2865,7 +2865,7 @@ config IA32_AOUT help Support old a.out binaries in the 32bit emulation. -config X86_X32 +config X86_X32_ABI bool "x32 ABI for 64-bit mode" depends on X86_64 help@@ -2874,10 +2874,6 @@ config X86_X32 full 64-bit register file and wide data path while leaving pointers at 32 bits for smaller memory footprint. - You will need a recent binutils (2.22 or later) with - elf32_x86_64 support enabled to compile a kernel with this - option set. - config COMPAT_32 def_bool y depends on IA32_EMULATION || X86_32@@ -2886,7 +2882,7 @@ config COMPAT_32 config COMPAT def_bool y - depends on IA32_EMULATION || X86_X32 + depends on IA32_EMULATION || X86_X32_ABI if COMPAT config COMPAT_FOR_U64_ALIGNMENTarch/x86/Makefile +0
-16@@ -125,22 +125,6 @@ else KBUILD_CFLAGS += -mcmodel=kernel endif -ifdef CONFIG_X86_X32 - x32_ld_ok := $(call try-run,\ - /bin/echo -e '1: .quad 1b' | \ - $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ - $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ - $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) - ifeq ($(x32_ld_ok),y) - CONFIG_X86_X32_ABI := y - KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI - KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI - else - $(warning CONFIG_X86_X32 enabled but no binutils support) - endif -endif -export CONFIG_X86_X32_ABI - # # If the function graph tracer is used with mcount instead of fentry, # '-maccumulate-outgoing-args' is needed to prevent a GCC bugarch/x86/include/asm/syscall_wrapper.h +3
-3@@ -158,7 +158,7 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);#endif /* CONFIG_IA32_EMULATION */ -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* * For the x32 ABI, we need to create a stub for compat_sys_*() which is aware * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common @@ -176,12 +176,12 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);#define __X32_COMPAT_SYS_NI (name) \ __SYS_NI(x32, compat_sys_##name) -#else /* CONFIG_X86_X32 */ +#else /* CONFIG_X86_X32_ABI */ #define __X32_COMPAT_SYS_STUB0 (name)#define __X32_COMPAT_SYS_STUBx (x, name, ...)#define __X32_COMPAT_COND_SYSCALL (name)#define __X32_COMPAT_SYS_NI (name) -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ #ifdef CONFIG_COMPAT arch/x86/include/asm/vdso.h +1
-1@@ -37,7 +37,7 @@ struct vdso_image {extern const struct vdso_image vdso_image_64;#endif -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI extern const struct vdso_image vdso_image_x32;#endif arch/x86/kernel/process_64.c +1
-1@@ -656,7 +656,7 @@ void set_personality_64bit(void)static void __set_personality_x32 (void ) { -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (current->mm) current->mm->context.flags =0 ;fs/fuse/file.c +1
-1@@ -2797,7 +2797,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,#else if (flags &FUSE_IOCTL_COMPAT ) { inarg.flags |=FUSE_IOCTL_32BIT ; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ()) inarg.flags |=FUSE_IOCTL_COMPAT_X32 ;#endif fs/xfs/xfs_ioctl32.c +1
-1@@ -233,7 +233,7 @@ xfs_compat_ioc_fsbulkstat(inumbers_fmt_pf inumbers_func = xfs_fsinumbers_fmt_compat;bulkstat_one_fmt_pf bs_one_func = xfs_fsbulkstat_one_fmt_compat; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ()) {/* * ... but on x32 the input xfs_fsop_bulkreq has pointers sound/core/control_compat.c +8
-8@@ -153,7 +153,7 @@ struct snd_ctl_elem_value32 {unsigned char reserved[128 ]; }; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* x32 has a different alignment for 64bit values from ia32 */ struct snd_ctl_elem_value_x32 { struct snd_ctl_elem_id id;@@ -165,7 +165,7 @@ struct snd_ctl_elem_value_x32 { } value;unsigned char reserved[128 ]; }; -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* get the value type and count of the control */ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,@@ -350,7 +350,7 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file,return ctl_elem_write_user (file, data32, &data32->value); } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI static int snd_ctl_elem_read_user_x32 (struct snd_card *card,struct snd_ctl_elem_value_x32 __user *data32) {@@ -362,7 +362,7 @@ static int snd_ctl_elem_write_user_x32(struct snd_ctl_file *file, {return ctl_elem_write_user (file, data32, &data32->value); } -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* add or replace a user control */ static int snd_ctl_elem_add_compat(struct snd_ctl_file *file,@@ -421,10 +421,10 @@ enum { SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32), SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32), SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32), -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI SNDRV_CTL_IOCTL_ELEM_READ_X32 = _IOWR('U', 0x12, struct snd_ctl_elem_value_x32), SNDRV_CTL_IOCTL_ELEM_WRITE_X32 = _IOWR('U', 0x13, struct snd_ctl_elem_value_x32), -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ };static inline long snd_ctl_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg)@@ -463,12 +463,12 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsreturn snd_ctl_elem_add_compat (ctl, argp,0 );case SNDRV_CTL_IOCTL_ELEM_REPLACE32 :return snd_ctl_elem_add_compat (ctl, argp,1 ); -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI case SNDRV_CTL_IOCTL_ELEM_READ_X32 :return snd_ctl_elem_read_user_x32 (ctl->card, argp);case SNDRV_CTL_IOCTL_ELEM_WRITE_X32 :return snd_ctl_elem_write_user_x32 (ctl, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ }down_read (&snd_ioctl_rwsem);sound/core/pcm_compat.c +10
-11@@ -147,13 +147,13 @@ static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substreamreturn err; } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* X32 ABI has the same struct as x86-64 for snd_pcm_channel_info */ static int snd_pcm_channel_info_user (struct snd_pcm_substream *substream,struct snd_pcm_channel_info __user *src);#define snd_pcm_ioctl_channel_info_x32 (s, p) \ snd_pcm_channel_info_user(s, p) -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ struct compat_snd_pcm_status64 {snd_pcm_state_t state;@@ -373,7 +373,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,return err; } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* X32 ABI has 64bit timespec and 64bit alignment */ struct snd_pcm_mmap_status_x32 { snd_pcm_state_t state;@@ -464,7 +464,7 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, return 0; } -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* */ @@ -484,10 +484,10 @@ enum { SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32), SNDRV_PCM_IOCTL_STATUS_COMPAT64 = _IOR('A', 0x20, struct compat_snd_pcm_status64), SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 = _IOWR('A', 0x24, struct compat_snd_pcm_status64), -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 = _IOR('A', 0x32, struct snd_pcm_channel_info), SNDRV_PCM_IOCTL_SYNC_PTR_X32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr_x32), -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ };static long snd_pcm_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg)@@ -531,10 +531,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned lcase __SNDRV_PCM_IOCTL_SYNC_PTR32:return snd_pcm_common_ioctl (file, substream, cmd, argp);case __SNDRV_PCM_IOCTL_SYNC_PTR64: -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ())return snd_pcm_ioctl_sync_ptr_x32 (substream, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ return snd_pcm_common_ioctl (file, substream, cmd, argp);case SNDRV_PCM_IOCTL_HW_REFINE32 :return snd_pcm_ioctl_hw_params_compat (substream,1 , argp);@@ -566,10 +566,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned lreturn snd_pcm_status_user_compat64 (substream, argp, false);case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 :return snd_pcm_status_user_compat64 (substream, argp, true); -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 :return snd_pcm_ioctl_channel_info_x32 (substream, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ }return -ENOIOCTLCMD ; --2.27.0
Quoted 4 lines
--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210227183910.221873-1-masahiroy%40kernel.org.
--
Best Regards
Masahiro Yamada
Quoted 15 lines · Masahiro Yamada
Quoted 9 lines · Masahiro Yamada
This commit reverts
0bf6276392e9("x32: Warn and disable rather than error if binutils too old").The help text in
arch/x86/Kconfigsays enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23 according toDocumentation/process/changes.rst.I would not say I am not familiar with toolchain configuration, but
I mean:
I would not say I am familiar ...
That is why I added RFC.
Quoted 5 lines
I appreciate comments from people who are familiar with toolchains (binutils, llvm).
If this change is not safe,
we can move this check toKconfigat least.
Hi Masahiro,
As Fangrui pointed out, there are two outstanding issues with x32 with LLVM=1, both seemingly related to LLVM=1.
https://github.com/ClangBuiltLinux/linux/issues/514
https://github.com/ClangBuiltLinux/linux/issues/1141
Additionally, there appears to be one from Arnd as well but that one has received no triage yet.
https://github.com/ClangBuiltLinux/linux/issues/1205
I intend to test this patch as well as a few others at some point in the coming week although I am having to play sysadmin due to moving servers so I might not be able to get to it until later in the week.
Cheers,
Nathan
Quoted 324 lines
Quoted 314 lines
I checked the configure.tgt code in binutils. The
elf32_x86_64emulation mode seems to be included when it is configured for the x86_64-*-linux-* target.I also tried lld and llvm-objcopy, and succeeded in building x32 VDSO.
I removed the compile-time check in
arch/x86/Makefile, in the hope ofelf32_x86_64being always supported.With this,
CONFIG_X86_X32andCONFIG_X86_X32_ABIwill be equivalent. Rename the former to the latter.Signed-off-by Masahiro Yamada <[email protected]>---
arch/x86/Kconfig | 8 ++------ arch/x86/Makefile | 16 ---------------- arch/x86/include/asm/syscall_wrapper.h | 6 +++--- arch/x86/include/asm/vdso.h | 2 +- arch/x86/kernel/process_64.c | 2 +- fs/fuse/file.c | 2 +- fs/xfs/xfs_ioctl32.c | 2 +- sound/core/control_compat.c | 16 ++++++++-------- sound/core/pcm_compat.c | 20 ++++++++++---------- 9 files changed, 27 insertions(+), 47 deletions(-)arch/x86/Kconfig +2
-6@@ -2865,7 +2865,7 @@ config IA32_AOUT help Support old a.out binaries in the 32bit emulation. -config X86_X32 +config X86_X32_ABI bool "x32 ABI for 64-bit mode" depends on X86_64 help@@ -2874,10 +2874,6 @@ config X86_X32 full 64-bit register file and wide data path while leaving pointers at 32 bits for smaller memory footprint. - You will need a recent binutils (2.22 or later) with - elf32_x86_64 support enabled to compile a kernel with this - option set. - config COMPAT_32 def_bool y depends on IA32_EMULATION || X86_32@@ -2886,7 +2882,7 @@ config COMPAT_32 config COMPAT def_bool y - depends on IA32_EMULATION || X86_X32 + depends on IA32_EMULATION || X86_X32_ABI if COMPAT config COMPAT_FOR_U64_ALIGNMENTarch/x86/Makefile +0
-16@@ -125,22 +125,6 @@ else KBUILD_CFLAGS += -mcmodel=kernel endif -ifdef CONFIG_X86_X32 - x32_ld_ok := $(call try-run,\ - /bin/echo -e '1: .quad 1b' | \ - $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ - $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ - $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) - ifeq ($(x32_ld_ok),y) - CONFIG_X86_X32_ABI := y - KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI - KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI - else - $(warning CONFIG_X86_X32 enabled but no binutils support) - endif -endif -export CONFIG_X86_X32_ABI - # # If the function graph tracer is used with mcount instead of fentry, # '-maccumulate-outgoing-args' is needed to prevent a GCC bugarch/x86/include/asm/syscall_wrapper.h +3
-3@@ -158,7 +158,7 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);#endif /* CONFIG_IA32_EMULATION */ -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* * For the x32 ABI, we need to create a stub for compat_sys_*() which is aware * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common @@ -176,12 +176,12 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);#define __X32_COMPAT_SYS_NI (name) \ __SYS_NI(x32, compat_sys_##name) -#else /* CONFIG_X86_X32 */ +#else /* CONFIG_X86_X32_ABI */ #define __X32_COMPAT_SYS_STUB0 (name)#define __X32_COMPAT_SYS_STUBx (x, name, ...)#define __X32_COMPAT_COND_SYSCALL (name)#define __X32_COMPAT_SYS_NI (name) -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ #ifdef CONFIG_COMPAT arch/x86/include/asm/vdso.h +1
-1@@ -37,7 +37,7 @@ struct vdso_image {extern const struct vdso_image vdso_image_64;#endif -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI extern const struct vdso_image vdso_image_x32;#endif arch/x86/kernel/process_64.c +1
-1@@ -656,7 +656,7 @@ void set_personality_64bit(void)static void __set_personality_x32 (void ) { -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (current->mm) current->mm->context.flags =0 ;fs/fuse/file.c +1
-1@@ -2797,7 +2797,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,#else if (flags &FUSE_IOCTL_COMPAT ) { inarg.flags |=FUSE_IOCTL_32BIT ; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ()) inarg.flags |=FUSE_IOCTL_COMPAT_X32 ;#endif fs/xfs/xfs_ioctl32.c +1
-1@@ -233,7 +233,7 @@ xfs_compat_ioc_fsbulkstat(inumbers_fmt_pf inumbers_func = xfs_fsinumbers_fmt_compat;bulkstat_one_fmt_pf bs_one_func = xfs_fsbulkstat_one_fmt_compat; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ()) {/* * ... but on x32 the input xfs_fsop_bulkreq has pointers sound/core/control_compat.c +8
-8@@ -153,7 +153,7 @@ struct snd_ctl_elem_value32 {unsigned char reserved[128 ]; }; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* x32 has a different alignment for 64bit values from ia32 */ struct snd_ctl_elem_value_x32 { struct snd_ctl_elem_id id;@@ -165,7 +165,7 @@ struct snd_ctl_elem_value_x32 { } value;unsigned char reserved[128 ]; }; -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* get the value type and count of the control */ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,@@ -350,7 +350,7 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file,return ctl_elem_write_user (file, data32, &data32->value); } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI static int snd_ctl_elem_read_user_x32 (struct snd_card *card,struct snd_ctl_elem_value_x32 __user *data32) {@@ -362,7 +362,7 @@ static int snd_ctl_elem_write_user_x32(struct snd_ctl_file *file, {return ctl_elem_write_user (file, data32, &data32->value); } -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* add or replace a user control */ static int snd_ctl_elem_add_compat(struct snd_ctl_file *file,@@ -421,10 +421,10 @@ enum { SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32), SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32), SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32), -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI SNDRV_CTL_IOCTL_ELEM_READ_X32 = _IOWR('U', 0x12, struct snd_ctl_elem_value_x32), SNDRV_CTL_IOCTL_ELEM_WRITE_X32 = _IOWR('U', 0x13, struct snd_ctl_elem_value_x32), -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ };static inline long snd_ctl_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg)@@ -463,12 +463,12 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsreturn snd_ctl_elem_add_compat (ctl, argp,0 );case SNDRV_CTL_IOCTL_ELEM_REPLACE32 :return snd_ctl_elem_add_compat (ctl, argp,1 ); -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI case SNDRV_CTL_IOCTL_ELEM_READ_X32 :return snd_ctl_elem_read_user_x32 (ctl->card, argp);case SNDRV_CTL_IOCTL_ELEM_WRITE_X32 :return snd_ctl_elem_write_user_x32 (ctl, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ }down_read (&snd_ioctl_rwsem);sound/core/pcm_compat.c +10
-11@@ -147,13 +147,13 @@ static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substreamreturn err; } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* X32 ABI has the same struct as x86-64 for snd_pcm_channel_info */ static int snd_pcm_channel_info_user (struct snd_pcm_substream *substream,struct snd_pcm_channel_info __user *src);#define snd_pcm_ioctl_channel_info_x32 (s, p) \ snd_pcm_channel_info_user(s, p) -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ struct compat_snd_pcm_status64 {snd_pcm_state_t state;@@ -373,7 +373,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,return err; } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* X32 ABI has 64bit timespec and 64bit alignment */ struct snd_pcm_mmap_status_x32 { snd_pcm_state_t state;@@ -464,7 +464,7 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, return 0; } -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* */ @@ -484,10 +484,10 @@ enum { SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32), SNDRV_PCM_IOCTL_STATUS_COMPAT64 = _IOR('A', 0x20, struct compat_snd_pcm_status64), SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 = _IOWR('A', 0x24, struct compat_snd_pcm_status64), -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 = _IOR('A', 0x32, struct snd_pcm_channel_info), SNDRV_PCM_IOCTL_SYNC_PTR_X32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr_x32), -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ };static long snd_pcm_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg)@@ -531,10 +531,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned lcase __SNDRV_PCM_IOCTL_SYNC_PTR32:return snd_pcm_common_ioctl (file, substream, cmd, argp);case __SNDRV_PCM_IOCTL_SYNC_PTR64: -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ())return snd_pcm_ioctl_sync_ptr_x32 (substream, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ return snd_pcm_common_ioctl (file, substream, cmd, argp);case SNDRV_PCM_IOCTL_HW_REFINE32 :return snd_pcm_ioctl_hw_params_compat (substream,1 , argp);@@ -566,10 +566,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned lreturn snd_pcm_status_user_compat64 (substream, argp, false);case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 :return snd_pcm_status_user_compat64 (substream, argp, true); -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 :return snd_pcm_ioctl_channel_info_x32 (substream, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ }return -ENOIOCTLCMD ; --2.27.0
Quoted 4 lines
--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210227183910.221873-1-masahiroy%40kernel.org.--
Best Regards
Masahiro Yamada
Quoted 19 lines · Nathan Chancellor
Quoted 18 lines · Masahiro Yamada
Quoted 9 lines · Masahiro Yamada
This commit reverts
0bf6276392e9("x32: Warn and disable rather than error if binutils too old").The help text in
arch/x86/Kconfigsays enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23 according toDocumentation/process/changes.rst.I would not say I am not familiar with toolchain configuration, but
I mean:
I would not say I am familiar ...
That is why I added RFC.I appreciate comments from people who are familiar with toolchains (binutils, llvm).
Quoted 7 lines
Quoted 2 lines
If this change is not safe,
we can move this check toKconfigat least.Hi Masahiro,
As Fangrui pointed out, there are two outstanding issues with x32 with LLVM=1, both seemingly related to LLVM=1.
^ llvm-objcopy
Sigh, note to self, don't write emails while tired...
Cheers,
Nathan
Quoted 340 lines
https://github.com/ClangBuiltLinux/linux/issues/514
https://github.com/ClangBuiltLinux/linux/issues/1141Additionally, there appears to be one from Arnd as well but that one has received no triage yet.
https://github.com/ClangBuiltLinux/linux/issues/1205
I intend to test this patch as well as a few others at some point in the coming week although I am having to play sysadmin due to moving servers so I might not be able to get to it until later in the week.
Cheers,
NathanQuoted 324 lines
Quoted 314 lines
I checked the configure.tgt code in binutils. The
elf32_x86_64emulation mode seems to be included when it is configured for the x86_64-*-linux-* target.I also tried lld and llvm-objcopy, and succeeded in building x32 VDSO.
I removed the compile-time check in
arch/x86/Makefile, in the hope ofelf32_x86_64being always supported.With this,
CONFIG_X86_X32andCONFIG_X86_X32_ABIwill be equivalent. Rename the former to the latter.Signed-off-by Masahiro Yamada <[email protected]>---
arch/x86/Kconfig | 8 ++------ arch/x86/Makefile | 16 ---------------- arch/x86/include/asm/syscall_wrapper.h | 6 +++--- arch/x86/include/asm/vdso.h | 2 +- arch/x86/kernel/process_64.c | 2 +- fs/fuse/file.c | 2 +- fs/xfs/xfs_ioctl32.c | 2 +- sound/core/control_compat.c | 16 ++++++++-------- sound/core/pcm_compat.c | 20 ++++++++++---------- 9 files changed, 27 insertions(+), 47 deletions(-)arch/x86/Kconfig +2
-6@@ -2865,7 +2865,7 @@ config IA32_AOUT help Support old a.out binaries in the 32bit emulation. -config X86_X32 +config X86_X32_ABI bool "x32 ABI for 64-bit mode" depends on X86_64 help@@ -2874,10 +2874,6 @@ config X86_X32 full 64-bit register file and wide data path while leaving pointers at 32 bits for smaller memory footprint. - You will need a recent binutils (2.22 or later) with - elf32_x86_64 support enabled to compile a kernel with this - option set. - config COMPAT_32 def_bool y depends on IA32_EMULATION || X86_32@@ -2886,7 +2882,7 @@ config COMPAT_32 config COMPAT def_bool y - depends on IA32_EMULATION || X86_X32 + depends on IA32_EMULATION || X86_X32_ABI if COMPAT config COMPAT_FOR_U64_ALIGNMENTarch/x86/Makefile +0
-16@@ -125,22 +125,6 @@ else KBUILD_CFLAGS += -mcmodel=kernel endif -ifdef CONFIG_X86_X32 - x32_ld_ok := $(call try-run,\ - /bin/echo -e '1: .quad 1b' | \ - $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ - $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ - $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) - ifeq ($(x32_ld_ok),y) - CONFIG_X86_X32_ABI := y - KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI - KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI - else - $(warning CONFIG_X86_X32 enabled but no binutils support) - endif -endif -export CONFIG_X86_X32_ABI - # # If the function graph tracer is used with mcount instead of fentry, # '-maccumulate-outgoing-args' is needed to prevent a GCC bugarch/x86/include/asm/syscall_wrapper.h +3
-3@@ -158,7 +158,7 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);#endif /* CONFIG_IA32_EMULATION */ -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* * For the x32 ABI, we need to create a stub for compat_sys_*() which is aware * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common @@ -176,12 +176,12 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);#define __X32_COMPAT_SYS_NI (name) \ __SYS_NI(x32, compat_sys_##name) -#else /* CONFIG_X86_X32 */ +#else /* CONFIG_X86_X32_ABI */ #define __X32_COMPAT_SYS_STUB0 (name)#define __X32_COMPAT_SYS_STUBx (x, name, ...)#define __X32_COMPAT_COND_SYSCALL (name)#define __X32_COMPAT_SYS_NI (name) -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ #ifdef CONFIG_COMPAT arch/x86/include/asm/vdso.h +1
-1@@ -37,7 +37,7 @@ struct vdso_image {extern const struct vdso_image vdso_image_64;#endif -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI extern const struct vdso_image vdso_image_x32;#endif arch/x86/kernel/process_64.c +1
-1@@ -656,7 +656,7 @@ void set_personality_64bit(void)static void __set_personality_x32 (void ) { -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (current->mm) current->mm->context.flags =0 ;fs/fuse/file.c +1
-1@@ -2797,7 +2797,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,#else if (flags &FUSE_IOCTL_COMPAT ) { inarg.flags |=FUSE_IOCTL_32BIT ; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ()) inarg.flags |=FUSE_IOCTL_COMPAT_X32 ;#endif fs/xfs/xfs_ioctl32.c +1
-1@@ -233,7 +233,7 @@ xfs_compat_ioc_fsbulkstat(inumbers_fmt_pf inumbers_func = xfs_fsinumbers_fmt_compat;bulkstat_one_fmt_pf bs_one_func = xfs_fsbulkstat_one_fmt_compat; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ()) {/* * ... but on x32 the input xfs_fsop_bulkreq has pointers sound/core/control_compat.c +8
-8@@ -153,7 +153,7 @@ struct snd_ctl_elem_value32 {unsigned char reserved[128 ]; }; -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* x32 has a different alignment for 64bit values from ia32 */ struct snd_ctl_elem_value_x32 { struct snd_ctl_elem_id id;@@ -165,7 +165,7 @@ struct snd_ctl_elem_value_x32 { } value;unsigned char reserved[128 ]; }; -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* get the value type and count of the control */ static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,@@ -350,7 +350,7 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file,return ctl_elem_write_user (file, data32, &data32->value); } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI static int snd_ctl_elem_read_user_x32 (struct snd_card *card,struct snd_ctl_elem_value_x32 __user *data32) {@@ -362,7 +362,7 @@ static int snd_ctl_elem_write_user_x32(struct snd_ctl_file *file, {return ctl_elem_write_user (file, data32, &data32->value); } -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* add or replace a user control */ static int snd_ctl_elem_add_compat(struct snd_ctl_file *file,@@ -421,10 +421,10 @@ enum { SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32), SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32), SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32), -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI SNDRV_CTL_IOCTL_ELEM_READ_X32 = _IOWR('U', 0x12, struct snd_ctl_elem_value_x32), SNDRV_CTL_IOCTL_ELEM_WRITE_X32 = _IOWR('U', 0x13, struct snd_ctl_elem_value_x32), -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ };static inline long snd_ctl_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg)@@ -463,12 +463,12 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsreturn snd_ctl_elem_add_compat (ctl, argp,0 );case SNDRV_CTL_IOCTL_ELEM_REPLACE32 :return snd_ctl_elem_add_compat (ctl, argp,1 ); -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI case SNDRV_CTL_IOCTL_ELEM_READ_X32 :return snd_ctl_elem_read_user_x32 (ctl->card, argp);case SNDRV_CTL_IOCTL_ELEM_WRITE_X32 :return snd_ctl_elem_write_user_x32 (ctl, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ }down_read (&snd_ioctl_rwsem);sound/core/pcm_compat.c +10
-11@@ -147,13 +147,13 @@ static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substreamreturn err; } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* X32 ABI has the same struct as x86-64 for snd_pcm_channel_info */ static int snd_pcm_channel_info_user (struct snd_pcm_substream *substream,struct snd_pcm_channel_info __user *src);#define snd_pcm_ioctl_channel_info_x32 (s, p) \ snd_pcm_channel_info_user(s, p) -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ struct compat_snd_pcm_status64 {snd_pcm_state_t state;@@ -373,7 +373,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,return err; } -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI /* X32 ABI has 64bit timespec and 64bit alignment */ struct snd_pcm_mmap_status_x32 { snd_pcm_state_t state;@@ -464,7 +464,7 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, return 0; } -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ /* */ @@ -484,10 +484,10 @@ enum { SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32), SNDRV_PCM_IOCTL_STATUS_COMPAT64 = _IOR('A', 0x20, struct compat_snd_pcm_status64), SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 = _IOWR('A', 0x24, struct compat_snd_pcm_status64), -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 = _IOR('A', 0x32, struct snd_pcm_channel_info), SNDRV_PCM_IOCTL_SYNC_PTR_X32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr_x32), -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ };static long snd_pcm_ioctl_compat (struct file *file,unsigned int cmd,unsigned long arg)@@ -531,10 +531,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned lcase __SNDRV_PCM_IOCTL_SYNC_PTR32:return snd_pcm_common_ioctl (file, substream, cmd, argp);case __SNDRV_PCM_IOCTL_SYNC_PTR64: -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI if (in_x32_syscall ())return snd_pcm_ioctl_sync_ptr_x32 (substream, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ return snd_pcm_common_ioctl (file, substream, cmd, argp);case SNDRV_PCM_IOCTL_HW_REFINE32 :return snd_pcm_ioctl_hw_params_compat (substream,1 , argp);@@ -566,10 +566,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned lreturn snd_pcm_status_user_compat64 (substream, argp, false);case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 :return snd_pcm_status_user_compat64 (substream, argp, true); -#ifdef CONFIG_X86_X32 +#ifdef CONFIG_X86_X32_ABI case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 :return snd_pcm_ioctl_channel_info_x32 (substream, argp); -#endif /* CONFIG_X86_X32 */ +#endif /* CONFIG_X86_X32_ABI */ }return -ENOIOCTLCMD ; --2.27.0
Quoted 4 lines
--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210227183910.221873-1-masahiroy%40kernel.org.--
Best Regards
Masahiro Yamada
Quoted 24 lines · Nathan Chancellor
Quoted 22 lines · Nathan Chancellor
Quoted 20 lines · Masahiro Yamada
Quoted 9 lines · Masahiro Yamada
This commit reverts
0bf6276392e9("x32: Warn and disable rather than error if binutils too old").The help text in
arch/x86/Kconfigsays enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23 according toDocumentation/process/changes.rst.I would not say I am not familiar with toolchain configuration, but
I mean:
I would not say I am familiar ...
That is why I added RFC.I appreciate comments from people who are familiar with toolchains (binutils, llvm).
If this change is not safe,
we can move this check toKconfigat least.
Quoted 8 lines
Quoted 4 lines
Hi Masahiro,
As Fangrui pointed out, there are two outstanding issues with x32 with LLVM=1, both seemingly related to LLVM=1.
^ llvm-objcopy
Sigh, note to self, don't write emails while tired...
Fangrui, Nathan, thanks for your comments.
OK, then we still need to carry this toolchain check.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 20 lines · Nathan Chancellor
Quoted 18 lines · Masahiro Yamada
Quoted 9 lines · Masahiro Yamada
This commit reverts
0bf6276392e9("x32: Warn and disable rather than error if binutils too old").The help text in
arch/x86/Kconfigsays enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23 according toDocumentation/process/changes.rst.I would not say I am not familiar with toolchain configuration, but
I mean:
I would not say I am familiar ...
That is why I added RFC.I appreciate comments from people who are familiar with toolchains (binutils, llvm).
Quoted 7 lines
Quoted 2 lines
If this change is not safe,
we can move this check toKconfigat least.Hi Masahiro,
As Fangrui pointed out, there are two outstanding issues with x32 with LLVM=1, both seemingly related to LLVM=1.
Is this still a problem for Clang built Linux?
Quoted 1 line
I am not tracking the status.
What was the conclusion?
Quoted 1 line
This got marked "unreproducible"
Quoted 5 lines
Additionally, there appears to be one from Arnd as well but that one has received no triage yet.
Same as well.
Quoted 8 lines
I intend to test this patch as well as a few others at some point in the coming week although I am having to play sysadmin due to moving servers so I might not be able to get to it until later in the week.
Cheers,
Nathan
Signature · 2 lines
Best Regards Masahiro Yamada
Hi Masahiro,
Quoted 29 lines · Masahiro Yamada
Quoted 20 lines · Nathan Chancellor
Quoted 18 lines · Masahiro Yamada
Quoted 9 lines · Masahiro Yamada
This commit reverts
0bf6276392e9("x32: Warn and disable rather than error if binutils too old").The help text in
arch/x86/Kconfigsays enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23 according toDocumentation/process/changes.rst.I would not say I am not familiar with toolchain configuration, but
I mean:
I would not say I am familiar ...
That is why I added RFC.I appreciate comments from people who are familiar with toolchains (binutils, llvm).
Quoted 7 lines
Quoted 2 lines
If this change is not safe,
we can move this check toKconfigat least.Hi Masahiro,
As Fangrui pointed out, there are two outstanding issues with x32 with LLVM=1, both seemingly related to LLVM=1.
Quoted 8 lines
Is this still a problem for Clang built Linux?
Quoted 1 line
I am not tracking the status.
What was the conclusion?
This appears to no longer be reproducible so I closed it.
Quoted 4 lines
Quoted 1 line
This got marked "unreproducible"
I just had a look at this and it is still reproducible (see the bug for details).
Quoted 6 lines
Quoted 4 lines
Additionally, there appears to be one from Arnd as well but that one has received no triage yet.
Same as well.
Yeah, I cannot reproduce this.
It seems like a Kconfig test would still be best for the issue above, if it is not too much to maintain.
Cheers,
Nathan
Quoted 12 lines · Masahiro Yamada
This commit reverts
0bf6276392e9("x32: Warn and disable rather than error if binutils too old").The help text in
arch/x86/Kconfigsays enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23 according toDocumentation/process/changes.rst.I would not say I am not familiar with toolchain configuration, but I checked the configure.tgt code in binutils. The
elf32_x86_64emulation mode seems to be included when it is configured for the x86_64-*-linux-* target.
Quoted 7 lines
I also tried lld and llvm-objcopy, and succeeded in building x32 VDSO.
I removed the compile-time check in
arch/x86/Makefile, in the hope ofelf32_x86_64being always supported.With this,
CONFIG_X86_X32andCONFIG_X86_X32_ABIwill be equivalent. Rename the former to the latter.
Hi Masahiro, the cleanup looks nice!
As of LLVM toolchain support, I don't know any user using LLVM binary utilities or LLD.
The support on binary utitlies should be minimum anyway (EM_X86_64, ELFCLASS32, ELFDATA2LSB are mostly all the tool needs to know for many utilities), so many of they should just work.
For llvm-objcopy, I know two issues related to $(OBJCOPY) -O elf32-x86-64 (actually objcopy -I elf64-x86-64 -O elf32-x86-64). Such an operation tries to convert an ELFCLASS64 object file to an ELFCLASS32 object file. It is not very clear what GNU objcopy does. llvm-objcopy is dumb and does not do fancy CLASS conversion.
* {gcc,clang} -gz{,=zlib} produced object files. The Elf{32,64}_Chdr headers are different.
Seems that GNU objcopy can convert the headers (https://github.com/ClangBuiltLinux/linux/issues/514).
llvm-objcopy cannot do it.
* Seems that GNU objcopy can convert .note.gnu.property (https://github.com/ClangBuiltLinux/linux/issues/1141#issuecomment-678798228)
llvm-objcopy cannot do it.
On the linker side, I know TLS relaxations and IBT need special care and I believe LLD does not handle them correctly. Thankfully the kernel does not use thread-local storage so this is not an issue. So perhaps for most configurations it is already working. Since you've tested it, that is good news to me:)