Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp924378imm; Fri, 13 Jul 2018 08:32:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpczwnhTkwtYnIPbj9RxtZGHcFdk72eDuGYyj/34U/WXB2pp+58jIFmLHPvcHNc34YjxO54Q X-Received: by 2002:a63:941a:: with SMTP id m26-v6mr6454953pge.82.1531495948011; Fri, 13 Jul 2018 08:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531495947; cv=none; d=google.com; s=arc-20160816; b=YfQYZHI/XL4YSkj5VhlnrrWXdRgns85LgJgVbVchSVC0eVDzyf9YH46+2VcKdNRStQ rta8g+N3KMOus0QEqv0Trj5rUECQbDJ5EQtxCDca9u6BmScH5351swInvF26MIFFbH+0 KQekmF1ddiW0uC8PzRAZBX7jPfCgCOcP2oOLnE/44ygwD/w5SZ0YOhvWjZIRe0zuqDSo WGdWB2r39OfHU5dzB8062djyKhZMDoK6TYSe9nNkpK+yKmxz1zs2gktboTjse3CqETkx tDRm9P5cGVGe6Kqv03Y55IH6T7jqCDtgm7azM/L/gsQ9dAMn3uTdetWGAdjY87CVcCE+ Gfpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ciWjzt1NHGWjS5vKTA/ijV1ahtym+4HbGR1Y0dLCQ0o=; b=Y5eSIfBlhQF2f6jRe2ATkgqtwEqwOqnm2SN3pY7LRfoxR/CAfbUemEEsQtYy/cz7Dn PdLlhLkElO56Dlpdjmmy7VSh0TmHpPxUKL3ZeWBD8NOt+i/DNKAWiaA2W/3cGKqIBK06 G8hu0jVubWTOVwKLJDT8C6dfQ7t1GdYRI11FDioJhwsmxssM1bOIjLreor+ZZ5cKE1GX VtFmOtvM7NxfepBlbcztU8+gZDogJnncAab4luTCAlWVkhml/e164WxXxb/5HP2Uk7JV 35AcfR/doUKCfexVL+5TahOX2p9RHDCWW3GYxZpwr4abdUtApqV+BTIAL0KauMOn/4hD pjaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=w6Yg8QvQ; 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 2-v6si24437351ple.192.2018.07.13.08.32.13; Fri, 13 Jul 2018 08:32:27 -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=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=w6Yg8QvQ; 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 S1730848AbeGMPpt (ORCPT + 99 others); Fri, 13 Jul 2018 11:45:49 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:32830 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729781AbeGMPpt (ORCPT ); Fri, 13 Jul 2018 11:45:49 -0400 Received: by mail-pl0-f68.google.com with SMTP id 6-v6so12347091plb.0 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=KaYp5TkZLaKmtWPBmbB4zS6mPNbg6sZ0BpfgC5mmUrJbuMkvcH9Ec4UPDiBcDiiS0A SrLpwF2QcDcQB/HtHjv6Cr6eWmvBjOqJqAlz9x4F8vhiCtzzmDoiRTTYm+ERKJA+eGR+ /pIOSTC0dlUg5n8D+e1+lcEFipawi3lP4hsqwlOQ+qgBVrqLuAf/wk/T6MjMWL37beM8 DM7LGVW2Rg/LPF8MsltUWA5L/RW7rKzgbHedYA1rXjNcClnTvsoLkniaW9pRiQI8GKkX rIx3/1f1N36kgY3I5OphJPiiyimDXdnvAXdo2zcQZ5oxHhJ1ONBb80G3da6DI/iPSipe emHg== X-Gm-Message-State: AOUpUlE5bo1gGr1qG1XFcj6VaiGDiYka3sWA2K38NHiMKy4vJjyxumkf EpuPfq8K/0lxuqAKU0s3X1PVFg== 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 Cc: Masahiro Yamada , Michal Marek , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Olof Johansson , Paul Kocialkowski 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.11.0