Skip to content

Commit bce7449

Browse files
masahir0ympe
authored andcommitted
powerpc/vdso: fix unnecessary rebuilds of vgettimeofday.o
vgettimeofday.o is unnecessarily rebuilt. Adding it to 'targets' is not enough to fix the issue. Kbuild is correctly rebuilding it because the command line is changed. PowerPC builds each vdso directory twice; first in vdso_prepare to generate vdso{32,64}-offsets.h, second as part of the ordinary build process to embed vdso{32,64}.so.dbg into the kernel. The problem shows up when CONFIG_PPC_WERROR=y due to the following line in arch/powerpc/Kbuild: subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror In the preparation stage, Kbuild directly visits the vdso directories, hence it does not inherit subdir-ccflags-y. In the second descend, Kbuild adds -Werror, which results in the command line flipping with/without -Werror. It implies a potential danger; if a more critical flag that would impact the resulted vdso, the offsets recorded in the headers might be different from real offsets in the embedded vdso images. Removing the unneeded second descend solves the problem. Reported-by: Michael Ellerman <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/linuxppc-dev/[email protected]/ Link: https://lore.kernel.org/r/[email protected]
1 parent 344717a commit bce7449

File tree

5 files changed

+4
-11
lines changed

5 files changed

+4
-11
lines changed

arch/powerpc/kernel/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ obj-y += ptrace/
5151
obj-$(CONFIG_PPC64) += setup_64.o \
5252
paca.o nvram_64.o note.o syscall_64.o
5353
obj-$(CONFIG_COMPAT) += sys_ppc32.o signal_32.o
54-
obj-$(CONFIG_VDSO32) += vdso32/
54+
obj-$(CONFIG_VDSO32) += vdso32_wrapper.o
5555
obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o
5656
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
5757
obj-$(CONFIG_PPC_DAWR) += dawr.o
@@ -60,7 +60,7 @@ obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o
6060
obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o
6161
obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o
6262
obj-$(CONFIG_PPC_BARRIER_NOSPEC) += security.o
63-
obj-$(CONFIG_PPC64) += vdso64/
63+
obj-$(CONFIG_PPC64) += vdso64_wrapper.o
6464
obj-$(CONFIG_ALTIVEC) += vecemu.o
6565
obj-$(CONFIG_PPC_BOOK3S_IDLE) += idle_book3s.o
6666
procfs-y := proc_powerpc.o

arch/powerpc/kernel/vdso32/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CC32FLAGS += -m32
3030
KBUILD_CFLAGS := $(filter-out -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc,$(KBUILD_CFLAGS))
3131
endif
3232

33-
targets := $(obj-vdso32) vdso32.so.dbg
33+
targets := $(obj-vdso32) vdso32.so.dbg vgettimeofday.o
3434
obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
3535

3636
GCOV_PROFILE := n
@@ -46,9 +46,6 @@ obj-y += vdso32_wrapper.o
4646
targets += vdso32.lds
4747
CPPFLAGS_vdso32.lds += -P -C -Upowerpc
4848

49-
# Force dependency (incbin is bad)
50-
$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so.dbg
51-
5249
# link rule for the .so file, .lds has to be first
5350
$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday.o FORCE
5451
$(call if_changed,vdso32ld_and_check)

arch/powerpc/kernel/vdso64/Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif
1717

1818
# Build rules
1919

20-
targets := $(obj-vdso64) vdso64.so.dbg
20+
targets := $(obj-vdso64) vdso64.so.dbg vgettimeofday.o
2121
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
2222

2323
GCOV_PROFILE := n
@@ -29,15 +29,11 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib \
2929
-Wl,-soname=linux-vdso64.so.1 -Wl,--hash-style=both
3030
asflags-y := -D__VDSO64__ -s
3131

32-
obj-y += vdso64_wrapper.o
3332
targets += vdso64.lds
3433
CPPFLAGS_vdso64.lds += -P -C -U$(ARCH)
3534

3635
$(obj)/vgettimeofday.o: %.o: %.c FORCE
3736

38-
# Force dependency (incbin is bad)
39-
$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so.dbg
40-
4137
# link rule for the .so file, .lds has to be first
4238
$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday.o FORCE
4339
$(call if_changed,vdso64ld_and_check)

0 commit comments

Comments
 (0)