From patchwork Thu Apr 11 09:29:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 162054 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp7194415jan; Thu, 11 Apr 2019 02:31:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfFA79/NnD94hTO8JLw2ziWq5DmQtCC4BO94YbN6IDebkN6wLgCaVCB+o+xobb+r3ShpBB X-Received: by 2002:a63:fc0b:: with SMTP id j11mr46054538pgi.74.1554975091889; Thu, 11 Apr 2019 02:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554975091; cv=none; d=google.com; s=arc-20160816; b=JNZRSDZq6ZoNa+8R8pDX6MDyPg6tO8s/LnMQmGUaVmhG01G0Pn3/BZxlBLh3fIGoDC mtMN0xiq2FYMyeKydJ0AnFv/4N3UC+168z2JQvEjVDr9zpfxD/xJxG1vVGFFWEU/icWO kXeqLfXLnXvPjPHDi2d6LuJtwPWBz9451VqYX6VeCoBe1C8dcGTt6NWRoV5tR7qjocYF ByIFyI9boWRfOLFVMkeJ0lkVTV6VY1IUU8OiqbwH/pcpFP6iihT/3PQJf32f3zdiDbPn S9AUqWSQbgvvTPK1LeBHe3cnZWHvXceEzeOTSv0b46xWRdzY5xTgzFOk90qSueYqWf6X y2fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=cR0BcHB4II9sS744pV1/BqkrB8S9Q7JJv9+ER0XDJFk=; b=IjL9RmctsbbhELSVcST9/wVyMXGXmcpvpGfFiKaLEVSEI6kAUSfeoriqZN6BHYvE7h 7KiGGk+u8fMuY78HUZ+/475UCNydzWekmiI1QOE//zncESZgNhj+X0IK95BYaQaJysJT i6aDirYqXNpPh9t5jcnKwofleWf4jbVmspSW1T8NIF1M4Z3L4Mvt74MsVdLcs69uWZMX CjsY2tlkqOCYQVkIQN1JJ/MZfA7ZMrE5KmSAzbSWhgp3Jnhk+9iOvZI0WZBP5bwJwzSk 0aFS2H/S3fRuskhMu7vn+SCZzYk/90PuPm0TfPShfwbEp26V23P6NG89reR5osVvlf9J 3QsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=fu0pN7Nk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l68si22826668pfb.248.2019.04.11.02.31.31; Thu, 11 Apr 2019 02:31:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=fu0pN7Nk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbfDKJba (ORCPT + 31 others); Thu, 11 Apr 2019 05:31:30 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:31118 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfDKJb3 (ORCPT ); Thu, 11 Apr 2019 05:31:29 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id x3B9TtpK023735; Thu, 11 Apr 2019 18:29:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com x3B9TtpK023735 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554974996; bh=cR0BcHB4II9sS744pV1/BqkrB8S9Q7JJv9+ER0XDJFk=; h=From:To:Cc:Subject:Date:From; b=fu0pN7NkSbPJLn/v4mXFTFZbCP3+SPB7p45YW3PlI2ryHu0+LPTrisRF1CuvsBAef OhbiS2EbdFH/VHjjfgnNNLe8Umg8dVmXjhZGRQ1Ui7FiiFI/J8DyS0cpEYunKtlIza st77sUTH2Gbl/ExXVDfdmoDME09IPOO+wWavoqaG4qSetLiGitszsoMpCKTTmq87gp RNjpZMGbbF07k9KHQAJgKh6CFhsplu/JO3lwa1jiWWDbB16ZplobwmUXDbg5ufgSoN EQcn8w7vrfK+aPyYBvEGFX4tm3YjsKKNmcfVLO2/SGHTrry8AFV4024J46+OcdHWKU Fv1WrXvDDCP1w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-arm-kernel@lists.infradead.org Cc: Olof Johansson , Arnd Bergmann , Kees Cook , Nick Desaulniers , Masahiro Yamada , Dmitry Vyukov , linux-kernel@vger.kernel.org, Andrew Morton , Mark Rutland , Russell King Subject: [PATCH] ARM: vdso: use $(LD) instead of $(CC) to link VDSO Date: Thu, 11 Apr 2019 18:29:33 +0900 Message-Id: <20190411092933.6413-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/arm/vdso/Makefile | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) -- 2.17.1 Reviewed-by: Nick Desaulniers diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile index f4efff9d3afb..fadf554d9391 100644 --- a/arch/arm/vdso/Makefile +++ b/arch/arm/vdso/Makefile @@ -10,12 +10,12 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) ccflags-y := -fPIC -fno-common -fno-builtin -fno-stack-protector ccflags-y += -DDISABLE_BRANCH_PROFILING -VDSO_LDFLAGS := -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 -VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 -VDSO_LDFLAGS += -nostdlib -shared -VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) -VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id) -VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd) +ldflags-y = -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \ + -z max-page-size=4096 -z common-page-size=4096 \ + -nostdlib -shared \ + $(call ld-option, --hash-style=sysv) \ + $(call ld-option, --build-id) \ + -T obj-$(CONFIG_VDSO) += vdso.o extra-$(CONFIG_VDSO) += vdso.lds @@ -37,8 +37,8 @@ KCOV_INSTRUMENT := n $(obj)/vdso.o : $(obj)/vdso.so # Link rule for the .so file -$(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE - $(call if_changed,vdsold) +$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) FORCE + $(call if_changed,ld) $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE $(call if_changed,vdsomunge) @@ -48,11 +48,6 @@ $(obj)/%.so: OBJCOPYFLAGS := -S $(obj)/%.so: $(obj)/%.so.dbg FORCE $(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 $@ cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@