From patchwork Thu Apr 11 09:30:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 162055 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp7194501jan; Thu, 11 Apr 2019 02:31:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPwSHNQCEU+yY9sCzQPmiy2rECDIbuEK/e2SvAotcAEVGXu6HoYZEL08F6npX+Dh7I7213 X-Received: by 2002:a17:902:e393:: with SMTP id ch19mr47295449plb.117.1554975096721; Thu, 11 Apr 2019 02:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554975096; cv=none; d=google.com; s=arc-20160816; b=Ojwc/xSLZylxkE8SELcYHNkAtm6ObAmja9BrWTCdvNjwAQQZB568bfaXyqUtEtqCOE /DpNy71g8mGVqvd718AEjcbJhypF6pGobMYZr7bOeJFM9pFYmQH+zJ1qCITg9zRvVaEM oPzuQWwHt0WJjLEv6NrkvljEYcVCmL+o3t55JaBem63/Qnje1QQazR9bWjbhlwNzc9ug 78rhx6uK5bBYeehB+Fmxjl5AJJgQnMOCkmP/9KmF/ZQXPvw1lIou/iisZLjkeFW4cUNE jOgb9rd4oKBMHP4tLeWmmOsuIPmkR0bBk37B2HlYzz+lyqCTY0tXojDrpt5PNJLdGMqG lxcQ== 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=pamsHavWO/HjsWP8UtMBGwElWsTCMSpe/5Xz6rV18G0=; b=SVbQMyRnUpjhxRCcUBF7CMOk4M8VAbhoK+M/4+wl817fy1x5uewRDVb70kHFaBdo8V El5T71+g/okcWq0j4lE8hX0YYNkq8Ab9IO341hAjytvkSZNT+mb4WEJTb9Lz8EY/0TcN q18rMC2yZR+LSz/DLh+dTPO2gycNxgXpeZbEjTWfMMhA7qEoHXT77tqsRPTAIXFI8CoW 9Twpz/T0W4EIRIfauNFK0ktOEIph0kWKKY+8WZKrXC69/kNPcSuX2nZzIjVbYAg9TQze Ul/ch9Cq6E2saWEVqDKCwLx9pPFEms8qdklRqjwcBTs37xJD63q6tiDrwwparB30GUyu ongQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=iIeEZvto; 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 d9si31565793plr.253.2019.04.11.02.31.36; Thu, 11 Apr 2019 02:31:36 -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=iIeEZvto; 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 S1727266AbfDKJbe (ORCPT + 31 others); Thu, 11 Apr 2019 05:31:34 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:48911 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfDKJbe (ORCPT ); Thu, 11 Apr 2019 05:31:34 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x3B9ULYI018071; Thu, 11 Apr 2019 18:30:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x3B9ULYI018071 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554975021; bh=pamsHavWO/HjsWP8UtMBGwElWsTCMSpe/5Xz6rV18G0=; h=From:To:Cc:Subject:Date:From; b=iIeEZvtoUpr1/SIBNhL45jIZd/+85UWQbxMGYM88BUOXLF3oeTjzx2RBVZyeFNR3o Bg2BXC4gbUuo3F5IGBFqpZtTbstSWwK8ZV2Tf3I8xnQBAOM006PbzSLAuGYvml9X8k nHPxCRCzmSq8DS1RE2kQf8HJZcM9jfn1eIEXWUK8fu8vg4NAXdXWI6ZK/B15+Dolpr /WfHsrW2gzwqe3IOoMfGpy7/86vlfbhI9Xxvx6e1EmkM9c57T8tYdp/pRWUt6TQAVy q6b18KrxzvMnP+qk+Tb/nMWrS9azCjdB4Wa8Gs2chIjyg5kM9zLsBm/l8neEI9Fjtm dELs+eubnXlBA== 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 , Will Deacon , Catalin Marinas , linux-kernel@vger.kernel.org Subject: [PATCH] arm64: vdso: use $(LD) instead of $(CC) to link VDSO Date: Thu, 11 Apr 2019 18:30:15 +0900 Message-Id: <20190411093015.6529-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 tested this, and VDSO worked for me. 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/arm64/kernel/vdso/Makefile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) -- 2.17.1 Reviewed-by: Nick Desaulniers diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index a0af6bf6c11b..744b9dbaba03 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -12,17 +12,12 @@ obj-vdso := gettimeofday.o note.o sigreturn.o targets := $(obj-vdso) vdso.so vdso.so.dbg obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) -ccflags-y := -shared -fno-common -fno-builtin -ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \ - $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) +ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 \ + $(call ld-option, --hash-style=sysv) -n -T # Disable gcov profiling for VDSO code GCOV_PROFILE := n -# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared -# down to collect2, resulting in silent corruption of the vDSO image. -ccflags-y += -Wl,-shared - obj-y += vdso.o extra-y += vdso.lds CPPFLAGS_vdso.lds += -P -C -U$(ARCH) @@ -32,7 +27,7 @@ $(obj)/vdso.o : $(obj)/vdso.so # Link rule for the .so file, .lds has to be first $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE - $(call if_changed,vdsold) + $(call if_changed,ld) # Strip rule for the .so file $(obj)/%.so: OBJCOPYFLAGS := -S @@ -52,8 +47,6 @@ $(obj-vdso): %.o: %.S FORCE $(call if_changed_dep,vdsoas) # Actual build commands -quiet_cmd_vdsold = VDSOL $@ - cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $(real-prereqs) -o $@ quiet_cmd_vdsoas = VDSOA $@ cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<