Skip to content

Commit fe00e50

Browse files
masahir0yRussell King
authored andcommitted
ARM: 8858/1: vdso: use $(LD) instead of $(CC) to link VDSO
We use $(LD) to link vmlinux, modules, decompressors, etc. VDSO is the only exceptional case where $(CC) is used as the linker driver, but I do not know why we need to do so. VDSO uses a special linker script, and does not link standard libraries at all. I changed the Makefile to use $(LD) rather than $(CC). I confirmed the same vdso.so.raw was still produced. Users will be able to use their favorite linker (e.g. lld instead of of bfd) by passing LD= from the command line. My plan is to rewrite all VDSO Makefiles to use $(LD), then delete cc-ldoption. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 32b25e9 commit fe00e50

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

arch/arm/vdso/Makefile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
1010
ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
1111
ccflags-y += -DDISABLE_BRANCH_PROFILING
1212

13-
VDSO_LDFLAGS := -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
14-
VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
15-
VDSO_LDFLAGS += -nostdlib -shared
16-
VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
17-
VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
18-
VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd)
13+
ldflags-y = -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
14+
-z max-page-size=4096 -z common-page-size=4096 \
15+
-nostdlib -shared \
16+
$(call ld-option, --hash-style=sysv) \
17+
$(call ld-option, --build-id) \
18+
-T
1919

2020
obj-$(CONFIG_VDSO) += vdso.o
2121
extra-$(CONFIG_VDSO) += vdso.lds
@@ -37,8 +37,8 @@ KCOV_INSTRUMENT := n
3737
$(obj)/vdso.o : $(obj)/vdso.so
3838

3939
# Link rule for the .so file
40-
$(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE
41-
$(call if_changed,vdsold)
40+
$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
41+
$(call if_changed,ld)
4242

4343
$(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE
4444
$(call if_changed,vdsomunge)
@@ -48,11 +48,6 @@ $(obj)/%.so: OBJCOPYFLAGS := -S
4848
$(obj)/%.so: $(obj)/%.so.dbg FORCE
4949
$(call if_changed,objcopy)
5050

51-
# Actual build commands
52-
quiet_cmd_vdsold = VDSO $@
53-
cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
54-
-Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
55-
5651
quiet_cmd_vdsomunge = MUNGE $@
5752
cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
5853

0 commit comments

Comments
 (0)