Skip to content

Commit a968433

Browse files
bwendlingmasahir0y
authored andcommitted
kbuild: explicitly specify the build id style
ld's --build-id defaults to "sha1" style, while lld defaults to "fast". The build IDs are very different between the two, which may confuse programs that reference them. Signed-off-by: Bill Wendling <morbo@google.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 548b8b5 commit a968433

10 files changed

Lines changed: 11 additions & 11 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,8 @@ KBUILD_CPPFLAGS += $(KCPPFLAGS)
982982
KBUILD_AFLAGS += $(KAFLAGS)
983983
KBUILD_CFLAGS += $(KCFLAGS)
984984

985-
KBUILD_LDFLAGS_MODULE += --build-id
986-
LDFLAGS_vmlinux += --build-id
985+
KBUILD_LDFLAGS_MODULE += --build-id=sha1
986+
LDFLAGS_vmlinux += --build-id=sha1
987987

988988
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
989989
LDFLAGS_vmlinux += $(call ld-option, -X,)

arch/arm/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO32
1919
ldflags-$(CONFIG_CPU_ENDIAN_BE8) := --be8
2020
ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
2121
-z max-page-size=4096 -nostdlib -shared $(ldflags-y) \
22-
--hash-style=sysv --build-id \
22+
--hash-style=sysv --build-id=sha1 \
2323
-T
2424

2525
obj-$(CONFIG_VDSO) += vdso.o

arch/arm64/kernel/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti
2424
# routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
2525
# preparation in build-time C")).
2626
ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \
27-
-Bsymbolic $(call ld-option, --no-eh-frame-hdr) --build-id -n \
27+
-Bsymbolic $(call ld-option, --no-eh-frame-hdr) --build-id=sha1 -n \
2828
$(btildflags-y) -T
2929

3030
ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18

arch/arm64/kernel/vdso32/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ VDSO_LDFLAGS += -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
128128
VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
129129
VDSO_LDFLAGS += -nostdlib -shared -mfloat-abi=soft
130130
VDSO_LDFLAGS += -Wl,--hash-style=sysv
131-
VDSO_LDFLAGS += -Wl,--build-id
131+
VDSO_LDFLAGS += -Wl,--build-id=sha1
132132
VDSO_LDFLAGS += $(call cc32-ldoption,-fuse-ld=bfd)
133133

134134

arch/mips/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ endif
6161
# VDSO linker flags.
6262
ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
6363
$(filter -E%,$(KBUILD_CFLAGS)) -nostdlib -shared \
64-
-G 0 --eh-frame-hdr --hash-style=sysv --build-id -T
64+
-G 0 --eh-frame-hdr --hash-style=sysv --build-id=sha1 -T
6565

6666
CFLAGS_REMOVE_vdso.o = -pg
6767

arch/riscv/kernel/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
4949
# refer to these symbols in the kernel code rather than hand-coded addresses.
5050

5151
SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
52-
-Wl,--build-id -Wl,--hash-style=both
52+
-Wl,--build-id=sha1 -Wl,--hash-style=both
5353
$(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
5454
$(call if_changed,vdsold)
5555

arch/s390/kernel/vdso64/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ KBUILD_AFLAGS_64 += -m64 -s
1919
KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
2020
KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin
2121
ldflags-y := -fPIC -shared -nostdlib -soname=linux-vdso64.so.1 \
22-
--hash-style=both --build-id -T
22+
--hash-style=both --build-id=sha1 -T
2323

2424
$(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64)
2525
$(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_64)

arch/sparc/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ quiet_cmd_vdso = VDSO $@
115115
-T $(filter %.lds,$^) $(filter %.o,$^) && \
116116
sh $(srctree)/$(src)/checkundef.sh '$(OBJDUMP)' '$@'
117117

118-
VDSO_LDFLAGS = -shared --hash-style=both --build-id -Bsymbolic
118+
VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic
119119
GCOV_PROFILE := n
120120

121121
#

arch/x86/entry/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ quiet_cmd_vdso = VDSO $@
176176
-T $(filter %.lds,$^) $(filter %.o,$^) && \
177177
sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
178178

179-
VDSO_LDFLAGS = -shared --hash-style=both --build-id \
179+
VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 \
180180
$(call ld-option, --eh-frame-hdr) -Bsymbolic
181181
GCOV_PROFILE := n
182182

tools/testing/selftests/bpf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ $(OUTPUT)/%:%.c
133133

134134
$(OUTPUT)/urandom_read: urandom_read.c
135135
$(call msg,BINARY,,$@)
136-
$(Q)$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -Wl,--build-id
136+
$(Q)$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -Wl,--build-id=sha1
137137

138138
$(OUTPUT)/test_stub.o: test_stub.c $(BPFOBJ)
139139
$(call msg,CC,,$@)

0 commit comments

Comments
 (0)