From patchwork Mon Jan 1 11:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 184158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp3926960dyb; Mon, 1 Jan 2024 03:57:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEN6vbqe13nRcgs3HM8Go0AuYJ9txm9vsYu7wG34zr//uzgaVSX5MKIIs+NU64UL5vb6G0u X-Received: by 2002:ac8:5713:0:b0:428:247b:ec65 with SMTP id 19-20020ac85713000000b00428247bec65mr1344152qtw.33.1704110227428; Mon, 01 Jan 2024 03:57:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704110227; cv=pass; d=google.com; s=arc-20160816; b=q0NWfTNqTvNaU+/MMMUQrJpLMI2cZNtyKA/lSqdZfR+C5HeKE1+QqTaS17SbFdM2Yi By0NnM+HzVT/+5IcvqDOQuf2u/7g/rQqlFUNduNgtlsFDxg8SuF8WiW25lH9A8gOMd/n w16uQpBpM+4aqJaxMSa4b0F7O760P9UbfF0DvYnERf024vaia9iP3G4cAo3U1cLYzR0u ggNxKN+EkTvYWuD9vpbHEYl5Ho3oOlHjhSvq5kjMpJCsx1A1eTv7i9xVFh3ZpwlgOlhb wKZw84KXV4geRYtABSisquzV3gqBq8ZaknuMZ/Pl5sf+kQHfLAYJxyM7d8mNVfY+PoCt j5lA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=sZsKYM0YpkH8OWMVNx5IJ9Rp7kmnPuafxWy3bDnLUn0=; fh=9bJenRX/cD8CU3PEmvrB+wrE7mB8Fw2pK3nnUaGV76o=; b=PuwkDz0p4b/05CB0NIPzu8kGUFp6aZ1VC5gJZ7ap1ZutL0SHvo/dAuRpANgVxNGR7I 16KE8jBqVF/3FM72rMYxxSKKa7uPKtwURQShYMie3/8j2c4ostRqZKYtas2CS/7tso8F koTWtlzjwwx3OyxK/Iqkqgy4l1iodS+4hqZ3r1lbynsA6R5G7USJUUZy197eHQXqu4Yc iV0ZqDzAz7naPZ2D+RuvQICTyue4NiFLePAfpjCgDZxg+VRmnGjmzDW2kO+13gz01wkh ifO1lxOOrJ4v18LRZ/ZoiltVsH8MUqYQzv7hJ3zIgw5UUe9HfOohVAvbS12gct9xlis7 A5Lw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gcNkAU8i; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f5-20020a05622a104500b00428248dae2fsi1392743qte.275.2024.01.01.03.57.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 03:57:07 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gcNkAU8i; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 66EF6385AC33 for ; Mon, 1 Jan 2024 11:56:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by sourceware.org (Postfix) with ESMTPS id 6F2353858282 for ; Mon, 1 Jan 2024 11:54:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F2353858282 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F2353858282 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704110047; cv=none; b=a/jAN28VtSofJm7DGRhoN/bcXYdw+OPa35ZKzgPUxEKRHUnwT25V3wLDWrafN/mpliJsiKAsC3TETC/TTYYMNtfQcyB3qXf6dGtCZWWAY4uRVnF8zq/03S8zgim1pQycbNPa5z5tl7ioo8Ej82kgU2iBZNY0ELOwiiV+UHHOwfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704110047; c=relaxed/simple; bh=JOSRQP/KfDnWiq034Vw5niWUIZ43lqcD0uBQore8uIA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=WgA7zDoHg5Ytxd5De5dZGEit/uPaVWPVtjAWT1w5fJqQZSiJLe/cmPb6OO31Z4Nwfczqx7wfqx5j+955v7ggTcE5wCCits2K2a89vUqjPiKDyTgGYNpQTzfUf9XdaWh4l0UHs6EW5OzE2wPXwHGmVSxdyUXh2Y3GnUAGX22x2Xw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2ccecef2631so27919641fa.2 for ; Mon, 01 Jan 2024 03:54:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704110040; x=1704714840; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sZsKYM0YpkH8OWMVNx5IJ9Rp7kmnPuafxWy3bDnLUn0=; b=gcNkAU8iulF6MH7hSHD8jHSlzR4nA1jLJUqDZyGyjSswzUFioUhjBx73SWAdOIn54x zsOKmHWXlnNKP+vZhHx95AhXTZxmWxLi931CfnIgip19iIoWSiLtHyeHkMggCEKCOIUd KWTbS/ttIn38eO+br4EdraPexEUhTp8+HCE2TEyq8xwYSidzTGm/IUSh7Y4zqP1SFCg3 YKMt+T2rLbeIexFEBwT8TfV6x+MpJLwfGjtdAYGVIPHOjeG2jC08jYetzOvb28RGFeHh BoDMiNK5Ygor2KW1kuW4eqJxlZ82gzpJYopVd0n4uZCDOK7FucuyS3vCFvQVrXhD+TxP HBjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704110040; x=1704714840; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sZsKYM0YpkH8OWMVNx5IJ9Rp7kmnPuafxWy3bDnLUn0=; b=blFRonk67E5gqQq7eqrDuaDKQzYWLZh5Y9EXxbrd+u0yC0ZuFZqpFUzSr+7vslCUrG /ojoPB8AhuHAXfVbiZEdjxIVUBl80YWVTZqIlxxFxCVHP5LY64cjYdc61nuJoT5H7hln OPnUMo76RmFA2aH4se9M/BYCteyX2oTbg/Q/yEE7uwIFc2p7L83vaDca6XdbiuO/I/Ig djUoIU2vqV4WXCPkBirkbf7QwmLTZmTgmjli8VjdkuC0WRp9i3FtbLezq4QOUD0lsbni PTixZYUG1G7sCihXF1tqfIo82RfJa5MRu5XnRlCi5E6aQx1L5QEX5iEuD/EK7KGCma64 +FZA== X-Gm-Message-State: AOJu0Yyr1PO3RFQ7/QmnqaGRSP4x3p62xmVqiKCymGJne4pLqneVODy5 Vz0HOzUyjdXOZD9x+4vGSph7gvliw4E= X-Received: by 2002:a2e:9c14:0:b0:2cc:6fe2:4ddc with SMTP id s20-20020a2e9c14000000b002cc6fe24ddcmr6027050lji.3.1704110040478; Mon, 01 Jan 2024 03:54:00 -0800 (PST) Received: from surface-pro-6.. ([2a00:1370:818c:b32f:8da1:ad5a:e55a:5cb0]) by smtp.gmail.com with ESMTPSA id ce26-20020a2eab1a000000b002ccbc09230csm3682109ljb.97.2024.01.01.03.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 03:53:59 -0800 (PST) From: Sergey Bugaev To: gcc-patches@gcc.gnu.org, bug-hurd@gnu.org Subject: [PATCH gcc 3/3] libgcc: Add basic support for aarch64-gnu (GNU/Hurd on AArch64) Date: Mon, 1 Jan 2024 14:53:56 +0300 Message-ID: <20240101115356.614446-3-bugaevc@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240101115356.614446-1-bugaevc@gmail.com> References: <20240101115356.614446-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786889085572562633 X-GMAIL-MSGID: 1786889085572562633 There is currently no unwinding implementation. Signed-off-by: Sergey Bugaev --- libgcc/config.host | 9 +++++++ libgcc/config/aarch64/gnu-unwind.h | 36 +++++++++++++++++++++++++ libgcc/config/aarch64/heap-trampoline.c | 4 +-- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 libgcc/config/aarch64/gnu-unwind.h diff --git a/libgcc/config.host b/libgcc/config.host index 54d06978a..c5b4df2c5 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -448,6 +448,15 @@ aarch64*-*-linux*) tmake_file="${tmake_file} t-dfprules" tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline" ;; +aarch64*-*-gnu*) + extra_parts="$extra_parts crtfastmath.o" + md_unwind_header=aarch64/gnu-unwind.h + tmake_file="${tmake_file} ${cpu_type}/t-aarch64" + tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + tmake_file="${tmake_file} t-dfprules" + tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline" + ;; aarch64*-*-vxworks7*) extra_parts="$extra_parts crtfastmath.o" md_unwind_header=aarch64/aarch64-unwind.h diff --git a/libgcc/config/aarch64/gnu-unwind.h b/libgcc/config/aarch64/gnu-unwind.h new file mode 100644 index 000000000..d9e485a18 --- /dev/null +++ b/libgcc/config/aarch64/gnu-unwind.h @@ -0,0 +1,36 @@ +/* DWARF2 EH unwinding support for GNU Hurd: aarch64. + Copyright (C) 2020-2024 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. + +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 +. */ + +/* Always include AArch64 unwinder header file. */ +#include "config/aarch64/aarch64-unwind.h" + +#ifndef inhibit_libc + +#include + +/* + * TODO: support for aarch64 needs to be implemented. + */ + +#endif /* ifndef inhibit_libc */ diff --git a/libgcc/config/aarch64/heap-trampoline.c b/libgcc/config/aarch64/heap-trampoline.c index f22233987..6565584c7 100644 --- a/libgcc/config/aarch64/heap-trampoline.c +++ b/libgcc/config/aarch64/heap-trampoline.c @@ -23,7 +23,7 @@ void *allocate_trampoline_page (void); void __builtin_nested_func_ptr_created (void *chain, void *func, void **dst); void __builtin_nested_func_ptr_deleted (void); -#if defined(__gnu_linux__) +#if defined(__gnu_linux__) || defined(__gnu_hurd__) static const uint32_t aarch64_trampoline_insns[] = { 0xd503245f, /* hint 34 */ 0x580000b1, /* ldr x17, .+20 */ @@ -76,7 +76,7 @@ allocate_trampoline_page (void) { void *page; -#if defined(__gnu_linux__) +#if defined(__gnu_linux__) || defined(__gnu_hurd__) page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, 0, 0); #elif __APPLE__