From patchwork Sat Sep 23 23:21:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liushuyu X-Patchwork-Id: 144017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp409695vqu; Sat, 23 Sep 2023 16:22:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBg7+Ewvcd9DFBinTZ9nqcOcM0Svj/jQY5YNR2qiUu2oPzkDiDscWHN0bQO9rRn1DvLCsx X-Received: by 2002:a17:907:868f:b0:9a5:962c:cb6c with SMTP id qa15-20020a170907868f00b009a5962ccb6cmr10555679ejc.31.1695511335427; Sat, 23 Sep 2023 16:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695511335; cv=none; d=google.com; s=arc-20160816; b=igRHoIHGhGh5Gc0aYPLYjnNPMc7ANC0709r7Sr8JejnL2tm/mMEomAN3w6y83Pjd9i SqXkndvth4iH1zn0cJ+t59zCNfkTtdxZoHTHpPrOWu52TV9Tk4pUzA6919ynaCal2V5u li7CbWJn6HE3ketvFFygcPT1NArjOu/bS+FvLd72ekLBeSoALrb0Odif//5phyNhRd0c SNE+ZTf20fNjdTizmi117E6gRRL2Q1Xbf9sWtqvIo52meuKvk4B9+F6NkNiwsoaOfrwW akRIzLslpduCRmzA3RfBgFq5LWFPVzQDGTJiUh0MlDZ6Wg6NpD1zfPV3COjrczJ7zLWu HCXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :in-reply-to:content-language:references:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature:dmarc-filter :delivered-to; bh=9gMf7Ia9r6n/Es+cbBeciGjSRmCshrXIQKD0HmU8m4E=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=D7pnVEO2Dqy9+ORhhGIqsb0KokF94OHkvF/uEW2d41koi6Y8/1GgDTknpOfroB0P9E yNjPL9Ymg+d3ZbT8PGyKXS+7XczgdrjfU0ryqZ8G523CeWXR+6n9MLzp+E4NGA8TDlt5 BSZ0bvjOf7BkMymxKT+0RktTae2AQMEDQpV3bs+mCFSkkYMmAa8KCyZ+ZJiyct4aR6Jc AdGUuBb5D04t4qeCLcOtJzeFYzWc/ZasUc8KRqxoYzC/T/HkUhCMIviIxFxaL6oo1/13 10TzYmxVRQTZX2twkOODE96XcE02lay3EJmBXn8rNII8m2O+gHXAYtIYl+R2Yw/BUfzl pjsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Qw/1v6h7"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g24-20020a170906869800b00986f786c94asi5551846ejx.113.2023.09.23.16.22.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 16:22:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Qw/1v6h7"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 860AE3856975 for ; Sat, 23 Sep 2023 23:21:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 261CB385773F for ; Sat, 23 Sep 2023 23:21:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 261CB385773F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-277317a0528so220544a91.0 for ; Sat, 23 Sep 2023 16:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695511267; x=1696116067; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:content-language:references :to:reply-to:subject:from:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=9gMf7Ia9r6n/Es+cbBeciGjSRmCshrXIQKD0HmU8m4E=; b=Qw/1v6h7/oxZLQYPzSD9KwpdRuG2UDSHU7Txy6jvqdrCAvD+F/2BlHvasfMxa8e8wn dZrWhyCA0zHwWzw8IDBnqDFbogAU3FnaN1EQdFf6w8M8bhAJA1CLT2tI97e5e17fRqpt 48gn7DLksjZiT27a4wGSKkKBEETusdCtBpEkcl6wLk0UXbxNvyOOeUuhPJNTgiDMDDw2 0MHgobJrFzj5Si5VCSEUHV3LStCPG5M6VJQ18mbBQ82UNm69cPxx7ygwnjkm3OQHbU1C AVNEEq7G5QMlrqUm4S795jkPZ7Gca0YbuvoYwLdLzft2scZ/P3I+AkAcC5yv3xsmw0Gv 0Rcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695511267; x=1696116067; h=content-transfer-encoding:in-reply-to:content-language:references :to:reply-to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9gMf7Ia9r6n/Es+cbBeciGjSRmCshrXIQKD0HmU8m4E=; b=xQyI+5sIhFmLCp6dqjilm9Wh0T5VYED3uXylMHKOWgot+8U+gpqrFThg2l5maB6tdx rgG/LLLXS2uKVST8eVNSSdaFtYFuW3Iu4PE/yLD12lg5cKcX3IbhH+qJc5zyNvmnZFfT NO8Ga7MtOWsvI4uuVstcygvdLD7usADdfqSb6HDq6oGpLxLgs/j8UJiQwGMhyfnyt0M+ jgB05dsNZKAW0bq47qGJx6jDRttjddc1XMqtxWtnMSL2/X7MEaQ3IzzUfZ+Ae8P2A01y MVYhn7rTehXKqBxEgqha6RAqUdTRDmmNSAX1nKbgIJOXXFSakUoo/7SbwCAJPNDwEGjt /iQg== X-Gm-Message-State: AOJu0YyG5rYdnZJkK+fxe8IYDD2LumGeMNGQWNT8wQQ7D5JhBpjAfvFa j/3Cdfa4FTLZFhxRTTWTj+ZELSGaPAXEzA== X-Received: by 2002:a17:903:110d:b0:1c5:cd01:d846 with SMTP id n13-20020a170903110d00b001c5cd01d846mr4177199plh.3.1695511266490; Sat, 23 Sep 2023 16:21:06 -0700 (PDT) Received: from ?IPV6:2001:56a:fa55:2000:5f51:4954:51e1:8176? ([2001:56a:fa55:2000:5f51:4954:51e1:8176]) by smtp.gmail.com with ESMTPSA id jh5-20020a170903328500b001bb9bc8d232sm5896003plb.61.2023.09.23.16.21.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Sep 2023 16:21:05 -0700 (PDT) Message-ID: <24628144-581a-4fcb-9fcb-9a518c79778e@gmail.com> Date: Sat, 23 Sep 2023 17:21:05 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: liushuyu Subject: [PATCH 1/1] gcc/d: add LoongArch64 support for D frontend To: gcc-patches@gcc.gnu.org References: <> Content-Language: en-US In-Reply-To: <> X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, FREEMAIL_REPLYTO_END_DIGIT, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: liushuyu Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777872493680143723 X-GMAIL-MSGID: 1777872493680143723 gcc/ChangeLog: * config.gcc: add loongarch-d.o to d_target_objs for LoongArch architecture. gcc/config/ChangeLog: * loongarch/loongarch-d.cc (loongarch_d_target_versions): add interface function to define builtin D versions for LoongArch architecture. (loongarch_d_handle_target_float_abi): add interface function to define builtin D traits for LoongArch architecture. (loongarch_d_register_target_info): add interface function to register loongarch_d_handle_target_float_abi function. * loongarch/loongarch-d.h: (loongarch_d_target_versions): add function prototype. (loongarch_d_register_target_info): Likewise. * loongarch/t-loongarch: add object target for loongarch-d.cc. gcc/testsuite/ChangeLog: * gdc.test/fail_compilation/reserved_version.d: add reserved version tests for LoongArch architecture and also updated expected output. * gdc.test/fail_compilation/reserved_version_switch.d: Likewise. libphobos/ChangeLog: * configure.tgt: enable libphobos for LoongArch architecture. * configure: Regenerate. * libdruntime/gcc/sections/elf.d: add TLS_DTV_OFFSET constant for LoongArch64. * libdruntime/gcc/unwind/generic.d: add __aligned__ constant for LoongArch64. * libdruntime/Makefile.in: Regenerate. Signed-off-by: Zixing Liu --- gcc/config.gcc | 1 + gcc/config/loongarch/loongarch-d.cc | 82 ++++++++++++++++ gcc/config/loongarch/loongarch-d.h | 26 +++++ gcc/config/loongarch/t-loongarch | 4 + .../fail_compilation/reserved_version.d | 98 +++++++++++-------- .../reserved_version_switch.d | 12 +++ libphobos/configure.tgt | 3 + libphobos/libdruntime/gcc/sections/elf.d | 2 + libphobos/libdruntime/gcc/unwind/generic.d | 1 + 9 files changed, 186 insertions(+), 43 deletions(-) create mode 100644 gcc/config/loongarch/loongarch-d.cc create mode 100644 gcc/config/loongarch/loongarch-d.h diff --git a/gcc/config.gcc b/gcc/config.gcc index ee46d96bf62..782d933b497 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -480,6 +480,7 @@ mips*-*-*) ;; loongarch*-*-*) cpu_type=loongarch + d_target_objs="loongarch-d.o" extra_headers="larchintrin.h lsxintrin.h lasxintrin.h" extra_objs="loongarch-c.o loongarch-builtins.o loongarch-cpu.o loongarch-opts.o loongarch-def.o" extra_gcc_objs="loongarch-driver.o loongarch-cpu.o loongarch-opts.o loongarch-def.o" diff --git a/gcc/config/loongarch/loongarch-d.cc b/gcc/config/loongarch/loongarch-d.cc new file mode 100644 index 00000000000..d7875079212 --- /dev/null +++ b/gcc/config/loongarch/loongarch-d.cc @@ -0,0 +1,82 @@ +/* Subroutines for the D front end on the LoongArch architecture. + Copyright (C) 2017-2023 Free Software Foundation, Inc. + +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 +. */ + +#define IN_TARGET_CODE 1 + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm_d.h" +#include "d/d-target.h" +#include "d/d-target-def.h" + +/* Implement TARGET_D_CPU_VERSIONS for LoongArch targets. */ + +void +loongarch_d_target_versions (void) +{ + if (TARGET_64BIT) + d_add_builtin_version ("LoongArch64"); + else + d_add_builtin_version ("LoongArch32"); + + if (TARGET_ABI_LP64) + d_add_builtin_version ("D_LP64"); + else + d_add_builtin_version ("D_LP32"); + + if (TARGET_HARD_FLOAT_ABI) + { + d_add_builtin_version ("LoongArch_HardFloat"); + d_add_builtin_version ("D_HardFloat"); + } + else if (TARGET_SOFT_FLOAT_ABI) + { + d_add_builtin_version ("LoongArch_SoftFloat"); + d_add_builtin_version ("D_SoftFloat"); + } +} + +/* Handle a call to `__traits(getTargetInfo, "floatAbi")'. */ + +static tree +loongarch_d_handle_target_float_abi (void) +{ + const char *abi; + + if (TARGET_HARD_FLOAT_ABI) + abi = "hard"; + else if (TARGET_SOFT_FLOAT_ABI) + abi = "soft"; + else + abi = ""; + + return build_string_literal (strlen (abi) + 1, abi); +} + +/* Implement TARGET_D_REGISTER_CPU_TARGET_INFO. */ + +void +loongarch_d_register_target_info (void) +{ + const struct d_target_info_spec handlers[] = { + {"floatAbi", loongarch_d_handle_target_float_abi}, + {NULL, NULL}, + }; + + d_add_target_info_handlers (handlers); +} diff --git a/gcc/config/loongarch/loongarch-d.h b/gcc/config/loongarch/loongarch-d.h new file mode 100644 index 00000000000..5ef7bdfa9a0 --- /dev/null +++ b/gcc/config/loongarch/loongarch-d.h @@ -0,0 +1,26 @@ +/* Definitions for the D front end on the LoongArch architecture. + Copyright (C) 2022-2023 Free Software Foundation, Inc. + +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 +. */ + +/* Defined in loongarch-d.cc */ +extern void +loongarch_d_target_versions (void); +extern void +loongarch_d_register_target_info (void); + +/* Target hooks for D language. */ +#define TARGET_D_CPU_VERSIONS loongarch_d_target_versions +#define TARGET_D_REGISTER_CPU_TARGET_INFO loongarch_d_register_target_info diff --git a/gcc/config/loongarch/t-loongarch b/gcc/config/loongarch/t-loongarch index 9b06fa84bcc..a67af95bf66 100644 --- a/gcc/config/loongarch/t-loongarch +++ b/gcc/config/loongarch/t-loongarch @@ -63,6 +63,10 @@ loongarch-cpu.o: $(srcdir)/config/loongarch/loongarch-cpu.cc $(LA_STR_H) loongarch-def.o: $(srcdir)/config/loongarch/loongarch-def.c $(LA_STR_H) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $< +loongarch-d.o: $(srcdir)/config/loongarch/loongarch-d.cc + $(COMPILE) $< + $(POSTCOMPILE) + $(srcdir)/config/loongarch/loongarch.opt: s-loongarch-opt ; @true s-loongarch-opt: $(srcdir)/config/loongarch/genopts/genstr.sh \ $(srcdir)/config/loongarch/genopts/loongarch.opt.in \ diff --git a/gcc/testsuite/gdc.test/fail_compilation/reserved_version.d b/gcc/testsuite/gdc.test/fail_compilation/reserved_version.d index f7a554ce729..b00b3453d85 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/reserved_version.d +++ b/gcc/testsuite/gdc.test/fail_compilation/reserved_version.d @@ -76,49 +76,53 @@ fail_compilation/reserved_version.d(175): Error: version identifier `SH` is rese fail_compilation/reserved_version.d(176): Error: version identifier `Alpha` is reserved and cannot be set fail_compilation/reserved_version.d(177): Error: version identifier `Alpha_SoftFloat` is reserved and cannot be set fail_compilation/reserved_version.d(178): Error: version identifier `Alpha_HardFloat` is reserved and cannot be set -fail_compilation/reserved_version.d(179): Error: version identifier `LittleEndian` is reserved and cannot be set -fail_compilation/reserved_version.d(180): Error: version identifier `BigEndian` is reserved and cannot be set -fail_compilation/reserved_version.d(181): Error: version identifier `ELFv1` is reserved and cannot be set -fail_compilation/reserved_version.d(182): Error: version identifier `ELFv2` is reserved and cannot be set -fail_compilation/reserved_version.d(183): Error: version identifier `CRuntime_Bionic` is reserved and cannot be set -fail_compilation/reserved_version.d(184): Error: version identifier `CRuntime_DigitalMars` is reserved and cannot be set -fail_compilation/reserved_version.d(185): Error: version identifier `CRuntime_Glibc` is reserved and cannot be set -fail_compilation/reserved_version.d(186): Error: version identifier `CRuntime_Microsoft` is reserved and cannot be set -fail_compilation/reserved_version.d(187): Error: version identifier `CRuntime_Musl` is reserved and cannot be set -fail_compilation/reserved_version.d(188): Error: version identifier `CRuntime_Newlib` is reserved and cannot be set -fail_compilation/reserved_version.d(189): Error: version identifier `CRuntime_UClibc` is reserved and cannot be set -fail_compilation/reserved_version.d(190): Error: version identifier `CRuntime_WASI` is reserved and cannot be set -fail_compilation/reserved_version.d(191): Error: version identifier `D_Coverage` is reserved and cannot be set -fail_compilation/reserved_version.d(192): Error: version identifier `D_Ddoc` is reserved and cannot be set -fail_compilation/reserved_version.d(193): Error: version identifier `D_InlineAsm_X86` is reserved and cannot be set -fail_compilation/reserved_version.d(194): Error: version identifier `D_InlineAsm_X86_64` is reserved and cannot be set -fail_compilation/reserved_version.d(195): Error: version identifier `D_LP64` is reserved and cannot be set -fail_compilation/reserved_version.d(196): Error: version identifier `D_X32` is reserved and cannot be set -fail_compilation/reserved_version.d(197): Error: version identifier `D_HardFloat` is reserved and cannot be set -fail_compilation/reserved_version.d(198): Error: version identifier `D_SoftFloat` is reserved and cannot be set -fail_compilation/reserved_version.d(199): Error: version identifier `D_PIC` is reserved and cannot be set -fail_compilation/reserved_version.d(200): Error: version identifier `D_SIMD` is reserved and cannot be set -fail_compilation/reserved_version.d(201): Error: version identifier `D_Version2` is reserved and cannot be set -fail_compilation/reserved_version.d(202): Error: version identifier `D_NoBoundsChecks` is reserved and cannot be set -fail_compilation/reserved_version.d(205): Error: version identifier `all` is reserved and cannot be set -fail_compilation/reserved_version.d(206): Error: version identifier `none` is reserved and cannot be set -fail_compilation/reserved_version.d(207): Error: version identifier `AsmJS` is reserved and cannot be set -fail_compilation/reserved_version.d(208): Error: version identifier `Emscripten` is reserved and cannot be set -fail_compilation/reserved_version.d(209): Error: version identifier `WebAssembly` is reserved and cannot be set -fail_compilation/reserved_version.d(210): Error: version identifier `WASI` is reserved and cannot be set -fail_compilation/reserved_version.d(211): Error: version identifier `CppRuntime_Clang` is reserved and cannot be set -fail_compilation/reserved_version.d(212): Error: version identifier `CppRuntime_DigitalMars` is reserved and cannot be set -fail_compilation/reserved_version.d(213): Error: version identifier `CppRuntime_Gcc` is reserved and cannot be set -fail_compilation/reserved_version.d(214): Error: version identifier `CppRuntime_Microsoft` is reserved and cannot be set -fail_compilation/reserved_version.d(215): Error: version identifier `CppRuntime_Sun` is reserved and cannot be set -fail_compilation/reserved_version.d(216): Error: version identifier `D_PIE` is reserved and cannot be set -fail_compilation/reserved_version.d(217): Error: version identifier `AVR` is reserved and cannot be set -fail_compilation/reserved_version.d(218): Error: version identifier `D_PreConditions` is reserved and cannot be set -fail_compilation/reserved_version.d(219): Error: version identifier `D_PostConditions` is reserved and cannot be set -fail_compilation/reserved_version.d(220): Error: version identifier `D_ProfileGC` is reserved and cannot be set -fail_compilation/reserved_version.d(221): Error: version identifier `D_Invariants` is reserved and cannot be set -fail_compilation/reserved_version.d(222): Error: version identifier `D_Optimized` is reserved and cannot be set -fail_compilation/reserved_version.d(223): Error: version identifier `VisionOS` is reserved and cannot be set +fail_compilation/reserved_version.d(179): Error: version identifier `LoongArch32` is reserved and cannot be set +fail_compilation/reserved_version.d(180): Error: version identifier `LoongArch64` is reserved and cannot be set +fail_compilation/reserved_version.d(181): Error: version identifier `LoongArch_SoftFloat` is reserved and cannot be set +fail_compilation/reserved_version.d(182): Error: version identifier `LoongArch_HardFloat` is reserved and cannot be set +fail_compilation/reserved_version.d(183): Error: version identifier `LittleEndian` is reserved and cannot be set +fail_compilation/reserved_version.d(184): Error: version identifier `BigEndian` is reserved and cannot be set +fail_compilation/reserved_version.d(185): Error: version identifier `ELFv1` is reserved and cannot be set +fail_compilation/reserved_version.d(186): Error: version identifier `ELFv2` is reserved and cannot be set +fail_compilation/reserved_version.d(187): Error: version identifier `CRuntime_Bionic` is reserved and cannot be set +fail_compilation/reserved_version.d(188): Error: version identifier `CRuntime_DigitalMars` is reserved and cannot be set +fail_compilation/reserved_version.d(189): Error: version identifier `CRuntime_Glibc` is reserved and cannot be set +fail_compilation/reserved_version.d(190): Error: version identifier `CRuntime_Microsoft` is reserved and cannot be set +fail_compilation/reserved_version.d(191): Error: version identifier `CRuntime_Musl` is reserved and cannot be set +fail_compilation/reserved_version.d(192): Error: version identifier `CRuntime_Newlib` is reserved and cannot be set +fail_compilation/reserved_version.d(193): Error: version identifier `CRuntime_UClibc` is reserved and cannot be set +fail_compilation/reserved_version.d(194): Error: version identifier `CRuntime_WASI` is reserved and cannot be set +fail_compilation/reserved_version.d(195): Error: version identifier `D_Coverage` is reserved and cannot be set +fail_compilation/reserved_version.d(196): Error: version identifier `D_Ddoc` is reserved and cannot be set +fail_compilation/reserved_version.d(197): Error: version identifier `D_InlineAsm_X86` is reserved and cannot be set +fail_compilation/reserved_version.d(198): Error: version identifier `D_InlineAsm_X86_64` is reserved and cannot be set +fail_compilation/reserved_version.d(199): Error: version identifier `D_LP64` is reserved and cannot be set +fail_compilation/reserved_version.d(200): Error: version identifier `D_X32` is reserved and cannot be set +fail_compilation/reserved_version.d(201): Error: version identifier `D_HardFloat` is reserved and cannot be set +fail_compilation/reserved_version.d(202): Error: version identifier `D_SoftFloat` is reserved and cannot be set +fail_compilation/reserved_version.d(203): Error: version identifier `D_PIC` is reserved and cannot be set +fail_compilation/reserved_version.d(204): Error: version identifier `D_SIMD` is reserved and cannot be set +fail_compilation/reserved_version.d(205): Error: version identifier `D_Version2` is reserved and cannot be set +fail_compilation/reserved_version.d(206): Error: version identifier `D_NoBoundsChecks` is reserved and cannot be set +fail_compilation/reserved_version.d(209): Error: version identifier `all` is reserved and cannot be set +fail_compilation/reserved_version.d(210): Error: version identifier `none` is reserved and cannot be set +fail_compilation/reserved_version.d(211): Error: version identifier `AsmJS` is reserved and cannot be set +fail_compilation/reserved_version.d(212): Error: version identifier `Emscripten` is reserved and cannot be set +fail_compilation/reserved_version.d(213): Error: version identifier `WebAssembly` is reserved and cannot be set +fail_compilation/reserved_version.d(214): Error: version identifier `WASI` is reserved and cannot be set +fail_compilation/reserved_version.d(215): Error: version identifier `CppRuntime_Clang` is reserved and cannot be set +fail_compilation/reserved_version.d(216): Error: version identifier `CppRuntime_DigitalMars` is reserved and cannot be set +fail_compilation/reserved_version.d(217): Error: version identifier `CppRuntime_Gcc` is reserved and cannot be set +fail_compilation/reserved_version.d(218): Error: version identifier `CppRuntime_Microsoft` is reserved and cannot be set +fail_compilation/reserved_version.d(219): Error: version identifier `CppRuntime_Sun` is reserved and cannot be set +fail_compilation/reserved_version.d(220): Error: version identifier `D_PIE` is reserved and cannot be set +fail_compilation/reserved_version.d(221): Error: version identifier `AVR` is reserved and cannot be set +fail_compilation/reserved_version.d(222): Error: version identifier `D_PreConditions` is reserved and cannot be set +fail_compilation/reserved_version.d(223): Error: version identifier `D_PostConditions` is reserved and cannot be set +fail_compilation/reserved_version.d(224): Error: version identifier `D_ProfileGC` is reserved and cannot be set +fail_compilation/reserved_version.d(225): Error: version identifier `D_Invariants` is reserved and cannot be set +fail_compilation/reserved_version.d(226): Error: version identifier `D_Optimized` is reserved and cannot be set +fail_compilation/reserved_version.d(227): Error: version identifier `VisionOS` is reserved and cannot be set --- */ @@ -199,6 +203,10 @@ version = SH; version = Alpha; version = Alpha_SoftFloat; version = Alpha_HardFloat; +version = LoongArch32; +version = LoongArch64; +version = LoongArch_SoftFloat; +version = LoongArch_HardFloat; version = LittleEndian; version = BigEndian; version = ELFv1; @@ -315,6 +323,10 @@ debug = WASI; debug = Alpha; debug = Alpha_SoftFloat; debug = Alpha_HardFloat; +debug = LoongArch32; +debug = LoongArch64; +debug = LoongArch64_SoftFloat; +debug = LoongArch64_HardFloat; debug = LittleEndian; debug = BigEndian; debug = ELFv1; diff --git a/gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d b/gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d index f5f6b1c9acd..a1c8208626b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d +++ b/gcc/testsuite/gdc.test/fail_compilation/reserved_version_switch.d @@ -70,6 +70,10 @@ // REQUIRED_ARGS: -version=Alpha // REQUIRED_ARGS: -version=Alpha_SoftFloat // REQUIRED_ARGS: -version=Alpha_HardFloat +// REQUIRED_ARGS: -version=LoongArch32 +// REQUIRED_ARGS: -version=LoongArch64 +// REQUIRED_ARGS: -version=LoongArch_SoftFloat +// REQUIRED_ARGS: -version=LoongArch_HardFloat // REQUIRED_ARGS: -version=LittleEndian // REQUIRED_ARGS: -version=BigEndian // REQUIRED_ARGS: -version=ELFv1 @@ -175,6 +179,10 @@ // REQUIRED_ARGS: -debug=Alpha // REQUIRED_ARGS: -debug=Alpha_SoftFloat // REQUIRED_ARGS: -debug=Alpha_HardFloat +// REQUIRED_ARGS: -debug=LoongArch32 +// REQUIRED_ARGS: -debug=LoongArch64 +// REQUIRED_ARGS: -debug=LoongArch_SoftFloat +// REQUIRED_ARGS: -debug=LoongArch_HardFloat // REQUIRED_ARGS: -debug=LittleEndian // REQUIRED_ARGS: -debug=BigEndian // REQUIRED_ARGS: -debug=ELFv1 @@ -286,6 +294,10 @@ Error: version identifier `WASI` is reserved and cannot be set Error: version identifier `Alpha` is reserved and cannot be set Error: version identifier `Alpha_SoftFloat` is reserved and cannot be set Error: version identifier `Alpha_HardFloat` is reserved and cannot be set +Error: version identifier `LoongArch32` is reserved and cannot be set +Error: version identifier `LoongArch64` is reserved and cannot be set +Error: version identifier `LoongArch_SoftFloat` is reserved and cannot be set +Error: version identifier `LoongArch_HardFloat` is reserved and cannot be set Error: version identifier `LittleEndian` is reserved and cannot be set Error: version identifier `BigEndian` is reserved and cannot be set Error: version identifier `ELFv1` is reserved and cannot be set diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt index 1f21f63620c..6e656c4a351 100644 --- a/libphobos/configure.tgt +++ b/libphobos/configure.tgt @@ -52,6 +52,9 @@ case "${target}" in s390*-linux*) LIBPHOBOS_SUPPORTED=yes ;; + loongarch*-*-linux*) + LIBPHOBOS_SUPPORTED=yes + ;; sparc*-*-solaris2.11*) LIBPHOBOS_SUPPORTED=yes ;; diff --git a/libphobos/libdruntime/gcc/sections/elf.d b/libphobos/libdruntime/gcc/sections/elf.d index 5376957befd..d1316b2915f 100644 --- a/libphobos/libdruntime/gcc/sections/elf.d +++ b/libphobos/libdruntime/gcc/sections/elf.d @@ -1061,6 +1061,8 @@ else version (MIPS64) enum TLS_DTV_OFFSET = 0x8000; else version (IBMZ_Any) enum TLS_DTV_OFFSET = 0x0; +else version (LoongArch64) + enum TLS_DTV_OFFSET = 0x0; else static assert( false, "Platform not supported." ); diff --git a/libphobos/libdruntime/gcc/unwind/generic.d b/libphobos/libdruntime/gcc/unwind/generic.d index e4bbb4b01dc..2e74b6319bf 100644 --- a/libphobos/libdruntime/gcc/unwind/generic.d +++ b/libphobos/libdruntime/gcc/unwind/generic.d @@ -141,6 +141,7 @@ else version (SPARC64) private enum __aligned__ = 16; else version (SystemZ) private enum __aligned__ = 8; else version (X86) private enum __aligned__ = 16; else version (X86_64) private enum __aligned__ = 16; +else version (LoongArch64) private enum __aligned__ = 16; else static assert( false, "Platform not supported."); align(__aligned__) struct _Unwind_Exception -- 2.42.0