Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 4691698

Browse files
masahir0ybp3tk0v
authored andcommitted
x86/kconfig: Add as-instr64 macro to properly evaluate AS_WRUSS
Some instructions are only available on the 64-bit architecture. Bi-arch compilers that default to -m32 need the explicit -m64 option to evaluate them properly. Fixes: 18e66b6 ("x86/shstk: Add Kconfig option for shadow stack") Closes: https://lore.kernel.org/all/20240612-as-instr-opt-wrussq-v2-1-bd950f7eead7@gmail.com/ Reported-by: Dmitry Safonov <0x7f454c46@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Tested-by: Dmitry Safonov <0x7f454c46@gmail.com> Link: https://lore.kernel.org/r/20240612050257.3670768-1-masahiroy@kernel.org
1 parent 6ba59ff commit 4691698

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

arch/x86/Kconfig.assembler

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ config AS_VPCLMULQDQ
3636
Supported by binutils >= 2.30 and LLVM integrated assembler
3737

3838
config AS_WRUSS
39-
def_bool $(as-instr,wrussq %rax$(comma)(%rbx))
39+
def_bool $(as-instr64,wrussq %rax$(comma)(%rbx))
4040
help
4141
Supported by binutils >= 2.31 and LLVM integrated assembler

scripts/Kconfig.include

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ ld-option = $(success,$(LD) -v $(1))
3333

3434
# $(as-instr,<instr>)
3535
# Return y if the assembler supports <instr>, n otherwise
36-
as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -Wa$(comma)--fatal-warnings -c -x assembler-with-cpp -o /dev/null -)
36+
as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) $(2) -Wa$(comma)--fatal-warnings -c -x assembler-with-cpp -o /dev/null -)
37+
as-instr64 = $(as-instr,$(1),$(m64-flag))
3738

3839
# check if $(CC) and $(LD) exist
3940
$(error-if,$(failure,command -v $(CC)),C compiler '$(CC)' not found)

0 commit comments

Comments
 (0)