Skip to contentSkip to conversation

compat vdso cleanups

PATCH Applied Nick Desaulniers 4 participants 13 messages Oct 19, 2021 – Oct 21, 2021 arm64

lore
Share & tools
lore
#0 lore raw

v2 cover compat vdso cleanups

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

Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
#1 lore raw

PATCH v2 1/4 arm64: vdso32: drop the test for dmb ishld

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]>

---
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(-)
arch/arm64/include/asm/vdso/compat_barrier.h +1 -1
index 3fd8fd6d8fc2..fb60a88b5ed4 100644
@@ -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)
arch/arm64/kernel/vdso32/Makefile +0 -8
index 3dba0c4f8f42..89299a26638b 100644
@@ -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
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] arm64: vdso32: drop the test for dmb ishld

Quoted 3 lines · Nick Desaulniers

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 :)
Quoted 8 lines

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.

Quoted 6 lines

This also avoids a recursive self reference in a follow up cleanup patch.

Cc Christian Biesinger <[email protected]>
Cc Simon Marchi <[email protected]>

I can also see this instruction in llvmorg-10.0.1.

Quoted 51 lines

---
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(-)
arch/arm64/include/asm/vdso/compat_barrier.h +1 -1
index 3fd8fd6d8fc2..fb60a88b5ed4 100644
@@ -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)
arch/arm64/kernel/vdso32/Makefile +0 -8
index 3dba0c4f8f42..89299a26638b 100644
@@ -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
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Reviewed-by on v2 1/4
#3 lore raw

Re: [PATCH v2 1/4] arm64: vdso32: drop the test for dmb ishld

In reply to Nick Desaulniers
Quoted 3 lines · Nick Desaulniers

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/

Quoted 8 lines

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.

Quoted 6 lines

This also avoids a recursive self reference in a follow up cleanup patch.

Cc Christian Biesinger <[email protected]>
Cc Simon Marchi <[email protected]>

Otherwise:

Quoted 48 lines

---
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(-)
arch/arm64/include/asm/vdso/compat_barrier.h +1 -1
index 3fd8fd6d8fc2..fb60a88b5ed4 100644
@@ -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)
arch/arm64/kernel/vdso32/Makefile +0 -8
index 3dba0c4f8f42..89299a26638b 100644
@@ -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
Signature · 2 lines
Regards,
Vincenzo
#4 lore raw

PATCH v2 2/4 arm64: vdso32: drop test for -march=armv8-a

In reply to Nick Desaulniers

As Arnd points out:
gcc-4.8 already supported -march=armv8, and we require gcc-5.1 now, so both this #if/#else construct and the corresponding "cc32-option,-march=armv8-a" check should be obsolete now.

---
 arch/arm64/include/asm/vdso/compat_barrier.h | 7 -------
 arch/arm64/kernel/vdso32/Makefile            | 8 +-------
 2 files changed, 1 insertion(+), 14 deletions(-)
arch/arm64/include/asm/vdso/compat_barrier.h +0 -7
index fb60a88b5ed4..3ac35f4a667c 100644
@@ -20,16 +20,9 @@
 
 #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
 
-#if __LINUX_ARM_ARCH__ >= 8
 #define aarch32_smp_mb()	dmb(ish)
 #define aarch32_smp_rmb()	dmb(ishld)
 #define aarch32_smp_wmb()	dmb(ishst)
-#else
-#define aarch32_smp_mb()	dmb(ish)
-#define aarch32_smp_rmb()	aarch32_smp_mb()
-#define aarch32_smp_wmb()	dmb(ishst)
-#endif
-
 
 #undef smp_mb
 #undef smp_rmb
arch/arm64/kernel/vdso32/Makefile +1 -7
index 89299a26638b..1407516e041e 100644
@@ -65,13 +65,7 @@ endif
 # From arm vDSO Makefile
 VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector
 VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING
-
-
-# Try to compile for ARMv8. If the compiler is too old and doesn't support it,
-# fall back to v7. There is no easy way to check for what architecture the code
-# is being compiled, so define a macro specifying that (see arch/arm/Makefile).
-VDSO_CAFLAGS += $(call cc32-option,-march=armv8-a -D__LINUX_ARM_ARCH__=8,\
-                                   -march=armv7-a -D__LINUX_ARM_ARCH__=7)
+VDSO_CAFLAGS += -march=armv8-a
 
 VDSO_CFLAGS := $(VDSO_CAFLAGS)
 VDSO_CFLAGS += -DENABLE_COMPAT_VDSO=1
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Reviewed-by on v2 2/4
#5 lore raw

Re: [PATCH v2 2/4] arm64: vdso32: drop test for -march=armv8-a

Quoted 8 lines · Nick Desaulniers

As Arnd points out:
gcc-4.8 already supported -march=armv8, and we require gcc-5.1 now, so both this #if/#else construct and the corresponding "cc32-option,-march=armv8-a" check should be obsolete now.

Quoted 49 lines
---
 arch/arm64/include/asm/vdso/compat_barrier.h | 7 -------
 arch/arm64/kernel/vdso32/Makefile            | 8 +-------
 2 files changed, 1 insertion(+), 14 deletions(-)
arch/arm64/include/asm/vdso/compat_barrier.h +0 -7
index fb60a88b5ed4..3ac35f4a667c 100644
@@ -20,16 +20,9 @@
 
 #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
 
-#if __LINUX_ARM_ARCH__ >= 8
 #define aarch32_smp_mb()	dmb(ish)
 #define aarch32_smp_rmb()	dmb(ishld)
 #define aarch32_smp_wmb()	dmb(ishst)
-#else
-#define aarch32_smp_mb()	dmb(ish)
-#define aarch32_smp_rmb()	aarch32_smp_mb()
-#define aarch32_smp_wmb()	dmb(ishst)
-#endif
-
 
 #undef smp_mb
 #undef smp_rmb
arch/arm64/kernel/vdso32/Makefile +1 -7
index 89299a26638b..1407516e041e 100644
@@ -65,13 +65,7 @@ endif
 # From arm vDSO Makefile
 VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector
 VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING
-
-
-# Try to compile for ARMv8. If the compiler is too old and doesn't support it,
-# fall back to v7. There is no easy way to check for what architecture the code
-# is being compiled, so define a macro specifying that (see arch/arm/Makefile).
-VDSO_CAFLAGS += $(call cc32-option,-march=armv8-a -D__LINUX_ARM_ARCH__=8,\
-                                   -march=armv7-a -D__LINUX_ARM_ARCH__=7)
+VDSO_CAFLAGS += -march=armv8-a
 
 VDSO_CFLAGS := $(VDSO_CAFLAGS)
 VDSO_CFLAGS += -DENABLE_COMPAT_VDSO=1
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Reviewed-by on v2 2/4
#6 lore raw

Re: [PATCH v2 2/4] arm64: vdso32: drop test for -march=armv8-a

In reply to Nick Desaulniers
Quoted 8 lines · Nick Desaulniers

As Arnd points out:
gcc-4.8 already supported -march=armv8, and we require gcc-5.1 now, so both this #if/#else construct and the corresponding "cc32-option,-march=armv8-a" check should be obsolete now.

Quoted 46 lines
---
 arch/arm64/include/asm/vdso/compat_barrier.h | 7 -------
 arch/arm64/kernel/vdso32/Makefile            | 8 +-------
 2 files changed, 1 insertion(+), 14 deletions(-)
arch/arm64/include/asm/vdso/compat_barrier.h +0 -7
index fb60a88b5ed4..3ac35f4a667c 100644
@@ -20,16 +20,9 @@
 
 #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
 
-#if __LINUX_ARM_ARCH__ >= 8
 #define aarch32_smp_mb()	dmb(ish)
 #define aarch32_smp_rmb()	dmb(ishld)
 #define aarch32_smp_wmb()	dmb(ishst)
-#else
-#define aarch32_smp_mb()	dmb(ish)
-#define aarch32_smp_rmb()	aarch32_smp_mb()
-#define aarch32_smp_wmb()	dmb(ishst)
-#endif
-
 
 #undef smp_mb
 #undef smp_rmb
arch/arm64/kernel/vdso32/Makefile +1 -7
index 89299a26638b..1407516e041e 100644
@@ -65,13 +65,7 @@ endif
 # From arm vDSO Makefile
 VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector
 VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING
-
-
-# Try to compile for ARMv8. If the compiler is too old and doesn't support it,
-# fall back to v7. There is no easy way to check for what architecture the code
-# is being compiled, so define a macro specifying that (see arch/arm/Makefile).
-VDSO_CAFLAGS += $(call cc32-option,-march=armv8-a -D__LINUX_ARM_ARCH__=8,\
-                                   -march=armv7-a -D__LINUX_ARM_ARCH__=7)
+VDSO_CAFLAGS += -march=armv8-a
 
 VDSO_CFLAGS := $(VDSO_CAFLAGS)
 VDSO_CFLAGS += -DENABLE_COMPAT_VDSO=1
Signature · 2 lines
Regards,
Vincenzo
#7 lore raw

PATCH v2 3/4 arm64: vdso32: suppress error message for 'make mrproper'

In reply to Nick Desaulniers

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'")

---
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(-)
arch/arm64/kernel/vdso32/Makefile +2 -1
index 1407516e041e..e478cebb9891 100644
@@ -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
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Reviewed-by Tested-by on v2 3/4
#8 lore raw

Re: [PATCH v2 3/4] arm64: vdso32: suppress error message for 'make mrproper'

Quoted 10 lines · Nick Desaulniers

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.

Quoted 6 lines

This is a similar problem to what was observed in
commit dc960bfeedb0 ("h8300: suppress error messages for 'make clean'")

Quoted 28 lines

---
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(-)
arch/arm64/kernel/vdso32/Makefile +2 -1
index 1407516e041e..e478cebb9891 100644
@@ -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
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Reviewed-by on v2 3/4
#9 lore raw

Re: [PATCH v2 3/4] arm64: vdso32: suppress error message for 'make mrproper'

In reply to Nick Desaulniers
Quoted 10 lines · Nick Desaulniers

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.

Quoted 6 lines

This is a similar problem to what was observed in
commit dc960bfeedb0 ("h8300: suppress error messages for 'make clean'")

Quoted 25 lines

---
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(-)
arch/arm64/kernel/vdso32/Makefile +2 -1
index 1407516e041e..e478cebb9891 100644
@@ -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
Signature · 2 lines
Regards,
Vincenzo
#10 lore raw

PATCH v2 4/4 arm64: vdso32: require CROSS_COMPILE_COMPAT for gcc+bfd

In reply to Nick Desaulniers

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

---
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(-)
arch/arm64/Kconfig +2 -1
index 5c7ae4c3954b..f0f2c95aa4c8 100644
@@ -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
arch/arm64/kernel/vdso32/Makefile +5 -12
index e478cebb9891..c8fec493a450 100644
@@ -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
Signature · 1 line
2.33.0.1079.g6e70778dc9-goog
Reviewed-by on v2 4/4
#11 lore raw

Re: [PATCH v2 4/4] arm64: vdso32: require CROSS_COMPILE_COMPAT for gcc+bfd

Quoted 26 lines · Nick Desaulniers

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
Quoted 4 lines
Quoted 64 lines

---
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(-)
arch/arm64/Kconfig +2 -1
index 5c7ae4c3954b..f0f2c95aa4c8 100644
@@ -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
arch/arm64/kernel/vdso32/Makefile +5 -12
index e478cebb9891..c8fec493a450 100644
@@ -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
Signature · 2 lines
Regards,
Vincenzo
maintainer Applied
#12 lore raw
In reply to Nick Desaulniers
Quoted 10 lines · Nick Desaulniers

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,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev