Skip to contentSkip to conversation

mips: vdso: Allow passing build path options

PATCH In review Matija Glavinic Pecotic 2 participants 2 messages Apr 4, 2022 – Jun 8, 2022 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mips: vdso: Allow passing build path options

vdso image is not reproducible in different build directories as build path defines vdso image contents via .notes, build ID. Build ID is hashed across all sections (prior stripping), debug sections included. With debug sections containing build paths, hash is impacted. Finally vmlinux is not reproducible as it will differ in vdso_data.

For users wanting reproducible builds, irrespective of build path, it is unwanted behavior. Issue is sorted out by passing related options via KAFLAGS, KCFLAGS, however due to mips' picking out specific/subset options, these are not getting passed through.

Allow related option to be taken if user specified them.

---
 arch/mips/vdso/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/vdso/Makefile +5 -1
index f72658b3a53f..b8296ef2bfcf 100644
@@ -35,8 +35,12 @@ cflags-vdso := $(ccflags-vdso) \
 	-O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
 	-mrelax-pic-calls $(call cc-option, -mexplicit-relocs) \
 	-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
-	$(call cc-option, -fno-asynchronous-unwind-tables)
+	$(call cc-option, -fno-asynchronous-unwind-tables) \
+	$(filter -ffile-prefix-map%,$(KBUILD_CFLAGS)) \
+	$(filter -fmacro-prefix-map%,$(KBUILD_CFLAGS)) \
+	$(filter -fdebug-prefix-map%,$(KBUILD_CFLAGS))
 aflags-vdso := $(ccflags-vdso) \
+	$(filter --debug-prefix-map%,$(KBUILD_AFLAGS)) \
 	-D__ASSEMBLY__ -Wa,-gdwarf-2
 
 ifneq ($(c-gettimeofday-y),)
Signature · 1 line
2.26.0
Reviewed-by on v1 1/1
#1 lore raw

Hello Matija, Thomas,

Quoted 6 lines · Matija Glavinic Pecotic

vdso image is not reproducible in different build directories as build path defines vdso image contents via .notes, build ID. Build ID is hashed across all sections (prior stripping), debug sections included. With debug sections containing build paths, hash is impacted. Finally vmlinux is not reproducible as it will differ in vdso_data.

Quoted 8 lines

For users wanting reproducible builds, irrespective of build path, it is unwanted behavior. Issue is sorted out by passing related options via KAFLAGS, KCFLAGS, however due to mips' picking out specific/subset options, these are not getting passed through.

Allow related option to be taken if user specified them.

Quoted 22 lines
---
 arch/mips/vdso/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/vdso/Makefile +5 -1
index f72658b3a53f..b8296ef2bfcf 100644
@@ -35,8 +35,12 @@ cflags-vdso := $(ccflags-vdso) \
 	-O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
 	-mrelax-pic-calls $(call cc-option, -mexplicit-relocs) \
 	-fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
-	$(call cc-option, -fno-asynchronous-unwind-tables)
+	$(call cc-option, -fno-asynchronous-unwind-tables) \
+	$(filter -ffile-prefix-map%,$(KBUILD_CFLAGS)) \
+	$(filter -fmacro-prefix-map%,$(KBUILD_CFLAGS)) \
+	$(filter -fdebug-prefix-map%,$(KBUILD_CFLAGS))
 aflags-vdso := $(ccflags-vdso) \
+	$(filter --debug-prefix-map%,$(KBUILD_AFLAGS)) \
 	-D__ASSEMBLY__ -Wa,-gdwarf-2
 
 ifneq ($(c-gettimeofday-y),)
Signature · 2 lines
Best regards,
Alexander Sverdlin.