From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2097.outbound.protection.outlook.com [40.107.215.97]) by sourceware.org (Postfix) with ESMTPS id 0CAF6385B524 for ; Fri, 12 May 2023 10:03:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0CAF6385B524 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cipunited.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cipunited.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e1ZUG+BMx+C6HRHt5cXcmWZmr2xRM6eoplqbhC/VPVPpfbKlxc9JzMWJE5Gl3UfkdPILWFifjqsRPtOF6B3PKpuNiWBX6j8kQ4ZranBCjL1plMe89ee4ag/TL6LSTtuj1j5/9cERFkNhEYwe6xuBVnHs4ASJOm0l9lLIYOc1/ChQDTxZ+BdC5gqg+JB2uzgdODxWrOMSPRQUF6qeeWlOkK0X8UlejkiS7W/wEOuyuSJ4sq93hZc757WGoHkFONfMgs/6Tey3Lp52T5pOhczAlMkc8vA0PQAFr+4Qux62oHi/UflBziihWYr4Pg1dkqxjdfPuEEJG0dLGMvsZJRK7aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=phzNcIfNfRYyRKdc9CxrX9gl5chRzn/VegFI9j2pssA=; b=GPFmr+hSC3jIbC/trRnHIXRhUXbnCUIe4iArc/az0sibYJ+t0lhmJiaDpJWH/MM0psL5gV6hH/jq7N9R0zCCg+Z+YAlE4RvHOlJN4Oqsp6Pami4MUy35lF+G0+VVzaf3RD1PNfwiNXfVhagsw/Oq6Vl+2bakuqmZulysU3lG95Ru/jvvL5Bk4sO/fcSafRacp39xwzdewaouRVVGmsULcpRVXtfbPEiLVEXq2SmO/5W9ouy+KeXoCA+RHli+vE21sFAla0IShQEW1bsbtiJh0Nces/SuhVXtGuE4/f4QpDFYnbHToiLpfbT+k51gMvPsnyETXrNbmRRBB5PJGy8QJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cipunited.com; dmarc=pass action=none header.from=cipunited.com; dkim=pass header.d=cipunited.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cipunited.onmicrosoft.com; s=selector1-cipunited-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=phzNcIfNfRYyRKdc9CxrX9gl5chRzn/VegFI9j2pssA=; b=NYj6i182zbmcnt2Ie6MFOwgNficfT6MUtYIKU+aA3s5Ndjcvs14hoBKVWA1J+UXuffXTwF8bRNX4Kmx3HpvV6RArgpOXaos5lvZ02mgUHTJkyNjXQN4Xh7WJ2/mrY83nGDqlkURBcYzRxc01Y+1AVrXCW5+tvUiA0FXGDcx8/1c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cipunited.com; Received: from TYZPR04MB6117.apcprd04.prod.outlook.com (2603:1096:400:25a::9) by SI2PR04MB4172.apcprd04.prod.outlook.com (2603:1096:4:fb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.23; Fri, 12 May 2023 10:03:45 +0000 Received: from TYZPR04MB6117.apcprd04.prod.outlook.com ([fe80::4016:87b:f0d1:b150]) by TYZPR04MB6117.apcprd04.prod.outlook.com ([fe80::4016:87b:f0d1:b150%6]) with mapi id 15.20.6387.021; Fri, 12 May 2023 10:03:43 +0000 From: YunQiang Su To: gcc-patches@gcc.gnu.org Cc: syq@debian.org, macro@orcam.me.uk, xry111@xry111.site, richard.sandiford@arm.com, jiaxun.yang@flygoat.com, amodra@gmail.com, YunQiang Su Subject: [PATCH v3] MIPS: add speculation_barrier support Date: Fri, 12 May 2023 18:03:27 +0800 Message-Id: <20230512100327.1941926-1-yunqiang.su@cipunited.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230428131249.713463-1-yunqiang.su@cipunited.com> References: <20230428131249.713463-1-yunqiang.su@cipunited.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYWPR01CA0051.jpnprd01.prod.outlook.com (2603:1096:400:17f::7) To TYZPR04MB6117.apcprd04.prod.outlook.com (2603:1096:400:25a::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR04MB6117:EE_|SI2PR04MB4172:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d4f1bea-30ae-4936-4aea-08db52d02b32 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4c9hr+dL7Dlnk8/Cs3ASJMpakwin5WqFsgw6/lY5AykziI/E7QR1dVzINhQAbWBA1pAIQhLBylhNlir7/eDD5kTCxH3Rkm+x0p7n1b8SZxAXDcJMvQPunijDFWHO9URbTt/Fdp9PCp/gYF7aZSZqMH6vwqXv+hfXzRut1omj9/K0aVjwxTZbP8HYaxP09RxrlsyRxLujZhYHtlCSWW/thm4cXI74QLhfCM3n1op7Yq8tzaaNI9fXTNKyfPjWltHdTtG+CY+2koMgbMOfUgFoFfkzteFljq5ADJ22Hdru7m826lYy/y6KDhWxz73Zn8dpV3deFnizCyJNk5XbTlNGYRKDVIpYy//IMK8L9+jy6KRbNBztxA4l3ns5Mz5a0lT+xl/WXk7p5YyaWfvN201cVOetu4IPPVLmidvrQglRBdil+3oCg1J19/ZfNon7fXWzvogJ+ySgtbeqFbrZ+4C2J/kFUYRAylVH1fml6M6TE61u8hrC6BBhtqGwqh4RtRyGNYaadXtoj6CDmHM/K77v7ZribQobGRUeiUK0LlDTC1n6t0foVUSXWbInH/CEdoIlbbomWZg5mDORQR31cPHcW4Uc4Dz7hbiyF5gB/JwelHDuklYT3MbWzD50Y2GyEoS8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR04MB6117.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(136003)(346002)(396003)(376002)(39830400003)(451199021)(6486002)(2906002)(6512007)(38350700002)(38100700002)(52116002)(1076003)(2616005)(186003)(6506007)(107886003)(26005)(30864003)(83380400001)(8936002)(8676002)(478600001)(36756003)(6666004)(4326008)(6916009)(5660300002)(316002)(41300700001)(66556008)(86362001)(66476007)(66946007)(2004002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GhW35XlfkfHpaPRnJFqhoD2k3ARNVfJG3vfFn4iwDZQcpHeWao673XhyXvhy?= =?us-ascii?Q?DsBbZIb1Smt/uwIyFhY2yi3/3RAHkc9JuTYjt4gYKzACPbcr/SVRLEbGCsrS?= =?us-ascii?Q?5z4oXcTpsQaoYk72SBu8umbjEP8JxZLYYqPYCsTvhLjNVSeGf8IKwyE4g6w7?= =?us-ascii?Q?7Qpzuxdjpb89k836Bf73jLNf2AV5SMOVNzgqSZhPxBe51mCRPmo8DdtF1WrI?= =?us-ascii?Q?8rqTYlDz8lesdyqjUJqhRPibixxb0q1M9hKU0yumfsg27eWNZRlqmS2munDZ?= =?us-ascii?Q?RPd80xSFY+kkp6gDf1pqvqaopYry/JbNwGGGnRfTi6NY6m/yBsaVNVhLp1Q4?= =?us-ascii?Q?CxNXePUwt3BNf/BXUVnEVYwoBJ6AHkcZFXmKuLuUEfu6A2pq+noRR0ZSURYi?= =?us-ascii?Q?guNXT/HlUStYTA9Ndb3a+STiFzgpT+bZQmJIJoHkPuTLcoi/YX/qfj9tUAeP?= =?us-ascii?Q?tLwls/66GLlA+SB6oZSROIgMyp2GbegvPUf8s+qTJewlAw/6N+KYAa0zWMM9?= =?us-ascii?Q?orHKRvzwDJlEy9dD8VGq4CUl780lN0lsvdieoynQh67UMNk3m1oWrKZlX5af?= =?us-ascii?Q?Xk0XZpWvg09yvXBFq6RwWrc0iO6Wmwh1yk/qFBXDsIXaYFDbpAvS4PkcJ+ft?= =?us-ascii?Q?YhrFwzeLl0cQVf+doHARxHCxOzGiGyhEw4XUjhb/6BjZbBZ4iUbR3aHG0sDO?= =?us-ascii?Q?rIuQArtGYMUHnY/Qs3HU6SPPaFCOilfsRd79bPd5Bf+FlgnRFW5kC4pgwr6c?= =?us-ascii?Q?r6DMTXQygbkMhPfWBELNrVdbYra/YuA+5454Wt+LC32UEDAEVUvnQWiddHof?= =?us-ascii?Q?tLUbhTH9wu8X1IALh+TpFKcsIjPfrSW8Nl3CdlIF7Na4FxqKIH/zgIg2fFXy?= =?us-ascii?Q?VnT5nCT9MkXKVH7IN7rrfekgKTOo8u4nK3XwuI6f5gLVHMVVAY5HvmqZLTFv?= =?us-ascii?Q?8/qDT8vdVHz95vFDN7oFlOjnd+VBwektAsm0IKs1yzA0R4mXVV/r6rsYbIiZ?= =?us-ascii?Q?eY29gzVfl3CNbhM8edQaWZdHL2wtssd3bwjumySrvhO7kFtOeNJl87Vua3tW?= =?us-ascii?Q?cXkja5Kz4EvbdODSez+DxqfKaZbexEgegmjtFXEhb58QRwA0Q2Og9JFbjePN?= =?us-ascii?Q?ds3g7PTdeN1J8/oT091eciCzefO51NyfydHqCKp6+DHF510RsyuihDIVxq1l?= =?us-ascii?Q?/J1L03KsaWf7fnKMeG8EJEqVQYj5XdweEVacQ9e8YFOAqabmwWdBuhCCwW+6?= =?us-ascii?Q?Z0VZciymq6TxuscfCL8KgrjV6CsO5ufQsUAEFbw1PmpjzpCicFkaUsjylkU/?= =?us-ascii?Q?qIQqDNOlZKzUB3WaUYvQnn56AarD+59PhpLJf+Xbh/rMBbqOjU/BYz12UDeY?= =?us-ascii?Q?DNPnqxKNA/a6IAjcCdTZQhCAy3o3ChJhD6B8PzMb5XQdpN5Reqg6zZvisijJ?= =?us-ascii?Q?ji2KWeLR8TnYRIDOYjUlwRMQxpGW7/ooGk9K0slaC/4+rz+8jKW7r7T5AqEZ?= =?us-ascii?Q?WqD8P6MVbrWd3ZnONAw51pGovXkEF8qOQmookKQ8L7BoAih1kKBpFl8TzOgl?= =?us-ascii?Q?2FXLwiwmXsmNVfoelkxoPkumBD//Ee/tl/4BGUvlfYYCHiKKhxWGLGwrmxei?= =?us-ascii?Q?Ww=3D=3D?= X-OriginatorOrg: cipunited.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d4f1bea-30ae-4936-4aea-08db52d02b32 X-MS-Exchange-CrossTenant-AuthSource: TYZPR04MB6117.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 10:03:43.7598 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e31cf5b5-ee69-4d5f-9c69-edeeda2458c0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Xu5QxMh/UfZgxoXrLt+cqQG6k/en6xUpDDQ/5vY2jFw0HPbN5J2tvZzFDOBz4+TlwLMJ45SCOFAQYlMHRf84QNSF7lSxNLwVph186LpOx5s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB4172 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: speculation_barrier for MIPS needs sync+jr.hb (r2+), so we implement __speculation_barrier in libgcc, like arm32 does. gcc/ChangeLog: * config/mips/mips-protos.h (mips_emit_speculation_barrier): New prototype. * config/mips/mips.cc (speculation_barrier_libfunc): New static variable. (mips_init_libfuncs): Initialize it. (mips_emit_speculation_barrier): New function. * config/mips/mips.md (speculation_barrier): Call mips_emit_speculation_barrier. * configure.ac: error if gas doesn't accept ssnop for mips1. * configure: regenerated. * doc/install.texi: documents mips requires binutils 2.21+. libgcc/ChangeLog: * config/mips/lib1funcs.S: New file. define __speculation_barrier and include mips16.S. * config/mips/t-mips: define LIB1ASMSRC as mips/lib1funcs.S. define LIB1ASMFUNCS as _speculation_barrier. set version info for __speculation_barrier. * config/mips/libgcc-mips.ver: New file. * config/mips/t-mips16: don't define LIB1ASMSRC as mips16.S is included in lib1funcs.S now. --- gcc/config/mips/mips-protos.h | 2 + gcc/config/mips/mips.cc | 13 ++++++ gcc/config/mips/mips.md | 12 ++++++ gcc/configure | 32 +++++++++++++++ gcc/configure.ac | 7 ++++ gcc/doc/install.texi | 2 + libgcc/config/mips/lib1funcs.S | 63 ++++++++++++++++++++++++++++++ libgcc/config/mips/libgcc-mips.ver | 21 ++++++++++ libgcc/config/mips/t-mips | 7 ++++ libgcc/config/mips/t-mips16 | 3 +- 10 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 libgcc/config/mips/lib1funcs.S create mode 100644 libgcc/config/mips/libgcc-mips.ver diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index 20483469105..da7902c235b 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -388,4 +388,6 @@ extern void mips_register_frame_header_opt (void); extern void mips_expand_vec_cond_expr (machine_mode, machine_mode, rtx *); extern void mips_expand_vec_cmp_expr (rtx *); +extern void mips_emit_speculation_barrier_function (void); + #endif /* ! GCC_MIPS_PROTOS_H */ diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index ca822758b41..139707fda34 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -13611,6 +13611,9 @@ mips_autovectorize_vector_modes (vector_modes *modes, bool) return 0; } + +static GTY(()) rtx speculation_barrier_libfunc; + /* Implement TARGET_INIT_LIBFUNCS. */ static void @@ -13680,6 +13683,7 @@ mips_init_libfuncs (void) synchronize_libfunc = init_one_libfunc ("__sync_synchronize"); init_sync_libfuncs (UNITS_PER_WORD); } + speculation_barrier_libfunc = init_one_libfunc ("__speculation_barrier"); } /* Build up a multi-insn sequence that loads label TARGET into $AT. */ @@ -19092,6 +19096,15 @@ mips_avoid_hazard (rtx_insn *after, rtx_insn *insn, int *hilo_delay, } } +/* Emit a speculation barrier. + JR.HB is needed, so we need to put + speculation_barrier_libfunc in libgcc */ +void +mips_emit_speculation_barrier_function () +{ + emit_library_call (speculation_barrier_libfunc, LCT_NORMAL, VOIDmode); +} + /* A SEQUENCE is breakable iff the branch inside it has a compact form and the target has compact branches. */ diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index ac1d77afc7d..5d04ac566dd 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -160,6 +160,8 @@ ;; The `.insn' pseudo-op. UNSPEC_INSN_PSEUDO UNSPEC_JRHB + + VUNSPEC_SPECULATION_BARRIER ]) (define_constants @@ -7455,6 +7457,16 @@ mips_expand_conditional_move (operands); DONE; }) + +(define_expand "speculation_barrier" + [(unspec_volatile [(const_int 0)] VUNSPEC_SPECULATION_BARRIER)] + "" + " + mips_emit_speculation_barrier_function (); + DONE; + " +) + ;; ;; .................... diff --git a/gcc/configure b/gcc/configure index 191f68581b3..e55b40d7f4c 100755 --- a/gcc/configure +++ b/gcc/configure @@ -28699,6 +28699,38 @@ $as_echo "#define HAVE_LD_PERSONALITY_RELAXATION 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for mips1 recognize ssnop" >&5 +$as_echo_n "checking assembler for mips1 recognize ssnop... " >&6; } +if ${gcc_cv_as_mips1_ssnop+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_mips1_ssnop=no + if test x$gcc_cv_as != x; then + $as_echo 'ssnop' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mabi=32 -mips1 -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + echo $ac_try + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_mips1_ssnop=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_mips1_ssnop" >&5 +$as_echo "$gcc_cv_as_mips1_ssnop" >&6; } + + + if test x$gcc_cv_as_mips1_ssnop = xno; then + as_fn_error $? "New binutils is required to support ssnop even for MIPS I: 2.21+" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -mnan= support" >&5 $as_echo_n "checking assembler for -mnan= support... " >&6; } if ${gcc_cv_as_mips_nan+:} false; then : diff --git a/gcc/configure.ac b/gcc/configure.ac index 075424669c9..6d2cb4c51a0 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -5270,6 +5270,13 @@ EOF pointers into PC-relative form.]) fi + gcc_GAS_CHECK_FEATURE([mips1 recognize ssnop], gcc_cv_as_mips1_ssnop, + [-mabi=32 -mips1], [ssnop],,,) + if test x$gcc_cv_as_mips1_ssnop = xno; then + AC_MSG_ERROR( + [New binutils is required to support ssnop even for MIPS I: 2.21+]) + fi + gcc_GAS_CHECK_FEATURE([-mnan= support], gcc_cv_as_mips_nan, [-mnan=2008],,, diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index fa91ce1953d..fae6ec5f7a9 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -4610,6 +4610,8 @@ the use of break, use the @option{--with-divide=breaks} @command{configure} option when configuring GCC@. The default is to use traps on systems that support them. +GNU Binutils 2.21 or newer is required. + @html
@end html diff --git a/libgcc/config/mips/lib1funcs.S b/libgcc/config/mips/lib1funcs.S new file mode 100644 index 00000000000..b6e7c1362dd --- /dev/null +++ b/libgcc/config/mips/lib1funcs.S @@ -0,0 +1,63 @@ +/* Copyright (C) 2023 Free Software Foundation, Inc. + +This file 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. + +This file 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. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "mips16.S" + +#ifdef L_speculation_barrier + +/* MIPS16e1 has no sync/jr.hb instructions, and MIPS16e2 lacks of jr.hb. + So, we use normal MIPS code here, just like what we do for __sync_* */ + .set nomips16 + + .set noreorder + .globl __speculation_barrier + .ent __speculation_barrier + +__speculation_barrier: + .set push +#if __mips >= 2 || defined(__linux) + /* MIPS1 has no sync. while Linux can trap&emu sync */ + /* FIXME: Will somebody use linux/gcc for MIPS1/baremetal? */ + sync /* complementation barrier for memory */ +#else + /* ssnop is actually available since R5500, + and it will be decoded as nop on earlier processors. + gas can recognize it even with -march=mips1 since 2.21 */ + /* MIPS1 to MIPSr1: R10000 have 7 stage pipeline, + so 8 ssnop is sufficient to block all speculation on all CPUs */ + .rept 8 + ssnop + .endr +#endif + + +#if __mips_isa_rev >= 1 + /* yes, the below one is the encoding, don't remove this arm, + since r6 changes the encoding */ + jr.hb $ra /* Jump with instruction hazard barrier */ +#else + .word 0x03e00408 /* The encoding of jr.hb $ra */ +#endif + .set pop + .end __speculation_barrier + + .set reorder +#endif diff --git a/libgcc/config/mips/libgcc-mips.ver b/libgcc/config/mips/libgcc-mips.ver new file mode 100644 index 00000000000..68f8d2bbd51 --- /dev/null +++ b/libgcc/config/mips/libgcc-mips.ver @@ -0,0 +1,21 @@ +# Copyright (C) 2023 Free Software Foundation, Inc. +# +# 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 +# . + +GCC_14.0 { + __speculation_barrier +} diff --git a/libgcc/config/mips/t-mips b/libgcc/config/mips/t-mips index 4fb8e136217..d05ef7cbf74 100644 --- a/libgcc/config/mips/t-mips +++ b/libgcc/config/mips/t-mips @@ -7,3 +7,10 @@ softfp_truncations := softfp_exclude_libgcc2 := n LIB2ADD_ST += $(srcdir)/config/mips/lib2funcs.c + + +LIB1ASMSRC = mips/lib1funcs.S +LIB1ASMFUNCS = _speculation_barrier + +# Version these symbols if building libgcc.so. +SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips.ver diff --git a/libgcc/config/mips/t-mips16 b/libgcc/config/mips/t-mips16 index 2bad5119d51..5fd9d60d7a3 100644 --- a/libgcc/config/mips/t-mips16 +++ b/libgcc/config/mips/t-mips16 @@ -16,8 +16,7 @@ # along with GCC; see the file COPYING3. If not see # . -LIB1ASMSRC = mips/mips16.S -LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \ +LIB1ASMFUNCS += _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \ _m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \ _m16unordsf2 \ _m16fltsisf _m16fix_truncsfsi _m16fltunsisf \ -- 2.30.2