From patchwork Fri Jul 13 15:30:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olof Johansson X-Patchwork-Id: 10523583 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 35493601C2 for ; Fri, 13 Jul 2018 15:31:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 228D729CB0 for ; Fri, 13 Jul 2018 15:31:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CFA029CD1; Fri, 13 Jul 2018 15:31:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A0A6429CED for ; Fri, 13 Jul 2018 15:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=gLs2jqzqTtBRqHS6SrfPuN7p+rwS29MwV6L9DeCbeJ0=; b=d4nw59SgCFRu07U8A/SFXhAtJ3 mWkCXv1tm4b2IDssshK/aKuDe3/pxu1cmzJefTrHzfdLGX71qHrTGWyWCYHw/XqYnrvane5EIFuIE m4oR+FLo0sAj/NXIgbC0Z9yBUU62IQD6idTFhSub0lYeEouuFVO3dsUBVtJLuu89/P8gplhHcqkgn Q5pf5gymKnJV3Hi/kwOT1L0pFGq6yLAMAzm4Y2/jbciIGzteyXQQXL6+yK8gxQ+eeXA54wh1C+af4 kGXTzsw1tPkaFeEgRVlePUfQXuvmZGE2pUZceCmAGkXkHFPfE1NeZmPdojYF1dY5xaiLXa190xVwM b2CAYYxg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fe025-0001yO-K1; Fri, 13 Jul 2018 15:30:57 +0000 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fe021-0001xW-US for linux-arm-kernel@lists.infradead.org; Fri, 13 Jul 2018 15:30:55 +0000 Received: by mail-pl0-x242.google.com with SMTP id f4-v6so8154828plb.9 for ; Fri, 13 Jul 2018 08:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lixom-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ciWjzt1NHGWjS5vKTA/ijV1ahtym+4HbGR1Y0dLCQ0o=; b=w6Yg8QvQFtmGoH0Z4ktJIDuW5l7aBK+zHagMbzPPi1oQ5tFhU4v2NOcb+5dnbYnzIT BGW+S6l1Un+NjIEWfq3bvVsJ/sFoC91oq/n42eGIwgf0G6R/bzYJkz0KwWoEi5qT0pSb TFltgL8EUjkdA8LV4ARDGIYqC/7eIRGM1ftIxQEarBsMR6TOZeeen89w+K8t+PuU9wUa epfIa9vPgaPcGgYUKo5J1xNvtomfs/RLzY4wil/R1pZiIRr46mNg5kmCagg5R++i49es wOL3A3ZuCBN/6ek2JbyypzC4XsN1YN/BTaLaKnu4EE/wQhRYRG85a6PZqpat4vJcQO9/ MQEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ciWjzt1NHGWjS5vKTA/ijV1ahtym+4HbGR1Y0dLCQ0o=; b=mu0m7tEYnE1plhTi2OCid+mdwq4WaV1vx1QO6OTLkUha1D/0Z6UtcNqJuXhxRc0rlW 9+M8W5UEXFfkPKRI624vR69KvvTu9W75lEizB8PsfJZAWNVI9/dQfppQlqmqW0wL5MQW AHW1Bwt4nKeUmGOsBz2Y0B53i57hCGjmTE5nhKQcP58HI7ay3MQn2JoXqfsUlWmVB2Hb Erf+/ZXgjaTzBf6Fcf/E8VQr4tpjlQImVVheJfQ+8o/zpcZqnVefHdaFK7PLrVTueFOS S9wO6DDPbLSmyjlj/3MmOK644O5X/FTwM+IWS78PU/frQvzaMP2lJdl7vTxt7rmYDyYq fIsA== X-Gm-Message-State: AOUpUlGf8mjpd1a3aMHGndNfV8/K9GoMHbW46IjEWY4iPd7rzxCVJ0FZ WFTMP4VMACgIwA4w7oddt1JLdg== X-Google-Smtp-Source: AAOMgpf1sK5nvpu724GMOdErS0WEK6rxS53VyMdh/wSKiKXYI7XqTynPcozJ/SnblaRSDMjouLDoNQ== X-Received: by 2002:a17:902:bf0b:: with SMTP id bi11-v6mr6714436plb.25.1531495842796; Fri, 13 Jul 2018 08:30:42 -0700 (PDT) Received: from localhost.localdomain (99-152-116-91.lightspeed.sntcca.sbcglobal.net. [99.152.116.91]) by smtp.gmail.com with ESMTPSA id c29-v6sm21192139pfe.169.2018.07.13.08.30.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 08:30:41 -0700 (PDT) From: Olof Johansson To: Will Deacon , Catalin Marinas Subject: [PATCH] arm64: build with baremetal linker target instead of Linux when available Date: Fri, 13 Jul 2018 08:30:33 -0700 Message-Id: <20180713153033.20540-1-olof@lixom.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180713150701.GA3049@arm.com> References: <20180713150701.GA3049@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180713_083053_988857_713B3332 X-CRM114-Status: GOOD ( 13.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Marek , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Kocialkowski , Masahiro Yamada , Olof Johansson , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Laura Abbott Acked-by: Masahiro Yamada --- 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)