From patchwork Thu Jun 20 17:29:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw (lists)" X-Patchwork-Id: 1119637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-503389-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="cuss0g2H"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45V82801sQz9s7h for ; Fri, 21 Jun 2019 03:29:18 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=jsiHYzV98O/F+/xwpoRpYjpFmrCcquM+qalHzHV0b7s1qxkoRm eU4pGqpTIK9KC+qAI7Gkj8xtEvsW2Sr+g8GqDPFi9gXSWCb8ouYh0JYdprKxL2Sb lY64+Y5xlWAsP2rdQOnHUboavrdicvDxXb4HnhmDcPkWRvyP/aB/OLlec= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=eGz4Gyw4W3A4MzbdHTyTVhJkZ1A=; b=cuss0g2HpQ9rLzoyk+EK SsB3BrEfTy6uGuCNuvJMVgNwt2C2JdQLkoVbLnHcYeCVeP+LIUDngTtwBcjpBq/M 3TRQiLKue75OzOhcYcaXDu46Cz4I5IQCO2xZa0KtHwW2tFmh1UCN28p6rmJwInWz ktEyz3RgPrvpUlREi5HSdSU= Received: (qmail 30158 invoked by alias); 20 Jun 2019 17:29:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30150 invoked by uid 89); 20 Jun 2019 17:29:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT autolearn=ham version=3.3.1 spammy=long-term, longterm, Cross, UD:aarch64-netbsd.h X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Jun 2019 17:29:08 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 15AA3360; Thu, 20 Jun 2019 10:29:06 -0700 (PDT) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.206.226]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 975FD3F246; Thu, 20 Jun 2019 10:29:05 -0700 (PDT) To: gcc-patches From: "Richard Earnshaw (lists)" Subject: [aarch64] Refactor common errata work-around specs Openpgp: preference=signencrypt Message-ID: Date: Thu, 20 Jun 2019 18:29:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 I noticed while adding the AArch64 NetBSD support code that we now had four ports all using and defining the same errata work-around headers. That's silly and long-term becomes a maintenance burden. So this patch factors all that code into a single header to eliminate all the duplication. * config/aarch64/aarch64-errata.h: New file. * config/aarch64/aarch64-elf-raw.h (CA53_ERR_835769_SPEC): Delete. (CA53_ERR_843419_SPEC): Delete. (LINK_SPEC): Use AARCH64_ERRATA_LINK_SPEC instead of above. * config/aarch64/aarch64-linux.h: Likewise. * config/aarch64/aarch64-netbsd.h: Likewise. * config/aarch64/aarch64-freebsd.h: Likewise. Full bootstrap on aarch64 linux. Cross built the other targets and manually verified that the specs file has the right contents. Committed to trunk. R. diff --git a/gcc/config.gcc b/gcc/config.gcc index fda048dc12b..33c5ddebc96 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -980,7 +980,7 @@ esac case ${target} in aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h" - tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h" tmake_file="${tmake_file} aarch64/t-aarch64" case $target in aarch64-*-elf*) @@ -1017,19 +1017,19 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) ;; aarch64*-*-freebsd*) tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file}" - tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-freebsd.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-freebsd.h" tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-freebsd" tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1" ;; aarch64*-*-netbsd*) tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file}" - tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-netbsd.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-netbsd.h" tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd" extra_options="${extra_options} netbsd.opt netbsd-elf.opt" ;; aarch64*-*-linux*) tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h" - tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-linux.h" tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-linux" tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1" case $target in diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h index bbebd0ef029..8fe7b378360 100644 --- a/gcc/config/aarch64/aarch64-elf-raw.h +++ b/gcc/config/aarch64/aarch64-elf-raw.h @@ -27,22 +27,6 @@ " crtend%O%s crtn%O%s " \ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" -#if TARGET_FIX_ERR_A53_835769_DEFAULT -#define CA53_ERR_835769_SPEC \ - " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}" -#else -#define CA53_ERR_835769_SPEC \ - " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}" -#endif - -#if TARGET_FIX_ERR_A53_843419_DEFAULT -#define CA53_ERR_843419_SPEC \ - " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}" -#else -#define CA53_ERR_843419_SPEC \ - " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}" -#endif - #ifndef LINK_SPEC #define LINK_SPEC "%{h*} \ %{static:-Bstatic} \ @@ -51,8 +35,7 @@ %{!static:%{rdynamic:-export-dynamic}} \ %{mbig-endian:-EB} %{mlittle-endian:-EL} -X \ -maarch64elf%{mabi=ilp32*:32}%{mbig-endian:b}" \ - CA53_ERR_835769_SPEC \ - CA53_ERR_843419_SPEC + AARCH64_ERRATA_LINK_SPEC #endif #endif /* GCC_AARCH64_ELF_RAW_H */ diff --git a/gcc/config/aarch64/aarch64-errata.h b/gcc/config/aarch64/aarch64-errata.h new file mode 100644 index 00000000000..8f062536e8b --- /dev/null +++ b/gcc/config/aarch64/aarch64-errata.h @@ -0,0 +1,44 @@ +/* Machine description for AArch64 architecture. + Copyright (C) 2009-2019 Free Software Foundation, Inc. + Contributed by ARM Ltd. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_AARCH64_ERRATA_H +#define GCC_AARCH64_ERRATA_H + +#if TARGET_FIX_ERR_A53_835769_DEFAULT +#define CA53_ERR_835769_SPEC \ + " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}" +#else +#define CA53_ERR_835769_SPEC \ + " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}" +#endif + +#if TARGET_FIX_ERR_A53_843419_DEFAULT +#define CA53_ERR_843419_SPEC \ + " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}" +#else +#define CA53_ERR_843419_SPEC \ + " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}" +#endif + +#define AARCH64_ERRATA_LINK_SPEC \ + CA53_ERR_835769_SPEC \ + CA53_ERR_843419_SPEC + +#endif /* GCC_AARCH64_ERRATA_H */ diff --git a/gcc/config/aarch64/aarch64-freebsd.h b/gcc/config/aarch64/aarch64-freebsd.h index 899e6f95e34..7a3e89b1b0e 100644 --- a/gcc/config/aarch64/aarch64-freebsd.h +++ b/gcc/config/aarch64/aarch64-freebsd.h @@ -46,26 +46,8 @@ -X" SUBTARGET_EXTRA_LINK_SPEC " \ %{mbig-endian:-EB} %{mlittle-endian:-EL}" -#if TARGET_FIX_ERR_A53_835769_DEFAULT -#define CA53_ERR_835769_SPEC \ - " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}" -#else -#define CA53_ERR_835769_SPEC \ - " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}" -#endif - -#ifdef TARGET_FIX_ERR_A53_843419_DEFAULT -#define CA53_ERR_843419_SPEC \ - " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}" -#else -#define CA53_ERR_843419_SPEC \ - " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}" -#endif - #undef LINK_SPEC -#define LINK_SPEC FBSD_TARGET_LINK_SPEC \ - CA53_ERR_835769_SPEC \ - CA53_ERR_843419_SPEC +#define LINK_SPEC FBSD_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC #define GNU_USER_TARGET_MATHFILE_SPEC \ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h index 5e8b34ded03..6ff2163b633 100644 --- a/gcc/config/aarch64/aarch64-linux.h +++ b/gcc/config/aarch64/aarch64-linux.h @@ -46,25 +46,8 @@ %{mbig-endian:-EB} %{mlittle-endian:-EL} \ -maarch64linux%{mabi=ilp32:32}%{mbig-endian:b}" -#if TARGET_FIX_ERR_A53_835769_DEFAULT -#define CA53_ERR_835769_SPEC \ - " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}" -#else -#define CA53_ERR_835769_SPEC \ - " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}" -#endif - -#if TARGET_FIX_ERR_A53_843419_DEFAULT -#define CA53_ERR_843419_SPEC \ - " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}" -#else -#define CA53_ERR_843419_SPEC \ - " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}" -#endif - -#define LINK_SPEC LINUX_TARGET_LINK_SPEC \ - CA53_ERR_835769_SPEC \ - CA53_ERR_843419_SPEC + +#define LINK_SPEC LINUX_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC #define GNU_USER_TARGET_MATHFILE_SPEC \ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" diff --git a/gcc/config/aarch64/aarch64-netbsd.h b/gcc/config/aarch64/aarch64-netbsd.h index 2686a1b7ae7..e6c9264bd4a 100644 --- a/gcc/config/aarch64/aarch64-netbsd.h +++ b/gcc/config/aarch64/aarch64-netbsd.h @@ -39,27 +39,10 @@ "%{mlittle-endian:-EL -m " TARGET_LINKER_LITTLE_EMULATION "} " \ "%(netbsd_link_spec)" -#if TARGET_FIX_ERR_A53_835769_DEFAULT -#define CA53_ERR_835769_SPEC \ - " %{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}" -#else -#define CA53_ERR_835769_SPEC \ - " %{mfix-cortex-a53-835769:--fix-cortex-a53-835769}" -#endif - -#ifdef TARGET_FIX_ERR_A53_843419_DEFAULT -#define CA53_ERR_843419_SPEC \ - " %{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}" -#else -#define CA53_ERR_843419_SPEC \ - " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}" -#endif - #undef LINK_SPEC #define LINK_SPEC NETBSD_LINK_SPEC_ELF \ NETBSD_TARGET_LINK_SPEC \ - CA53_ERR_835769_SPEC \ - CA53_ERR_843419_SPEC + AARCH64_ERRATA_LINK_SPEC #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \