On Wed, 2026-11-11 at 15:12 +0300, Michael Tokarev wrote:
> Currently the linux-user vdso*.so files are not reproducible,
> because for one, the binaries embed a random temporary file
> name used by the compiler during compilation, such as ccuckKYd.o.
> 
> At the very least, use -pipe to avoid the need to have a temp
> file in the first place - this makes the build repeatable.
> 
> Signed-off-by: Michael Tokarev <[email protected]>

Acked-by: Alistair Francis <[email protected]>

Alistair

> ---
>  linux-user/aarch64/Makefile.vdso     | 6 ++++--
>  linux-user/arm/Makefile.vdso         | 8 +++++---
>  linux-user/hppa/Makefile.vdso        | 4 +++-
>  linux-user/i386/Makefile.vdso        | 4 +++-
>  linux-user/loongarch64/Makefile.vdso | 4 +++-
>  linux-user/ppc/Makefile.vdso         | 8 +++++---
>  linux-user/riscv/Makefile.vdso       | 6 ++++--
>  linux-user/s390x/Makefile.vdso       | 4 +++-
>  linux-user/sh4/Makefile.vdso         | 6 ++++--
>  linux-user/x86_64/Makefile.vdso      | 4 +++-
>  10 files changed, 37 insertions(+), 17 deletions(-)
> 
> diff --git a/linux-user/aarch64/Makefile.vdso b/linux-
> user/aarch64/Makefile.vdso
> index 82ed201108..1789b67268 100644
> --- a/linux-user/aarch64/Makefile.vdso
> +++ b/linux-user/aarch64/Makefile.vdso
> @@ -3,6 +3,8 @@ include $(BUILD_DIR)/linux-user/aarch64/config-
> target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/aarch64
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso-be.so $(SUBDIR)/vdso-le.so
>  
>  LDFLAGS = -nostdlib -shared -Wl,-h,linux-vdso.so.1 \
> @@ -10,7 +12,7 @@ LDFLAGS = -nostdlib -shared -Wl,-h,linux-vdso.so.1
> \
>         -Wl,-z,max-page-size=4096 -Wl,-T,$(SUBDIR)/vdso.ld
>  
>  $(SUBDIR)/vdso-be.so: vdso.S vdso.ld
> -     $(CC) -o $@ $(LDFLAGS) -mbig-endian $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS) -mbig-endian $<
>  
>  $(SUBDIR)/vdso-le.so: vdso.S vdso.ld
> -     $(CC) -o $@ $(LDFLAGS) -mlittle-endian $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS) -mlittle-endian $<
> diff --git a/linux-user/arm/Makefile.vdso b/linux-
> user/arm/Makefile.vdso
> index 16ae8d7aaa..360b77185f 100644
> --- a/linux-user/arm/Makefile.vdso
> +++ b/linux-user/arm/Makefile.vdso
> @@ -3,6 +3,8 @@ include $(BUILD_DIR)/linux-user/arm/config-target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/arm
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso-be8.so $(SUBDIR)/vdso-be32.so $(SUBDIR)/vdso-
> le.so
>  
>  # Adding -use-blx disables unneeded interworking without actually
> using blx.
> @@ -11,10 +13,10 @@ LDFLAGS = -nostdlib -shared -Wl,-use-blx -Wl,-
> z,max-page-size=4096 \
>         -Wl,--hash-style=both -Wl,-T,$(SUBDIR)/vdso.ld
>  
>  $(SUBDIR)/vdso-be8.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS) -mbig-endian -mbe8 $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS) -mbig-endian -mbe8 $<
>  
>  $(SUBDIR)/vdso-be32.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS) -mbig-endian -mbe32 $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS) -mbig-endian -mbe32
> $<
>  
>  $(SUBDIR)/vdso-le.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS) -mlittle-endian $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS) -mlittle-endian $<
> diff --git a/linux-user/hppa/Makefile.vdso b/linux-
> user/hppa/Makefile.vdso
> index 78642c4266..5f3f2ddde9 100644
> --- a/linux-user/hppa/Makefile.vdso
> +++ b/linux-user/hppa/Makefile.vdso
> @@ -3,9 +3,11 @@ include $(BUILD_DIR)/linux-user/hppa/config-
> target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/hppa
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso.so
>  
>  $(SUBDIR)/vdso.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ -nostdlib -shared -Wl,-h,linux-vdso32.so.1 \
> +     $(CC) $(REPRODUCIBLE) -o $@ -nostdlib -shared -Wl,-h,linux-
> vdso32.so.1 \
>         -Wl,--build-id=sha1 -Wl,--hash-style=both \
>         -Wl,-T,$(SUBDIR)/vdso.ld $<
> diff --git a/linux-user/i386/Makefile.vdso b/linux-
> user/i386/Makefile.vdso
> index ca2e37fa6b..e797c5c7fe 100644
> --- a/linux-user/i386/Makefile.vdso
> +++ b/linux-user/i386/Makefile.vdso
> @@ -3,9 +3,11 @@ include $(BUILD_DIR)/linux-user/i386/config-
> target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/i386
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso.so
>  
>  $(SUBDIR)/vdso.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ -m32 -nostdlib -shared -Wl,-h,linux-gate.so.1 \
> +     $(CC) $(REPRODUCIBLE) -o $@ -m32 -nostdlib -shared -Wl,-
> h,linux-gate.so.1 \
>         -Wl,--build-id=sha1 -Wl,--hash-style=both \
>         -Wl,-T,$(SUBDIR)/vdso.ld $<
> diff --git a/linux-user/loongarch64/Makefile.vdso b/linux-
> user/loongarch64/Makefile.vdso
> index ceb6110120..64a422e66d 100644
> --- a/linux-user/loongarch64/Makefile.vdso
> +++ b/linux-user/loongarch64/Makefile.vdso
> @@ -3,10 +3,12 @@ include $(BUILD_DIR)/linux-user/loongarch64/config-
> target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/loongarch64
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso.so
>  
>  $(SUBDIR)/vdso.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ -nostdlib -shared -fpic -Wl,-h,linux-vdso.so.1 \
> +     $(CC) $(REPRODUCIBLE) -o $@ -nostdlib -shared -fpic -Wl,-
> h,linux-vdso.so.1 \
>         -Wl,--build-id=sha1 -Wl,--hash-style=both \
>         -Wl,--no-warn-rwx-segments -Wl,-z,max-page-size=4096 \
>         -Wl,-T,$(SUBDIR)/vdso.ld $<
> diff --git a/linux-user/ppc/Makefile.vdso b/linux-
> user/ppc/Makefile.vdso
> index 6b9be84381..87a2bc1c57 100644
> --- a/linux-user/ppc/Makefile.vdso
> +++ b/linux-user/ppc/Makefile.vdso
> @@ -3,6 +3,8 @@ include $(BUILD_DIR)/linux-user/ppc64/config-
> target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/ppc
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso-32.so $(SUBDIR)/vdso-64.so $(SUBDIR)/vdso-
> 64le.so
>  
>  LDFLAGS32 = -nostdlib -shared -Wl,-T,$(SUBDIR)/vdso-32.ld \
> @@ -13,10 +15,10 @@ LDFLAGS64 = -nostdlib -shared -Wl,-
> T,$(SUBDIR)/vdso-64.ld \
>           -Wl,--build-id=sha1 -Wl,-z,max-page-size=4096
>  
>  $(SUBDIR)/vdso-32.so: vdso.S vdso-32.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS32) -m32 $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS32) -m32 $<
>  
>  $(SUBDIR)/vdso-64.so: vdso.S vdso-64.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS64) -mbig-endian $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS64) -mbig-endian $<
>  
>  $(SUBDIR)/vdso-64le.so: vdso.S vdso-64.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS64) -mlittle-endian $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS64) -mlittle-endian $<
> diff --git a/linux-user/riscv/Makefile.vdso b/linux-
> user/riscv/Makefile.vdso
> index 2eefdb70cf..2a47a3113d 100644
> --- a/linux-user/riscv/Makefile.vdso
> +++ b/linux-user/riscv/Makefile.vdso
> @@ -3,13 +3,15 @@ include $(BUILD_DIR)/linux-user/riscv64/config-
> target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/riscv
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso-32.so $(SUBDIR)/vdso-64.so
>  
>  LDFLAGS = -nostdlib -shared -fpic -Wl,-h,linux-vdso.so.1 -Wl,--
> build-id=sha1 \
>         -Wl,--hash-style=both -Wl,-T,$(SUBDIR)/vdso.ld
>  
>  $(SUBDIR)/vdso-32.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS) -mabi=ilp32d -march=rv32g $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS) -mabi=ilp32d -
> march=rv32g $<
>  
>  $(SUBDIR)/vdso-64.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS) -mabi=lp64d -march=rv64g $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS) -mabi=lp64d -
> march=rv64g $<
> diff --git a/linux-user/s390x/Makefile.vdso b/linux-
> user/s390x/Makefile.vdso
> index 51f7c50a2d..65ac267239 100644
> --- a/linux-user/s390x/Makefile.vdso
> +++ b/linux-user/s390x/Makefile.vdso
> @@ -3,9 +3,11 @@ include $(BUILD_DIR)/linux-user/s390x/config-
> target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/s390x
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso.so
>  
>  $(SUBDIR)/vdso.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ -nostdlib -shared -Wl,-h,linux-vdso64.so.1 \
> +     $(CC) $(REPRODUCIBLE) -o $@ -nostdlib -shared -Wl,-h,linux-
> vdso64.so.1 \
>         -Wl,--build-id=sha1 -Wl,--hash-style=both \
>         -Wl,-T,$(SUBDIR)/vdso.ld $<
> diff --git a/linux-user/sh4/Makefile.vdso b/linux-
> user/sh4/Makefile.vdso
> index ed2cc11b82..97375a4783 100644
> --- a/linux-user/sh4/Makefile.vdso
> +++ b/linux-user/sh4/Makefile.vdso
> @@ -3,6 +3,8 @@ include $(BUILD_DIR)/linux-user/sh4/config-target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/sh4
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso-le.so $(SUBDIR)/vdso-be.so
>  
>  LDFLAGS = -nostdlib -shared -Wl,-h,linux-gate.so.1 \
> @@ -10,9 +12,9 @@ LDFLAGS = -nostdlib -shared -Wl,-h,linux-gate.so.1
> \
>         -Wl,-T,$(SUBDIR)/vdso.ld
>  
>  $(SUBDIR)/vdso-le.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC) -o $@ $(LDFLAGS) -ml $<
> +     $(CC) $(REPRODUCIBLE) -o $@ $(LDFLAGS) -ml $<
>  
>  CC_BE = sh4eb-unknown-linux-gnu-gcc
>  
>  $(SUBDIR)/vdso-be.so: vdso.S vdso.ld vdso-asmoffset.h
> -     $(CC_BE) -o $@ $(LDFLAGS) $<
> +     $(CC_BE) $(REPRODUCIBLE) -o $@ $(LDFLAGS) $<
> diff --git a/linux-user/x86_64/Makefile.vdso b/linux-
> user/x86_64/Makefile.vdso
> index 56fe87af72..41281ffe0a 100644
> --- a/linux-user/x86_64/Makefile.vdso
> +++ b/linux-user/x86_64/Makefile.vdso
> @@ -3,9 +3,11 @@ include $(BUILD_DIR)/linux-user/x86_64/config-
> target.mak
>  SUBDIR = $(SRC_PATH)/linux-user/x86_64
>  VPATH += $(SUBDIR)
>  
> +REPRODUCIBLE = -pipe
> +
>  all: $(SUBDIR)/vdso.so
>  
>  $(SUBDIR)/vdso.so: vdso.S vdso.ld
> -     $(CC) -o $@ -nostdlib -shared -Wl,-h,linux-vdso.so.1 \
> +     $(CC) $(REPRODUCIBLE) -o $@ -nostdlib -shared -Wl,-h,linux-
> vdso.so.1 \
>         -Wl,--build-id=sha1 -Wl,--hash-style=both \
>         -Wl,-T,$(SUBDIR)/vdso.ld $<

Reply via email to