Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1069623imm; Wed, 18 Jul 2018 16:10:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfVPYKUZGe+2gIlS12Y8dypHqmJgVC7O/HnAEc/8mlOu/RjE8xX9kO8q+F6kcTSjA0S5t4i X-Received: by 2002:a63:bd51:: with SMTP id d17-v6mr7818561pgp.42.1531955453178; Wed, 18 Jul 2018 16:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531955453; cv=none; d=google.com; s=arc-20160816; b=JtjSmrXoZL+QuO4MTK4sPR7Sq+vvVwxjfhbEI0KLxCKlk1Jxin/pIKf11bWLSVULiR Frr2ydAmrTU1hixaJAnCjhi0NSbZh2ijubLsYIgGMEX+USN9cp1LorW1JeL5xiFwouL3 dniH57/vwPkG8aYVCuawFGH+IiPZt7UuHBdwwA68aQZOQ0xbMV7mJDbOywQv4jKBb3RU QxZOY6EakN9jBxdQocXpSMMgihSOyRWBXztvyiX870ePnQmmCEWoR+9OzHU92eSYLHQ8 AFbOrODnjDPxcNWLYCgvFfDvhar9FxJydRrHv2YFWUq+8oaXDOrQ6EHSqfj9AVjON3H5 cFiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=lMQkwXcjyOPzc+LeuDE0/OkorVNoHpoif5vc08jtWaY=; b=N7bM9Q6dvj/jKA96+/vxf/jYAZLuL9Yqxkp/qn8duhLWr2jHFMY+RJtSLL8NBljyjD ooX+gwce2SBiTIHeNCeQZkNbqew2kSLKvnQvB/nD0n1iS4gl3e084G73D/DPVkkn0xC2 P47gy7cQQDhgo/Whx1JTLubr8M1khKr/Kev27Mt5TrPHUqHJFcYagzyly5eqkCK97tsl /bOeNbQjRUDZEkgHCRCxF+8fHPf0qTS1DY4+FSfWyBrX1O1GtycEUhbjQDWSNXxF72DR pw2q5lyTnu6ncVRpiV3TRqtiYCyMFZrCvV9kAhVB8VeR1+RfPHjV2sqXJy1OG47J3Q1I PhIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=eBKPwBJi; 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 z4-v6si4388471pge.173.2018.07.18.16.10.38; Wed, 18 Jul 2018 16:10:53 -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=eBKPwBJi; 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 S1730331AbeGRXuH (ORCPT + 99 others); Wed, 18 Jul 2018 19:50:07 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:39151 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728304AbeGRXuG (ORCPT ); Wed, 18 Jul 2018 19:50:06 -0400 Received: from mail-ua0-f177.google.com (mail-ua0-f177.google.com [209.85.217.177]) (authenticated) by conssluserg-02.nifty.com with ESMTP id w6IN9Y1l029385; Thu, 19 Jul 2018 08:09:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com w6IN9Y1l029385 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1531955375; bh=lMQkwXcjyOPzc+LeuDE0/OkorVNoHpoif5vc08jtWaY=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=eBKPwBJizyTRM4GvWE8KW6Ks0X+Aca9iu4j2a/cNefuwko2rk/8P1GIiZAzFU+iRN 4rHvuw50RB4dtX3JvNV5FVrCVGC5MogJi+HTMlQlrSWKLOoItTQ/8oYY5xU9U8HH2F vQGn1IIEDz2IaIlubbL3hxijv086RUd7BayXPE0i4cyIVLY0jMtwIYJiU1r2ucKfub +9i7M2ztTfqY3H0noe05+DYf7iNu8AZx/UpUbnVDK5E51vtCpllEtEq1JMcarqP8eq YcHACzVcsL32cTCTL3nhD1+1JKVrHuyXS03u8/WQwpXA8Fu6qcK4o2D/tshym4C67N 2am9Tqae1fTYg== X-Nifty-SrcIP: [209.85.217.177] Received: by mail-ua0-f177.google.com with SMTP id x24-v6so3998610ual.10; Wed, 18 Jul 2018 16:09:34 -0700 (PDT) X-Gm-Message-State: AOUpUlGWYAscyOGtOSQVHFqvvQq0leFTY5rTJul0Ac/VhLlJonJWaxvH 5tW4znWOKFN3Su4Ki/xwLalnVdxkq09v1dlobRM= X-Received: by 2002:ab0:4705:: with SMTP id h5-v6mr5254991uac.140.1531955373612; Wed, 18 Jul 2018 16:09:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:3308:0:0:0:0:0 with HTTP; Wed, 18 Jul 2018 16:08:53 -0700 (PDT) In-Reply-To: <20180713153033.20540-1-olof@lixom.net> References: <20180713150701.GA3049@arm.com> <20180713153033.20540-1-olof@lixom.net> From: Masahiro Yamada Date: Thu, 19 Jul 2018 08:08:53 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] arm64: build with baremetal linker target instead of Linux when available To: Olof Johansson Cc: Will Deacon , Catalin Marinas , Michal Marek , linux-arm-kernel , Linux Kernel Mailing List , Linux Kbuild mailing list , Paul Kocialkowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-07-14 0:30 GMT+09:00 Olof Johansson : > Not all toolchains have the baremetal elf targets, RedHat/Fedora ones > in particular. So, probe for whether it's available and use the previous > (linux) targets if it isn't. > > Reported-by: Laura Abbott > Cc: Paul Kocialkowski > Signed-off-by: Olof Johansson > --- > arch/arm64/Makefile | 9 +++++---- > scripts/Kbuild.include | 4 ++-- > 2 files changed, 7 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index e7101b19d590..efe61a2e4b5e 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -60,15 +60,16 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) > KBUILD_CPPFLAGS += -mbig-endian > CHECKFLAGS += -D__AARCH64EB__ > AS += -EB > -# We must use the linux target here, since distributions don't tend to package > -# the ELF linker scripts with binutils, and this results in a build failure. > -LDFLAGS += -EB -maarch64linuxb > +# Prefer the baremetal ELF build target, but not all toolchains include > +# it so fall back to the standard linux version if needed. > +LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb) > UTS_MACHINE := aarch64_be > else > KBUILD_CPPFLAGS += -mlittle-endian > CHECKFLAGS += -D__AARCH64EL__ > AS += -EL > -LDFLAGS += -EL -maarch64linux # See comment above > +# Same as above, prefer ELF but fall back to linux target if needed. > +LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux) > UTS_MACHINE := aarch64 > endif > > diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include > index c8156d61678c..1e13f502b42f 100644 > --- a/scripts/Kbuild.include > +++ b/scripts/Kbuild.include > @@ -163,8 +163,8 @@ cc-ldoption = $(call try-run,\ > $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) > > # ld-option > -# Usage: LDFLAGS += $(call ld-option, -X) > -ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2)) > +# Usage: LDFLAGS += $(call ld-option, -X, -Y) > +ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3)) > > # ar-option > # Usage: KBUILD_ARFLAGS := $(call ar-option,D) I guess this patch will go through the arm64 tree. I am fine with the change of scripts/Kbuild.include Acked-by: Masahiro Yamada -- Best Regards Masahiro Yamada