Skip to content

Commit 83a44a4

Browse files
masahir0yPeter Zijlstra
authored andcommitted
x86: Remove toolchain check for X32 ABI capability
Commit 0bf6276 ("x32: Warn and disable rather than error if binutils too old") added a small test in arch/x86/Makefile because binutils 2.22 or newer is needed to properly support elf32-x86-64. This check is no longer necessary, as the minimum supported version of binutils is 2.23, which is enforced at configuration time with scripts/min-tool-version.sh. Remove this check and replace all uses of CONFIG_X86_X32 with CONFIG_X86_X32_ABI, as two symbols are no longer necessary. [nathan: Rebase, fix up a few places where CONFIG_X86_X32 was still used, and simplify commit message to satisfy -tip requirements] Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ed53a0d commit 83a44a4

File tree

10 files changed

+28
-48
lines changed

10 files changed

+28
-48
lines changed

arch/x86/Kconfig

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,7 +2861,7 @@ config IA32_AOUT
28612861
help
28622862
Support old a.out binaries in the 32bit emulation.
28632863

2864-
config X86_X32
2864+
config X86_X32_ABI
28652865
bool "x32 ABI for 64-bit mode"
28662866
depends on X86_64
28672867
help
@@ -2870,10 +2870,6 @@ config X86_X32
28702870
full 64-bit register file and wide data path while leaving
28712871
pointers at 32 bits for smaller memory footprint.
28722872

2873-
You will need a recent binutils (2.22 or later) with
2874-
elf32_x86_64 support enabled to compile a kernel with this
2875-
option set.
2876-
28772873
config COMPAT_32
28782874
def_bool y
28792875
depends on IA32_EMULATION || X86_32
@@ -2882,7 +2878,7 @@ config COMPAT_32
28822878

28832879
config COMPAT
28842880
def_bool y
2885-
depends on IA32_EMULATION || X86_X32
2881+
depends on IA32_EMULATION || X86_X32_ABI
28862882

28872883
if COMPAT
28882884
config COMPAT_FOR_U64_ALIGNMENT

arch/x86/Makefile

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,6 @@ else
152152
KBUILD_CFLAGS += -mcmodel=kernel
153153
endif
154154

155-
ifdef CONFIG_X86_X32
156-
x32_ld_ok := $(call try-run,\
157-
/bin/echo -e '1: .quad 1b' | \
158-
$(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \
159-
$(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMP.o" && \
160-
$(LD) -m elf32_x86_64 "$$TMP.o" -o "$$TMP",y,n)
161-
ifeq ($(x32_ld_ok),y)
162-
CONFIG_X86_X32_ABI := y
163-
KBUILD_AFLAGS += -DCONFIG_X86_X32_ABI
164-
KBUILD_CFLAGS += -DCONFIG_X86_X32_ABI
165-
else
166-
$(warning CONFIG_X86_X32 enabled but no binutils support)
167-
endif
168-
endif
169-
export CONFIG_X86_X32_ABI
170-
171155
#
172156
# If the function graph tracer is used with mcount instead of fentry,
173157
# '-maccumulate-outgoing-args' is needed to prevent a GCC bug

arch/x86/entry/syscalls/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ uapisyshdr-y += unistd_32.h unistd_64.h unistd_x32.h
6767
syshdr-y += syscalls_32.h
6868
syshdr-$(CONFIG_X86_64) += unistd_32_ia32.h unistd_64_x32.h
6969
syshdr-$(CONFIG_X86_64) += syscalls_64.h
70-
syshdr-$(CONFIG_X86_X32) += syscalls_x32.h
70+
syshdr-$(CONFIG_X86_X32_ABI) += syscalls_x32.h
7171
syshdr-$(CONFIG_XEN) += xen-hypercalls.h
7272

7373
uapisyshdr-y := $(addprefix $(uapi)/, $(uapisyshdr-y))

arch/x86/include/asm/syscall_wrapper.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);
159159
#endif /* CONFIG_IA32_EMULATION */
160160

161161

162-
#ifdef CONFIG_X86_X32
162+
#ifdef CONFIG_X86_X32_ABI
163163
/*
164164
* For the x32 ABI, we need to create a stub for compat_sys_*() which is aware
165165
* of the x86-64-style parameter ordering of x32 syscalls. The syscalls common
@@ -177,12 +177,12 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs);
177177

178178
#define __X32_COMPAT_SYS_NI(name) \
179179
__SYS_NI(x64, compat_sys_##name)
180-
#else /* CONFIG_X86_X32 */
180+
#else /* CONFIG_X86_X32_ABI */
181181
#define __X32_COMPAT_SYS_STUB0(name)
182182
#define __X32_COMPAT_SYS_STUBx(x, name, ...)
183183
#define __X32_COMPAT_COND_SYSCALL(name)
184184
#define __X32_COMPAT_SYS_NI(name)
185-
#endif /* CONFIG_X86_X32 */
185+
#endif /* CONFIG_X86_X32_ABI */
186186

187187

188188
#ifdef CONFIG_COMPAT

arch/x86/include/asm/vdso.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct vdso_image {
3737
extern const struct vdso_image vdso_image_64;
3838
#endif
3939

40-
#ifdef CONFIG_X86_X32
40+
#ifdef CONFIG_X86_X32_ABI
4141
extern const struct vdso_image vdso_image_x32;
4242
#endif
4343

arch/x86/kernel/process_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ void set_personality_64bit(void)
681681

682682
static void __set_personality_x32(void)
683683
{
684-
#ifdef CONFIG_X86_X32
684+
#ifdef CONFIG_X86_X32_ABI
685685
if (current->mm)
686686
current->mm->context.flags = 0;
687687

fs/fuse/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
170170
#else
171171
if (flags & FUSE_IOCTL_COMPAT) {
172172
inarg.flags |= FUSE_IOCTL_32BIT;
173-
#ifdef CONFIG_X86_X32
173+
#ifdef CONFIG_X86_X32_ABI
174174
if (in_x32_syscall())
175175
inarg.flags |= FUSE_IOCTL_COMPAT_X32;
176176
#endif

fs/xfs/xfs_ioctl32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ xfs_compat_ioc_fsbulkstat(
217217
inumbers_fmt_pf inumbers_func = xfs_fsinumbers_fmt_compat;
218218
bulkstat_one_fmt_pf bs_one_func = xfs_fsbulkstat_one_fmt_compat;
219219

220-
#ifdef CONFIG_X86_X32
220+
#ifdef CONFIG_X86_X32_ABI
221221
if (in_x32_syscall()) {
222222
/*
223223
* ... but on x32 the input xfs_fsop_bulkreq has pointers

sound/core/control_compat.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ struct snd_ctl_elem_value32 {
150150
unsigned char reserved[128];
151151
};
152152

153-
#ifdef CONFIG_X86_X32
153+
#ifdef CONFIG_X86_X32_ABI
154154
/* x32 has a different alignment for 64bit values from ia32 */
155155
struct snd_ctl_elem_value_x32 {
156156
struct snd_ctl_elem_id id;
@@ -162,7 +162,7 @@ struct snd_ctl_elem_value_x32 {
162162
} value;
163163
unsigned char reserved[128];
164164
};
165-
#endif /* CONFIG_X86_X32 */
165+
#endif /* CONFIG_X86_X32_ABI */
166166

167167
/* get the value type and count of the control */
168168
static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,
@@ -347,7 +347,7 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file,
347347
return ctl_elem_write_user(file, data32, &data32->value);
348348
}
349349

350-
#ifdef CONFIG_X86_X32
350+
#ifdef CONFIG_X86_X32_ABI
351351
static int snd_ctl_elem_read_user_x32(struct snd_card *card,
352352
struct snd_ctl_elem_value_x32 __user *data32)
353353
{
@@ -359,7 +359,7 @@ static int snd_ctl_elem_write_user_x32(struct snd_ctl_file *file,
359359
{
360360
return ctl_elem_write_user(file, data32, &data32->value);
361361
}
362-
#endif /* CONFIG_X86_X32 */
362+
#endif /* CONFIG_X86_X32_ABI */
363363

364364
/* add or replace a user control */
365365
static int snd_ctl_elem_add_compat(struct snd_ctl_file *file,
@@ -418,10 +418,10 @@ enum {
418418
SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32),
419419
SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32),
420420
SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32),
421-
#ifdef CONFIG_X86_X32
421+
#ifdef CONFIG_X86_X32_ABI
422422
SNDRV_CTL_IOCTL_ELEM_READ_X32 = _IOWR('U', 0x12, struct snd_ctl_elem_value_x32),
423423
SNDRV_CTL_IOCTL_ELEM_WRITE_X32 = _IOWR('U', 0x13, struct snd_ctl_elem_value_x32),
424-
#endif /* CONFIG_X86_X32 */
424+
#endif /* CONFIG_X86_X32_ABI */
425425
};
426426

427427
static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
@@ -460,12 +460,12 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns
460460
return snd_ctl_elem_add_compat(ctl, argp, 0);
461461
case SNDRV_CTL_IOCTL_ELEM_REPLACE32:
462462
return snd_ctl_elem_add_compat(ctl, argp, 1);
463-
#ifdef CONFIG_X86_X32
463+
#ifdef CONFIG_X86_X32_ABI
464464
case SNDRV_CTL_IOCTL_ELEM_READ_X32:
465465
return snd_ctl_elem_read_user_x32(ctl->card, argp);
466466
case SNDRV_CTL_IOCTL_ELEM_WRITE_X32:
467467
return snd_ctl_elem_write_user_x32(ctl, argp);
468-
#endif /* CONFIG_X86_X32 */
468+
#endif /* CONFIG_X86_X32_ABI */
469469
}
470470

471471
down_read(&snd_ioctl_rwsem);

sound/core/pcm_compat.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ static int snd_pcm_ioctl_channel_info_compat(struct snd_pcm_substream *substream
147147
return err;
148148
}
149149

150-
#ifdef CONFIG_X86_X32
150+
#ifdef CONFIG_X86_X32_ABI
151151
/* X32 ABI has the same struct as x86-64 for snd_pcm_channel_info */
152152
static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream,
153153
struct snd_pcm_channel_info __user *src);
154154
#define snd_pcm_ioctl_channel_info_x32(s, p) \
155155
snd_pcm_channel_info_user(s, p)
156-
#endif /* CONFIG_X86_X32 */
156+
#endif /* CONFIG_X86_X32_ABI */
157157

158158
struct compat_snd_pcm_status64 {
159159
snd_pcm_state_t state;
@@ -375,7 +375,7 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
375375
return err;
376376
}
377377

378-
#ifdef CONFIG_X86_X32
378+
#ifdef CONFIG_X86_X32_ABI
379379
/* X32 ABI has 64bit timespec and 64bit alignment */
380380
struct snd_pcm_mmap_status_x32 {
381381
snd_pcm_state_t state;
@@ -468,7 +468,7 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream,
468468

469469
return 0;
470470
}
471-
#endif /* CONFIG_X86_X32 */
471+
#endif /* CONFIG_X86_X32_ABI */
472472

473473
#ifdef __BIG_ENDIAN
474474
typedef char __pad_before_u32[4];
@@ -560,10 +560,10 @@ enum {
560560
SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32),
561561
SNDRV_PCM_IOCTL_STATUS_COMPAT64 = _IOR('A', 0x20, struct compat_snd_pcm_status64),
562562
SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64 = _IOWR('A', 0x24, struct compat_snd_pcm_status64),
563-
#ifdef CONFIG_X86_X32
563+
#ifdef CONFIG_X86_X32_ABI
564564
SNDRV_PCM_IOCTL_CHANNEL_INFO_X32 = _IOR('A', 0x32, struct snd_pcm_channel_info),
565565
SNDRV_PCM_IOCTL_SYNC_PTR_X32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr_x32),
566-
#endif /* CONFIG_X86_X32 */
566+
#endif /* CONFIG_X86_X32_ABI */
567567
};
568568

569569
static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
@@ -607,10 +607,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
607607
case __SNDRV_PCM_IOCTL_SYNC_PTR32:
608608
return snd_pcm_common_ioctl(file, substream, cmd, argp);
609609
case __SNDRV_PCM_IOCTL_SYNC_PTR64:
610-
#ifdef CONFIG_X86_X32
610+
#ifdef CONFIG_X86_X32_ABI
611611
if (in_x32_syscall())
612612
return snd_pcm_ioctl_sync_ptr_x32(substream, argp);
613-
#endif /* CONFIG_X86_X32 */
613+
#endif /* CONFIG_X86_X32_ABI */
614614
return snd_pcm_ioctl_sync_ptr_buggy(substream, argp);
615615
case SNDRV_PCM_IOCTL_HW_REFINE32:
616616
return snd_pcm_ioctl_hw_params_compat(substream, 1, argp);
@@ -642,10 +642,10 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
642642
return snd_pcm_status_user_compat64(substream, argp, false);
643643
case SNDRV_PCM_IOCTL_STATUS_EXT_COMPAT64:
644644
return snd_pcm_status_user_compat64(substream, argp, true);
645-
#ifdef CONFIG_X86_X32
645+
#ifdef CONFIG_X86_X32_ABI
646646
case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32:
647647
return snd_pcm_ioctl_channel_info_x32(substream, argp);
648-
#endif /* CONFIG_X86_X32 */
648+
#endif /* CONFIG_X86_X32_ABI */
649649
}
650650

651651
return -ENOIOCTLCMD;

0 commit comments

Comments
 (0)