From patchwork Sat Mar 23 14:35:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 87565 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 276E4385841D for ; Sat, 23 Mar 2024 14:35:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id F242E3858D37 for ; Sat, 23 Mar 2024 14:35:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F242E3858D37 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 F242E3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711204526; cv=none; b=YSYbWb8jcXZ30cY9H2Af3qWNSvjLSoq47WbC/6dlrfwvAY2XdNIfeNQlQ+78C7CVpdvem3CeUvZg1Xg8NB3k3lZMNrk72ROJoktZlJ/V1zPsh9KFTDtmsb+BvpWGFUoJG7nreHkUEwZrmbye0TZANCGUbpqxm6U6pFgHcupN4t4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711204526; c=relaxed/simple; bh=RLp4CWc7mHzG8CqVll9QuCf797xI4i/BInuaTY/FyuI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=oxmr2gJbR9fwtR71I0USKsJerWmZZYtLV7irqI/G+H/iUbrpEULJKylv6LaSt0sH1K9S3wGClDM3j8ZPsmo8sv5XPvYUvSfXgdQ9LoD6T+qiJdkdnvRUyw+tWBY9mfTJblcT7U5VU69NtEhWdHUQZBsnM5zx+0a0YSPXDRMh8WM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-513a08f2263so3303093e87.3 for ; Sat, 23 Mar 2024 07:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711204522; x=1711809322; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3KNIjtpQZpAoGbz/MEk8KeHa/mFDRB/dADV2npSsQKM=; b=ntuDrr71N4sh1JLu8crE893hbsd3UKU6v5A83f410xmMbL3raqtMXAR79EmdtljfBD AoC7R5kbBz6y67aBDXCAARrdK7zkPPdhcJdaybbF83hJU4dy8SHAkJMg6AA8xHnZTww+ Ly8n+4CnImdQGY6qlj3g/X4rq4PjpIz5Kma5Be686iKkh88N+tgz0/sgnL2Y/D18l8KB t8jqK2sKBo3fdpeTBf4+fozbRADrMct+LmXQS22s1wE2x0g/Wl+pXVuQZpjh8mkI7hVF DsUi+tADprhCvwXoMX3SfsEY4MKE2YGCECJE7Arj0yn/truGG+DUrEa1OJ6zQVQqLfnP hMQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711204522; x=1711809322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3KNIjtpQZpAoGbz/MEk8KeHa/mFDRB/dADV2npSsQKM=; b=aQQLXKoT8sDqGvnsmUOAvknBDTSQjA4SG7Sl4Hj28HWdbiHDMgMQUQdD+WeTZ+/4TG OxFngcVd+zj4hlOdEuq5ropiz3SI9cW5MiGnQjY8zSQjQDvy73pX9JQUxPC6JoFnfOlh f2dw/gDv4U+MIv9hpmurVas2YvGyzw5KOX9h5P2pyZHo26/n4BxDLse+uKxZNMf2AHcW tl2dj463Kgt8jYikNG69/GhutlCCrnDoKNFElwqw4JnoiSpE3/yYGcS1tqNJUBqZZQQv 4Vdxeznga5psT3KOH4pQEQk7RcgWFm01Sly8sdWxdo0ZX6a4rMxwJ2MOIccXZqDqY64C y3KA== X-Gm-Message-State: AOJu0YymvhU/iI8ja3dsCGkV6u/g1dtYmZJV0zFBDo6bX+GzVwzVrCDI RZgH9wcQdP23PM7DfIF+KBGvtvpbmh2XralgdKl0LhoZutHmoap95Pp6tzFo X-Google-Smtp-Source: AGHT+IGaqsl1ZjKt/HvNsgX7CVfyzZ4zsoLQ47ttXbO8NFZ08/R5ByTJeMDTcKudXhD0SFnmEyl9mw== X-Received: by 2002:a19:4348:0:b0:513:d32a:89e1 with SMTP id m8-20020a194348000000b00513d32a89e1mr1584346lfj.51.1711204522070; Sat, 23 Mar 2024 07:35:22 -0700 (PDT) Received: from localhost.localdomain ([2a02:2168:b216:4700:7eaf:f2aa:b4d0:13e9]) by smtp.gmail.com with ESMTPSA id x12-20020ac25dcc000000b00513e4914c74sm309844lfq.225.2024.03.23.07.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 07:35:21 -0700 (PDT) From: Sergey Bugaev To: gcc-patches@gcc.gnu.org Cc: bug-hurd@gnu.org, Thomas Schwinge , Richard Sandiford Subject: [PATCH v2 3/3] libgcc: Add basic support for aarch64-gnu (GNU/Hurd on AArch64) Date: Sat, 23 Mar 2024 17:35:13 +0300 Message-ID: <20240323143513.120786-3-bugaevc@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240323143513.120786-1-bugaevc@gmail.com> References: <20240323143513.120786-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 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 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+patchwork=sourceware.org@gcc.gnu.org There is currently no unwinding implementation. libgcc/ChangeLog: * config.host: Recognize aarch64*-*-gnu* hosts. * config/aarch64/gnu-unwind.h: New file. * config/aarch64/heap-trampoline.c (allocate_trampoline_page): Support GNU/Hurd. 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 59a42d3a0..e75a7af64 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 885df629d..26957a3ee 100644 --- a/libgcc/config/aarch64/heap-trampoline.c +++ b/libgcc/config/aarch64/heap-trampoline.c @@ -29,7 +29,7 @@ void *allocate_trampoline_page (void); void __gcc_nested_func_ptr_created (void *chain, void *func, void *dst); void __gcc_nested_func_ptr_deleted (void); -#if defined(__linux__) +#if defined(__linux__) || defined(__gnu_hurd__) static const unsigned char aarch64_trampoline_insns[6][4] = { {0x5f, 0x24, 0x03, 0xd5}, /* hint 34 */ {0xb1, 0x00, 0x00, 0x58}, /* ldr x17, .+20 */ @@ -82,7 +82,7 @@ allocate_trampoline_page (void) { void *page; -#if defined(__linux__) +#if defined(__linux__) || defined(__gnu_hurd__) page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, 0, 0); #elif __APPLE__