Four fixes for compat vdso, the first three are related, the fourth is
standalone.
The first three fix a warning observed for `mrproper` targets when
$(CROSS_COMPILE_COMPAT)gcc is not in the $PATH.
The fourth makes is so that CROSS_COMPILE_COMPAT is not necessary to
select COMPAT_VDSO when using clang+lld.
Based on arm64/linux.git/for-next/misc.
Changes v1 -> v2:
* Fix binutils version numbers in 1/4 as per Christian.
* Add new patch 2/4 as per Arnd.
* Rewrite 3/4 to use redirection of stderr to /dev/null, as per
Masahiro.
* Add parens and update commit message of 4/4 as per Nathan.
Nick Desaulniers (4):
arm64: vdso32: drop the test for dmb ishld
arm64: vdso32: drop test for -march=armv8-a
arm64: vdso32: suppress error message for 'make mrproper'
arm64: vdso32: require CROSS_COMPILE_COMPAT for gcc+bfd
arch/arm64/Kconfig | 3 +-
arch/arm64/include/asm/vdso/compat_barrier.h | 7 ----
arch/arm64/kernel/vdso32/Makefile | 36 +++++---------------
3 files changed, 10 insertions(+), 36 deletions(-)
base-commit: de56379f21c70196ff18c48790e8e43865893869
--
2.33.0.1079.g6e70778dc9-goog
When running the following command without arm-linux-gnueabi-gcc in
one's $PATH, the following warning is observed:
$ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper
make[1]: arm-linux-gnueabi-gcc: No such file or directory
This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG
is not set, and we end up eagerly evaluating various variables that try
to invoke CC_COMPAT.
This is a similar problem to what was observed in
commit dc960bfeedb0 ("h8300: suppress error messages for 'make clean'")
Reported-by: Lucas Henneman <[email protected]>
Suggested-by: Masahiro Yamada <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
---
Changes v1 -> v2:
* Change to suppressing via redirecting stderr to /dev/null, as per
Masahiro.
* Add Masahiro's SB tag.
* Cite dc960bfeedb0.
arch/arm64/kernel/vdso32/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 1407516e041e..e478cebb9891 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -38,7 +38,8 @@ cc32-disable-warning = $(call try-run,\
# As a result we set our own flags here.
# KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
-VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
+VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc
+VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include 2>/dev/null)
VDSO_CPPFLAGS += $(LINUXINCLUDE)
# Common C and assembly flags
--
2.33.0.1079.g6e70778dc9-goog
Binutils added support for this instruction in commit
e797f7e0b2bedc9328d4a9a0ebc63ca7a2dbbebc which shipped in 2.24 (just
missing the 2.33 release) but was cherry-picked into 2.23 in commit
27a50d6755bae906bc73b4ec1a8b448467f0bea1. Thanks to Christian and Simon
for helping me with the patch archaeology.
According to Documentation/process/changes.rst, the minimum supported
version of binutils is 2.23. Since all supported versions of GAS support
this instruction, drop the assembler invocation, preprocessor
flags/guards, and the cross assembler macro that's now unused.
This also avoids a recursive self reference in a follow up cleanup
patch.
Cc: Christian Biesinger <[email protected]>
Cc: Simon Marchi <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
---
Changes v1 -> v2:
* Fix typos (2.33 -> 2.23, 2.34 -> 2.24) as per Christian.
arch/arm64/include/asm/vdso/compat_barrier.h | 2 +-
arch/arm64/kernel/vdso32/Makefile | 8 --------
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h
index 3fd8fd6d8fc2..fb60a88b5ed4 100644
--- a/arch/arm64/include/asm/vdso/compat_barrier.h
+++ b/arch/arm64/include/asm/vdso/compat_barrier.h
@@ -20,7 +20,7 @@
#define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
-#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD)
+#if __LINUX_ARM_ARCH__ >= 8
#define aarch32_smp_mb() dmb(ish)
#define aarch32_smp_rmb() dmb(ishld)
#define aarch32_smp_wmb() dmb(ishst)
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 3dba0c4f8f42..89299a26638b 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -29,8 +29,6 @@ cc32-option = $(call try-run,\
$(CC_COMPAT) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
cc32-disable-warning = $(call try-run,\
$(CC_COMPAT) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
-cc32-as-instr = $(call try-run,\
- printf "%b\n" "$(1)" | $(CC_COMPAT) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
# We cannot use the global flags to compile the vDSO files, the main reason
# being that the 32-bit compiler may be older than the main (64-bit) compiler
@@ -113,12 +111,6 @@ endif
VDSO_AFLAGS := $(VDSO_CAFLAGS)
VDSO_AFLAGS += -D__ASSEMBLY__
-# Check for binutils support for dmb ishld
-dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1)
-
-VDSO_CFLAGS += $(dmbinstr)
-VDSO_AFLAGS += $(dmbinstr)
-
# From arm vDSO Makefile
VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
--
2.33.0.1079.g6e70778dc9-goog
Similar to
commit 231ad7f409f1 ("Makefile: infer --target from ARCH for CC=clang")
There really is no point in setting --target based on
$CROSS_COMPILE_COMPAT for clang when the integrated assembler is being
used, since
commit ef94340583ee ("arm64: vdso32: drop -no-integrated-as flag").
Allows COMPAT_VDSO to be selected without setting $CROSS_COMPILE_COMPAT
when using clang and lld together.
Before:
$ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 defconfig
$ grep CONFIG_COMPAT_VDSO .config
CONFIG_COMPAT_VDSO=y
$ ARCH=arm64 make -j72 LLVM=1 defconfig
$ grep CONFIG_COMPAT_VDSO .config
$
After:
$ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 defconfig
$ grep CONFIG_COMPAT_VDSO .config
CONFIG_COMPAT_VDSO=y
$ ARCH=arm64 make -j72 LLVM=1 defconfig
$ grep CONFIG_COMPAT_VDSO .config
CONFIG_COMPAT_VDSO=y
Reviewed-by: Nathan Chancellor <[email protected]>
Suggested-by: Nathan Chancellor <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
---
Changes v1 -> v2:
* Cite ef94340583ee as per Nathan.
* Add parens to Kconfig expression as per Nathan.
* Pick up Nathan's RB, TB, and SB tags.
arch/arm64/Kconfig | 3 ++-
arch/arm64/kernel/vdso32/Makefile | 17 +++++------------
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 5c7ae4c3954b..f0f2c95aa4c8 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1264,7 +1264,8 @@ config KUSER_HELPERS
config COMPAT_VDSO
bool "Enable vDSO for 32-bit applications"
- depends on !CPU_BIG_ENDIAN && "$(CROSS_COMPILE_COMPAT)" != ""
+ depends on !CPU_BIG_ENDIAN
+ depends on (CC_IS_CLANG && LD_IS_LLD) || "$(CROSS_COMPILE_COMPAT)" != ""
select GENERIC_COMPAT_VDSO
default y
help
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index e478cebb9891..c8fec493a450 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -10,18 +10,15 @@ include $(srctree)/lib/vdso/Makefile
# Same as cc-*option, but using CC_COMPAT instead of CC
ifeq ($(CONFIG_CC_IS_CLANG), y)
-CC_COMPAT_CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
-
CC_COMPAT ?= $(CC)
-CC_COMPAT += $(CC_COMPAT_CLANG_FLAGS)
-
-ifneq ($(LLVM),)
-LD_COMPAT ?= $(LD)
+CC_COMPAT += --target=arm-linux-gnueabi
else
-LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld
+CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
endif
+
+ifeq ($(CONFIG_LD_IS_LLD), y)
+LD_COMPAT ?= $(LD)
else
-CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld
endif
@@ -45,10 +42,6 @@ VDSO_CPPFLAGS += $(LINUXINCLUDE)
# Common C and assembly flags
# From top-level Makefile
VDSO_CAFLAGS := $(VDSO_CPPFLAGS)
-ifneq ($(shell $(CC_COMPAT) --version 2>&1 | head -n 1 | grep clang),)
-VDSO_CAFLAGS += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
-endif
-
VDSO_CAFLAGS += $(call cc32-option,-fno-PIE)
ifdef CONFIG_DEBUG_INFO
VDSO_CAFLAGS += -g
--
2.33.0.1079.g6e70778dc9-goog
On Tue, Oct 19, 2021 at 03:36:43PM -0700, Nick Desaulniers wrote:
> Binutils added support for this instruction in commit
> e797f7e0b2bedc9328d4a9a0ebc63ca7a2dbbebc which shipped in 2.24 (just
> missing the 2.33 release) but was cherry-picked into 2.23 in commit
^ 2.23, almost :)
> 27a50d6755bae906bc73b4ec1a8b448467f0bea1. Thanks to Christian and Simon
> for helping me with the patch archaeology.
>
> According to Documentation/process/changes.rst, the minimum supported
> version of binutils is 2.23. Since all supported versions of GAS support
> this instruction, drop the assembler invocation, preprocessor
> flags/guards, and the cross assembler macro that's now unused.
>
> This also avoids a recursive self reference in a follow up cleanup
> patch.
>
> Cc: Christian Biesinger <[email protected]>
> Cc: Simon Marchi <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
I can also see this instruction in llvmorg-10.0.1.
Reviewed-by: Nathan Chancellor <[email protected]>
> ---
> Changes v1 -> v2:
> * Fix typos (2.33 -> 2.23, 2.34 -> 2.24) as per Christian.
>
> arch/arm64/include/asm/vdso/compat_barrier.h | 2 +-
> arch/arm64/kernel/vdso32/Makefile | 8 --------
> 2 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h
> index 3fd8fd6d8fc2..fb60a88b5ed4 100644
> --- a/arch/arm64/include/asm/vdso/compat_barrier.h
> +++ b/arch/arm64/include/asm/vdso/compat_barrier.h
> @@ -20,7 +20,7 @@
>
> #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
>
> -#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD)
> +#if __LINUX_ARM_ARCH__ >= 8
> #define aarch32_smp_mb() dmb(ish)
> #define aarch32_smp_rmb() dmb(ishld)
> #define aarch32_smp_wmb() dmb(ishst)
> diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
> index 3dba0c4f8f42..89299a26638b 100644
> --- a/arch/arm64/kernel/vdso32/Makefile
> +++ b/arch/arm64/kernel/vdso32/Makefile
> @@ -29,8 +29,6 @@ cc32-option = $(call try-run,\
> $(CC_COMPAT) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
> cc32-disable-warning = $(call try-run,\
> $(CC_COMPAT) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
> -cc32-as-instr = $(call try-run,\
> - printf "%b\n" "$(1)" | $(CC_COMPAT) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
>
> # We cannot use the global flags to compile the vDSO files, the main reason
> # being that the 32-bit compiler may be older than the main (64-bit) compiler
> @@ -113,12 +111,6 @@ endif
> VDSO_AFLAGS := $(VDSO_CAFLAGS)
> VDSO_AFLAGS += -D__ASSEMBLY__
>
> -# Check for binutils support for dmb ishld
> -dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1)
> -
> -VDSO_CFLAGS += $(dmbinstr)
> -VDSO_AFLAGS += $(dmbinstr)
> -
> # From arm vDSO Makefile
> VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
> VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
> --
> 2.33.0.1079.g6e70778dc9-goog
>
>
On Tue, Oct 19, 2021 at 03:36:45PM -0700, Nick Desaulniers wrote:
> When running the following command without arm-linux-gnueabi-gcc in
> one's $PATH, the following warning is observed:
>
> $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper
> make[1]: arm-linux-gnueabi-gcc: No such file or directory
>
> This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG
> is not set, and we end up eagerly evaluating various variables that try
> to invoke CC_COMPAT.
>
> This is a similar problem to what was observed in
> commit dc960bfeedb0 ("h8300: suppress error messages for 'make clean'")
>
> Reported-by: Lucas Henneman <[email protected]>
> Suggested-by: Masahiro Yamada <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>
> ---
> Changes v1 -> v2:
> * Change to suppressing via redirecting stderr to /dev/null, as per
> Masahiro.
> * Add Masahiro's SB tag.
> * Cite dc960bfeedb0.
>
> arch/arm64/kernel/vdso32/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
> index 1407516e041e..e478cebb9891 100644
> --- a/arch/arm64/kernel/vdso32/Makefile
> +++ b/arch/arm64/kernel/vdso32/Makefile
> @@ -38,7 +38,8 @@ cc32-disable-warning = $(call try-run,\
> # As a result we set our own flags here.
>
> # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
> -VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
> +VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc
> +VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include 2>/dev/null)
> VDSO_CPPFLAGS += $(LINUXINCLUDE)
>
> # Common C and assembly flags
> --
> 2.33.0.1079.g6e70778dc9-goog
>
>
On 10/20/21 12:36 AM, Nick Desaulniers wrote:
> Binutils added support for this instruction in commit
> e797f7e0b2bedc9328d4a9a0ebc63ca7a2dbbebc which shipped in 2.24 (just
> missing the 2.33 release) but was cherry-picked into 2.23 in commit
s/just missing the 2.33 release/just missing the 2.23 release/
> 27a50d6755bae906bc73b4ec1a8b448467f0bea1. Thanks to Christian and Simon
> for helping me with the patch archaeology.
>
> According to Documentation/process/changes.rst, the minimum supported
> version of binutils is 2.23. Since all supported versions of GAS support
> this instruction, drop the assembler invocation, preprocessor
> flags/guards, and the cross assembler macro that's now unused.
>
> This also avoids a recursive self reference in a follow up cleanup
> patch.
>
> Cc: Christian Biesinger <[email protected]>
> Cc: Simon Marchi <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
Otherwise:
Reviewed-by: Vincenzo Frascino <[email protected]>
> ---
> Changes v1 -> v2:
> * Fix typos (2.33 -> 2.23, 2.34 -> 2.24) as per Christian.
>
> arch/arm64/include/asm/vdso/compat_barrier.h | 2 +-
> arch/arm64/kernel/vdso32/Makefile | 8 --------
> 2 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h
> index 3fd8fd6d8fc2..fb60a88b5ed4 100644
> --- a/arch/arm64/include/asm/vdso/compat_barrier.h
> +++ b/arch/arm64/include/asm/vdso/compat_barrier.h
> @@ -20,7 +20,7 @@
>
> #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
>
> -#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD)
> +#if __LINUX_ARM_ARCH__ >= 8
> #define aarch32_smp_mb() dmb(ish)
> #define aarch32_smp_rmb() dmb(ishld)
> #define aarch32_smp_wmb() dmb(ishst)
> diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
> index 3dba0c4f8f42..89299a26638b 100644
> --- a/arch/arm64/kernel/vdso32/Makefile
> +++ b/arch/arm64/kernel/vdso32/Makefile
> @@ -29,8 +29,6 @@ cc32-option = $(call try-run,\
> $(CC_COMPAT) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
> cc32-disable-warning = $(call try-run,\
> $(CC_COMPAT) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
> -cc32-as-instr = $(call try-run,\
> - printf "%b\n" "$(1)" | $(CC_COMPAT) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
>
> # We cannot use the global flags to compile the vDSO files, the main reason
> # being that the 32-bit compiler may be older than the main (64-bit) compiler
> @@ -113,12 +111,6 @@ endif
> VDSO_AFLAGS := $(VDSO_CAFLAGS)
> VDSO_AFLAGS += -D__ASSEMBLY__
>
> -# Check for binutils support for dmb ishld
> -dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1)
> -
> -VDSO_CFLAGS += $(dmbinstr)
> -VDSO_AFLAGS += $(dmbinstr)
> -
> # From arm vDSO Makefile
> VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
> VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
>
--
Regards,
Vincenzo
On 10/20/21 12:36 AM, Nick Desaulniers wrote:
> When running the following command without arm-linux-gnueabi-gcc in
> one's $PATH, the following warning is observed:
>
> $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper
> make[1]: arm-linux-gnueabi-gcc: No such file or directory
>
> This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG
> is not set, and we end up eagerly evaluating various variables that try
> to invoke CC_COMPAT.
>
> This is a similar problem to what was observed in
> commit dc960bfeedb0 ("h8300: suppress error messages for 'make clean'")
>
> Reported-by: Lucas Henneman <[email protected]>
> Suggested-by: Masahiro Yamada <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
Reviewed-by: Vincenzo Frascino <[email protected]>
> ---
> Changes v1 -> v2:
> * Change to suppressing via redirecting stderr to /dev/null, as per
> Masahiro.
> * Add Masahiro's SB tag.
> * Cite dc960bfeedb0.
>
> arch/arm64/kernel/vdso32/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
> index 1407516e041e..e478cebb9891 100644
> --- a/arch/arm64/kernel/vdso32/Makefile
> +++ b/arch/arm64/kernel/vdso32/Makefile
> @@ -38,7 +38,8 @@ cc32-disable-warning = $(call try-run,\
> # As a result we set our own flags here.
>
> # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile
> -VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include)
> +VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc
> +VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include 2>/dev/null)
> VDSO_CPPFLAGS += $(LINUXINCLUDE)
>
> # Common C and assembly flags
>
--
Regards,
Vincenzo
On 10/20/21 12:36 AM, Nick Desaulniers wrote:
> Similar to
> commit 231ad7f409f1 ("Makefile: infer --target from ARCH for CC=clang")
> There really is no point in setting --target based on
> $CROSS_COMPILE_COMPAT for clang when the integrated assembler is being
> used, since
> commit ef94340583ee ("arm64: vdso32: drop -no-integrated-as flag").
>
> Allows COMPAT_VDSO to be selected without setting $CROSS_COMPILE_COMPAT
> when using clang and lld together.
>
> Before:
> $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 defconfig
> $ grep CONFIG_COMPAT_VDSO .config
> CONFIG_COMPAT_VDSO=y
> $ ARCH=arm64 make -j72 LLVM=1 defconfig
> $ grep CONFIG_COMPAT_VDSO .config
> $
>
> After:
> $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 defconfig
> $ grep CONFIG_COMPAT_VDSO .config
> CONFIG_COMPAT_VDSO=y
> $ ARCH=arm64 make -j72 LLVM=1 defconfig
> $ grep CONFIG_COMPAT_VDSO .config
> CONFIG_COMPAT_VDSO=y
>
> Reviewed-by: Nathan Chancellor <[email protected]>
> Suggested-by: Nathan Chancellor <[email protected]>
> Tested-by: Nathan Chancellor <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
Reviewed-by: Vincenzo Frascino <[email protected]>
> ---
> Changes v1 -> v2:
> * Cite ef94340583ee as per Nathan.
> * Add parens to Kconfig expression as per Nathan.
> * Pick up Nathan's RB, TB, and SB tags.
>
> arch/arm64/Kconfig | 3 ++-
> arch/arm64/kernel/vdso32/Makefile | 17 +++++------------
> 2 files changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 5c7ae4c3954b..f0f2c95aa4c8 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1264,7 +1264,8 @@ config KUSER_HELPERS
>
> config COMPAT_VDSO
> bool "Enable vDSO for 32-bit applications"
> - depends on !CPU_BIG_ENDIAN && "$(CROSS_COMPILE_COMPAT)" != ""
> + depends on !CPU_BIG_ENDIAN
> + depends on (CC_IS_CLANG && LD_IS_LLD) || "$(CROSS_COMPILE_COMPAT)" != ""
> select GENERIC_COMPAT_VDSO
> default y
> help
> diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
> index e478cebb9891..c8fec493a450 100644
> --- a/arch/arm64/kernel/vdso32/Makefile
> +++ b/arch/arm64/kernel/vdso32/Makefile
> @@ -10,18 +10,15 @@ include $(srctree)/lib/vdso/Makefile
>
> # Same as cc-*option, but using CC_COMPAT instead of CC
> ifeq ($(CONFIG_CC_IS_CLANG), y)
> -CC_COMPAT_CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
> -
> CC_COMPAT ?= $(CC)
> -CC_COMPAT += $(CC_COMPAT_CLANG_FLAGS)
> -
> -ifneq ($(LLVM),)
> -LD_COMPAT ?= $(LD)
> +CC_COMPAT += --target=arm-linux-gnueabi
> else
> -LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld
> +CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
> endif
> +
> +ifeq ($(CONFIG_LD_IS_LLD), y)
> +LD_COMPAT ?= $(LD)
> else
> -CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
> LD_COMPAT ?= $(CROSS_COMPILE_COMPAT)ld
> endif
>
> @@ -45,10 +42,6 @@ VDSO_CPPFLAGS += $(LINUXINCLUDE)
> # Common C and assembly flags
> # From top-level Makefile
> VDSO_CAFLAGS := $(VDSO_CPPFLAGS)
> -ifneq ($(shell $(CC_COMPAT) --version 2>&1 | head -n 1 | grep clang),)
> -VDSO_CAFLAGS += --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
> -endif
> -
> VDSO_CAFLAGS += $(call cc32-option,-fno-PIE)
> ifdef CONFIG_DEBUG_INFO
> VDSO_CAFLAGS += -g
>
--
Regards,
Vincenzo
On Tue, 19 Oct 2021 15:36:42 -0700, Nick Desaulniers wrote:
> Four fixes for compat vdso, the first three are related, the fourth is
> standalone.
>
> The first three fix a warning observed for `mrproper` targets when
> $(CROSS_COMPILE_COMPAT)gcc is not in the $PATH.
>
> The fourth makes is so that CROSS_COMPILE_COMPAT is not necessary to
> select COMPAT_VDSO when using clang+lld.
>
> [...]
Applied to arm64 (for-next/vdso), thanks!
[1/4] arm64: vdso32: drop the test for dmb ishld
https://git.kernel.org/arm64/c/1907d3ff5a64
[2/4] arm64: vdso32: drop test for -march=armv8-a
https://git.kernel.org/arm64/c/a517faa902b5
[3/4] arm64: vdso32: suppress error message for 'make mrproper'
https://git.kernel.org/arm64/c/14831fad73f5
[4/4] arm64: vdso32: require CROSS_COMPILE_COMPAT for gcc+bfd
https://git.kernel.org/arm64/c/3e6f8d1fa184
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev