Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7f04b07 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Greg Kroah-Hartman
Browse files

ARM: 8858/1: vdso: use $(LD) instead of $(CC) to link VDSO



[ Upstream commit fe00e50b2db8c60e4ec90befad1f5bab8ca2c800 ]

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b801d568
Loading
Loading
Loading
Loading
+8 −13
Original line number Original line Diff line number Diff line
@@ -10,12 +10,12 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector
ccflags-y += -DDISABLE_BRANCH_PROFILING
ccflags-y += -DDISABLE_BRANCH_PROFILING


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


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


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


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


# Actual build commands
quiet_cmd_vdsold = VDSO    $@
      cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
                   -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@

quiet_cmd_vdsomunge = MUNGE   $@
quiet_cmd_vdsomunge = MUNGE   $@
      cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
      cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@