Skip to contentSkip to conversation

x86: vdso: clean up vdso Makefile

PATCH Applied Masahiro Yamada 3 participants 11 messages Nov 21, 2023 – Feb 8, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover x86: vdso: clean up vdso Makefile

Masahiro Yamada (4):
x86: vdso: consolidate targets and clean-files
x86: vdso: simplify obj-y addition
x86: vdso: use $(addprefix ) instead of $(foreach )
x86: vdso: use CONFIG_COMPAT_32 to specify vdso32

 arch/x86/Makefile            |  3 +--
 arch/x86/entry/vdso/Makefile | 28 +++++++---------------------
 2 files changed, 8 insertions(+), 23 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/4 x86: vdso: consolidate targets and clean-files

'targets' and 'clean-files' do not need to list the same files because the files listed in 'targets' are cleaned up.

Refactor the code.

---

 arch/x86/entry/vdso/Makefile | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
arch/x86/entry/vdso/Makefile +1 -6
index b1b8dd1608f7..2038d9c8e527 100644
@@ -55,11 +55,8 @@ targets += vdso32/vdso32.lds $(vobjs32-y)
 
 # Build the vDSO image C files and link them in.
 vdso_img_objs := $(vdso_img-y:%=vdso-image-%.o)
-vdso_img_cfiles := $(vdso_img-y:%=vdso-image-%.c)
-vdso_img_sodbg := $(vdso_img-y:%=vdso%.so.dbg)
 obj-y += $(vdso_img_objs)
-targets += $(vdso_img_cfiles)
-targets += $(vdso_img_sodbg) $(vdso_img-y:%=vdso%.so)
+targets += $(foreach x, 64 x32 32, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg)
 
 CPPFLAGS_vdso.lds += -P -C
 
@@ -190,5 +187,3 @@ GCOV_PROFILE := n
 
 quiet_cmd_vdso_and_check = VDSO    $@
       cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check)
-
-clean-files := vdso32.so vdso32.so.dbg vdso64* vdso-image-*.c vdsox32.so*
Signature · 1 line
2.40.1
#3 lore raw

PATCH 2/4 x86: vdso: simplify obj-y addition

In reply to Masahiro Yamada

Add objects to obj-y in a more straightforward way.

CONFIG_X86_32 and CONFIG_IA32_EMULATION are not enabled simultaneously, but even if they are, Kbuild graciously deduplicates obj-y entries.

---

 arch/x86/entry/vdso/Makefile | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
arch/x86/entry/vdso/Makefile +4 -12
index 2038d9c8e527..cbfb5aab5e9c 100644
@@ -18,11 +18,6 @@ OBJECT_FILES_NON_STANDARD	:= y
 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
 KCOV_INSTRUMENT		:= n
 
-VDSO64-$(CONFIG_X86_64)		:= y
-VDSOX32-$(CONFIG_X86_X32_ABI)	:= y
-VDSO32-$(CONFIG_X86_32)		:= y
-VDSO32-$(CONFIG_IA32_EMULATION)	:= y
-
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
 vobjs32-y := vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
@@ -38,11 +33,11 @@ OBJECT_FILES_NON_STANDARD_vma.o		:= n
 OBJECT_FILES_NON_STANDARD_extable.o	:= n
 
 # vDSO images to build
-vdso_img-$(VDSO64-y)		+= 64
-vdso_img-$(VDSOX32-y)		+= x32
-vdso_img-$(VDSO32-y)		+= 32
+obj-$(CONFIG_X86_64)		+= vdso-image-64.o
+obj-$(CONFIG_X86_X32_ABI)	+= vdso-image-x32.o
+obj-$(CONFIG_X86_32)		+= vdso-image-32.o vdso32-setup.o
+obj-$(CONFIG_IA32_EMULATION)	+= vdso-image-32.o vdso32-setup.o
 
-obj-$(VDSO32-y)				 += vdso32-setup.o
 OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n
 
 vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
@@ -53,9 +48,6 @@ $(obj)/vdso.o: $(obj)/vdso.so
 targets += vdso.lds $(vobjs-y)
 targets += vdso32/vdso32.lds $(vobjs32-y)
 
-# Build the vDSO image C files and link them in.
-vdso_img_objs := $(vdso_img-y:%=vdso-image-%.o)
-obj-y += $(vdso_img_objs)
 targets += $(foreach x, 64 x32 32, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg)
 
 CPPFLAGS_vdso.lds += -P -C
Signature · 1 line
2.40.1
#5 lore raw

PATCH 3/4 x86: vdso: use $(addprefix ) instead of $(foreach )

In reply to Masahiro Yamada

$(addprefix ) is slightly shorter and more intuitive.

---

 arch/x86/entry/vdso/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/entry/vdso/Makefile +3 -3
index cbfb5aab5e9c..439b52772e69 100644
@@ -40,8 +40,8 @@ obj-$(CONFIG_IA32_EMULATION)	+= vdso-image-32.o vdso32-setup.o
 
 OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n
 
-vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
-vobjs32 := $(foreach F,$(vobjs32-y),$(obj)/$F)
+vobjs := $(addprefix $(obj)/, $(vobjs-y))
+vobjs32 := $(addprefix $(obj)/, $(vobjs32-y))
 
 $(obj)/vdso.o: $(obj)/vdso.so
 
@@ -112,7 +112,7 @@ VDSO_LDFLAGS_vdsox32.lds = -m elf32_x86_64 -soname linux-vdso.so.1 \
 vobjx32s-y := $(vobjs-y:.o=-x32.o)
 
 # same thing, but in the output directory
-vobjx32s := $(foreach F,$(vobjx32s-y),$(obj)/$F)
+vobjx32s := $(addprefix $(obj)/, $(vobjx32s-y))
 
 # Convert 64bit object file to x32 for x32 vDSO.
 quiet_cmd_x32 = X32     $@
Signature · 1 line
2.40.1
#7 lore raw

PATCH 4/4 x86: vdso: use CONFIG_COMPAT_32 to specify vdso32

In reply to Masahiro Yamada

In arch/x86/Kconfig, COMPAT_32 is defined as (IA32_EMULATION || X86_32). Use it to eliminate redundancy in Makefile.

---

 arch/x86/Makefile            | 3 +--
 arch/x86/entry/vdso/Makefile | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/x86/Makefile +1 -2
index 1a068de12a56..0899e71ddcc6 100644
@@ -296,8 +296,7 @@ install:
 
 vdso-install-$(CONFIG_X86_64)		+= arch/x86/entry/vdso/vdso64.so.dbg
 vdso-install-$(CONFIG_X86_X32_ABI)	+= arch/x86/entry/vdso/vdsox32.so.dbg
-vdso-install-$(CONFIG_X86_32)		+= arch/x86/entry/vdso/vdso32.so.dbg
-vdso-install-$(CONFIG_IA32_EMULATION)	+= arch/x86/entry/vdso/vdso32.so.dbg
+vdso-install-$(CONFIG_COMPAT_32)	+= arch/x86/entry/vdso/vdso32.so.dbg
 
 archprepare: checkbin
 checkbin:
arch/x86/entry/vdso/Makefile +1 -2
index 439b52772e69..7a97b17f28b7 100644
@@ -35,8 +35,7 @@ OBJECT_FILES_NON_STANDARD_extable.o	:= n
 # vDSO images to build
 obj-$(CONFIG_X86_64)		+= vdso-image-64.o
 obj-$(CONFIG_X86_X32_ABI)	+= vdso-image-x32.o
-obj-$(CONFIG_X86_32)		+= vdso-image-32.o vdso32-setup.o
-obj-$(CONFIG_IA32_EMULATION)	+= vdso-image-32.o vdso32-setup.o
+obj-$(CONFIG_COMPAT_32)		+= vdso-image-32.o vdso32-setup.o
 
 OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n
 
Signature · 1 line
2.40.1
#9 lore raw
In reply to Masahiro Yamada

Hi x86 maintainers,

Gentle ping.

It has been more than 2 months since the submission.

Quoted 17 lines · Masahiro Yamada

Masahiro Yamada (4):
x86: vdso: consolidate targets and clean-files
x86: vdso: simplify obj-y addition
x86: vdso: use $(addprefix ) instead of $(foreach )
x86: vdso: use CONFIG_COMPAT_32 to specify vdso32

 arch/x86/Makefile            |  3 +--
 arch/x86/entry/vdso/Makefile | 28 +++++++---------------------
 2 files changed, 8 insertions(+), 23 deletions(-)

--
2.40.1

Signature · 2 lines
Best Regards
Masahiro Yamada
maintainer
#10 lore raw
Quoted 6 lines · Masahiro Yamada

Hi x86 maintainers,

Gentle ping.

It has been more than 2 months since the submission.

Lemme have a look.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#8 lore raw

[tip: x86/vdso] x86/vdso: Use CONFIG_COMPAT_32 to specify vdso32

In reply to Masahiro Yamada
The following commit has been merged into the x86/vdso branch of tip:

The following commit has been merged into the x86/vdso branch of tip:

Commit-ID:     289d0a475c3e5be42315376d08e0457350fb8e9c
Gitweb:        https://git.kernel.org/tip/289d0a475c3e5be42315376d08e0457350fb8e9c
Author:        Masahiro Yamada <[email protected]>
AuthorDate:    Wed, 22 Nov 2023 08:57:01 +09:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Thu, 08 Feb 2024 13:23:14 +01:00

x86/vdso: Use CONFIG_COMPAT_32 to specify vdso32

In arch/x86/Kconfig, COMPAT_32 is defined as (IA32_EMULATION || X86_32). Use it to eliminate redundancy in Makefile.

---
 arch/x86/Makefile            | 3 +--
 arch/x86/entry/vdso/Makefile | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/x86/Makefile +1 -2
index 2264db1..f2260ac 100644
@@ -296,8 +296,7 @@ install:
 
 vdso-install-$(CONFIG_X86_64)		+= arch/x86/entry/vdso/vdso64.so.dbg
 vdso-install-$(CONFIG_X86_X32_ABI)	+= arch/x86/entry/vdso/vdsox32.so.dbg
-vdso-install-$(CONFIG_X86_32)		+= arch/x86/entry/vdso/vdso32.so.dbg
-vdso-install-$(CONFIG_IA32_EMULATION)	+= arch/x86/entry/vdso/vdso32.so.dbg
+vdso-install-$(CONFIG_COMPAT_32)	+= arch/x86/entry/vdso/vdso32.so.dbg
 
 archprepare: checkbin
 checkbin:
arch/x86/entry/vdso/Makefile +1 -2
index 439b527..7a97b17 100644
@@ -35,8 +35,7 @@ OBJECT_FILES_NON_STANDARD_extable.o	:= n
 # vDSO images to build
 obj-$(CONFIG_X86_64)		+= vdso-image-64.o
 obj-$(CONFIG_X86_X32_ABI)	+= vdso-image-x32.o
-obj-$(CONFIG_X86_32)		+= vdso-image-32.o vdso32-setup.o
-obj-$(CONFIG_IA32_EMULATION)	+= vdso-image-32.o vdso32-setup.o
+obj-$(CONFIG_COMPAT_32)		+= vdso-image-32.o vdso32-setup.o
 
 OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n
 
#6 lore raw

[tip: x86/vdso] x86/vdso: Use $(addprefix ) instead of $(foreach )

In reply to Masahiro Yamada
The following commit has been merged into the x86/vdso branch of tip:

The following commit has been merged into the x86/vdso branch of tip:

Commit-ID:     ac9275b3b4dd11a1c825071b9dbaf7614a399c89
Gitweb:        https://git.kernel.org/tip/ac9275b3b4dd11a1c825071b9dbaf7614a399c89
Author:        Masahiro Yamada <[email protected]>
AuthorDate:    Wed, 22 Nov 2023 08:57:00 +09:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Thu, 08 Feb 2024 13:23:01 +01:00

x86/vdso: Use $(addprefix ) instead of $(foreach )

$(addprefix ) is slightly shorter and more intuitive.

---
 arch/x86/entry/vdso/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/entry/vdso/Makefile +3 -3
index cbfb5aa..439b527 100644
@@ -40,8 +40,8 @@ obj-$(CONFIG_IA32_EMULATION)	+= vdso-image-32.o vdso32-setup.o
 
 OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n
 
-vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
-vobjs32 := $(foreach F,$(vobjs32-y),$(obj)/$F)
+vobjs := $(addprefix $(obj)/, $(vobjs-y))
+vobjs32 := $(addprefix $(obj)/, $(vobjs32-y))
 
 $(obj)/vdso.o: $(obj)/vdso.so
 
@@ -112,7 +112,7 @@ VDSO_LDFLAGS_vdsox32.lds = -m elf32_x86_64 -soname linux-vdso.so.1 \
 vobjx32s-y := $(vobjs-y:.o=-x32.o)
 
 # same thing, but in the output directory
-vobjx32s := $(foreach F,$(vobjx32s-y),$(obj)/$F)
+vobjx32s := $(addprefix $(obj)/, $(vobjx32s-y))
 
 # Convert 64bit object file to x32 for x32 vDSO.
 quiet_cmd_x32 = X32     $@
#4 lore raw

[tip: x86/vdso] x86/vdso: Simplify obj-y addition

In reply to Masahiro Yamada
The following commit has been merged into the x86/vdso branch of tip:

The following commit has been merged into the x86/vdso branch of tip:

Commit-ID:     329b77b59f83440e98d792800501e5a398806860
Gitweb:        https://git.kernel.org/tip/329b77b59f83440e98d792800501e5a398806860
Author:        Masahiro Yamada <[email protected]>
AuthorDate:    Wed, 22 Nov 2023 08:56:59 +09:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Thu, 08 Feb 2024 13:22:08 +01:00

x86/vdso: Simplify obj-y addition

Add objects to obj-y in a more straightforward way.

CONFIG_X86_32 and CONFIG_IA32_EMULATION are not enabled simultaneously, but even if they are, Kbuild graciously deduplicates obj-y entries.

---
 arch/x86/entry/vdso/Makefile | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
arch/x86/entry/vdso/Makefile +4 -12
index 2038d9c..cbfb5aa 100644
@@ -18,11 +18,6 @@ OBJECT_FILES_NON_STANDARD	:= y
 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
 KCOV_INSTRUMENT		:= n
 
-VDSO64-$(CONFIG_X86_64)		:= y
-VDSOX32-$(CONFIG_X86_X32_ABI)	:= y
-VDSO32-$(CONFIG_X86_32)		:= y
-VDSO32-$(CONFIG_IA32_EMULATION)	:= y
-
 # files to link into the vdso
 vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o
 vobjs32-y := vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o
@@ -38,11 +33,11 @@ OBJECT_FILES_NON_STANDARD_vma.o		:= n
 OBJECT_FILES_NON_STANDARD_extable.o	:= n
 
 # vDSO images to build
-vdso_img-$(VDSO64-y)		+= 64
-vdso_img-$(VDSOX32-y)		+= x32
-vdso_img-$(VDSO32-y)		+= 32
+obj-$(CONFIG_X86_64)		+= vdso-image-64.o
+obj-$(CONFIG_X86_X32_ABI)	+= vdso-image-x32.o
+obj-$(CONFIG_X86_32)		+= vdso-image-32.o vdso32-setup.o
+obj-$(CONFIG_IA32_EMULATION)	+= vdso-image-32.o vdso32-setup.o
 
-obj-$(VDSO32-y)				 += vdso32-setup.o
 OBJECT_FILES_NON_STANDARD_vdso32-setup.o := n
 
 vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
@@ -53,9 +48,6 @@ $(obj)/vdso.o: $(obj)/vdso.so
 targets += vdso.lds $(vobjs-y)
 targets += vdso32/vdso32.lds $(vobjs32-y)
 
-# Build the vDSO image C files and link them in.
-vdso_img_objs := $(vdso_img-y:%=vdso-image-%.o)
-obj-y += $(vdso_img_objs)
 targets += $(foreach x, 64 x32 32, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg)
 
 CPPFLAGS_vdso.lds += -P -C
#2 lore raw

[tip: x86/vdso] x86/vdso: Consolidate targets and clean-files

In reply to Masahiro Yamada
The following commit has been merged into the x86/vdso branch of tip:

The following commit has been merged into the x86/vdso branch of tip:

Commit-ID:     31a4ebee0d16a141b18730977963d0e7290b9bd2
Gitweb:        https://git.kernel.org/tip/31a4ebee0d16a141b18730977963d0e7290b9bd2
Author:        Masahiro Yamada <[email protected]>
AuthorDate:    Wed, 22 Nov 2023 08:56:58 +09:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Thu, 08 Feb 2024 13:15:41 +01:00

x86/vdso: Consolidate targets and clean-files

'targets' and 'clean-files' do not need to list the same files because the files listed in 'targets' are cleaned up.

Refactor the code.

---
 arch/x86/entry/vdso/Makefile | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
arch/x86/entry/vdso/Makefile +1 -6
index b1b8dd1..2038d9c 100644
@@ -55,11 +55,8 @@ targets += vdso32/vdso32.lds $(vobjs32-y)
 
 # Build the vDSO image C files and link them in.
 vdso_img_objs := $(vdso_img-y:%=vdso-image-%.o)
-vdso_img_cfiles := $(vdso_img-y:%=vdso-image-%.c)
-vdso_img_sodbg := $(vdso_img-y:%=vdso%.so.dbg)
 obj-y += $(vdso_img_objs)
-targets += $(vdso_img_cfiles)
-targets += $(vdso_img_sodbg) $(vdso_img-y:%=vdso%.so)
+targets += $(foreach x, 64 x32 32, vdso-image-$(x).c vdso$(x).so vdso$(x).so.dbg)
 
 CPPFLAGS_vdso.lds += -P -C
 
@@ -190,5 +187,3 @@ GCOV_PROFILE := n
 
 quiet_cmd_vdso_and_check = VDSO    $@
       cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check)
-
-clean-files := vdso32.so vdso32.so.dbg vdso64* vdso-image-*.c vdsox32.so*