From patchwork Mon Jan 1 11:53:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1881439 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=YB8toBPC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T3ZD53Xz1z1yfx for ; Mon, 1 Jan 2024 22:54:59 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 65FF8385802F for ; Mon, 1 Jan 2024 11:54:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id DEB833858413 for ; Mon, 1 Jan 2024 11:54:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DEB833858413 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 DEB833858413 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::233 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704110046; cv=none; b=fIllYFHUCS8qL2hTNkz3p/nk7jHfXpx6vuj9msERad0SYGkKPTkpX8t5Nys83NJymvg3sREk0oN9h1QWaHnM9ghBbC7lix2jfP0BQyMdF3k1RI2o2v/Qp/IaKzdICXQfHaK/Dom/aKO/HIVIZf81+T8GavrmNgDBujehJ5CD+M0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704110046; c=relaxed/simple; bh=AlInNtLePTK1UG4BEyQI6ElUdooy7h+EvxnKTQI8bds=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gMafTgd1oOwSpUktc4zxYnnpb4eCeQdRToOekDAG1rkAmmGBtGvsJCg9aayCf2loz+NadJqZYCcRa/RuzNcj6c8GuhcAx8kra4zUrsWLAoi0ttBivn2dTPCafZEirnYMYqe+wEZ70KSmQ8gITaYzhuwBCSWNpqe/ScW18ypPwxQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2cc7b9281d1so108657111fa.1 for ; Mon, 01 Jan 2024 03:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704110039; x=1704714839; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Lw0dws/OSqG5c2B3SapQE5v0vPFEokDpxmKvNZNi7Ws=; b=YB8toBPCvv6utHGAdrMtIWe/xpJOwX5Avtad9Im0nroqaOhz8l8nAk1Z3z3f+g9Jp/ QK5gMYE5hUH8RR3uY7aigqPFUtVHcwfD+8wRQrGlIXyCtzpMYbe5VkxyOqZdS7+gwnSf zBcrZyoImvNeClckEBE1e+dewzmVzyqn1ZmM+Rvm+BSd+8RxsGFc/m8QAlBx7vMmXbEa iWq7qWX2rD+YoKBH08UFtGHIa7LlaC3VlLeSklKlBICxrgPc2BWSyFwkpp/rZN8OkGiI Vi2tEwyuMrRR0HYKbprRhcOz5RSsrHZfzZJQJxWpcURowsV7Uprr17PZ2Ykc4p09x4hK 3bQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704110039; x=1704714839; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Lw0dws/OSqG5c2B3SapQE5v0vPFEokDpxmKvNZNi7Ws=; b=vXdWlu3WLVYdf4I7FgavNP6DjS56I8/IlY5zJ556U/G+YwMWjb3eM+v/9xvoF9npXM N4yPowOzjq+iFlMuB+ODI6h+RTOGF2GJc8etTc/8GoER/99vLBxH3RrJfSfXJ8BVmA9b 1h6JImhCPCXnaTAOb9YrpAvWCK7LEeH+DFEIpjWzy9uOb7iEMiez2E6tL+xBB1uUEQa4 I629SHiCrlKNI6zzIQNwEi3nyCDaLH5byA6fGdBGVGrgTDXjNcJSm3tskMw086p4c/WU 1Y+d0vs3q6gRV+AMp/F3LtMv0J4k6v0yCiVNO8vB+uZEe4HPfEHWeLsBURIVbJyBe+/J RS7g== X-Gm-Message-State: AOJu0YyznqrhKd7RWjG/0PHWeOH36WSYPzWH7cJZNZpvMg2RY9qu3P/G V2C3huX25PjZskcqr24OvGjaR/13DzQ= X-Google-Smtp-Source: AGHT+IGoSIdLmQsX9LspsHtMTyVqqKQlV+lrqknFIS7C+LRCTNf5IWgwDEvFWWYaa2+iM7bMUDSCpQ== X-Received: by 2002:a05:651c:4cf:b0:2cc:f5fa:28ac with SMTP id e15-20020a05651c04cf00b002ccf5fa28acmr2114854lji.102.1704110038797; Mon, 01 Jan 2024 03:53:58 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 03:53:58 -0800 (PST) From: Sergey Bugaev To: gcc-patches@gcc.gnu.org, bug-hurd@gnu.org Subject: [PATCH gcc 1/3] Move GNU/Hurd startfile spec from config/i386/gnu.h to config/gnu.h Date: Mon, 1 Jan 2024 14:53:54 +0300 Message-ID: <20240101115356.614446-1-bugaevc@gmail.com> X-Mailer: git-send-email 2.43.0 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Since it's not i386-specific; this makes it possible to reuse it for other architectures. Also, add a warning for the case gnu.h is specified before gnu-user.h, which would cause gnu-user's version of the spec to override gnu's, and not the other way around as it's intended. The i?86-gnu target currently specifies them in the right order, but it's easy to accidentally put them in a wrong order. Signed-off-by: Sergey Bugaev --- gcc/config/gnu.h | 16 ++++++++++++++++ gcc/config/i386/gnu.h | 11 ----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h index 97baea939..89904cd9b 100644 --- a/gcc/config/gnu.h +++ b/gcc/config/gnu.h @@ -31,3 +31,19 @@ along with GCC. If not, see . builtin_assert ("system=unix"); \ builtin_assert ("system=posix"); \ } while (0) + + +#ifndef GNU_USER_TARGET_STARTFILE_SPEC +# warning This file should be included after gnu-user.h, to override its STARTFILE_SPEC +#endif + +#undef STARTFILE_SPEC +#if defined HAVE_LD_PIE +#define STARTFILE_SPEC \ + "%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \ + crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}" +#else +#define STARTFILE_SPEC \ + "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \ + crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}" +#endif diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h index e776144f9..60244bfc8 100644 --- a/gcc/config/i386/gnu.h +++ b/gcc/config/i386/gnu.h @@ -24,17 +24,6 @@ along with GCC. If not, see . #undef GNU_USER_DYNAMIC_LINKER #define GNU_USER_DYNAMIC_LINKER "/lib/ld.so" -#undef STARTFILE_SPEC -#if defined HAVE_LD_PIE -#define STARTFILE_SPEC \ - "%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \ - crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}" -#else -#define STARTFILE_SPEC \ - "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \ - crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}" -#endif - #ifdef TARGET_LIBC_PROVIDES_SSP /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ From patchwork Mon Jan 1 11:53:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1881438 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=QOfCJmOb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T3ZD54gvtz20LT for ; Mon, 1 Jan 2024 22:54:59 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C786A3857C50 for ; Mon, 1 Jan 2024 11:54:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 80339385842D for ; Mon, 1 Jan 2024 11:54:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 80339385842D 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 80339385842D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::231 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704110047; cv=none; b=B9H/CJ039kBb/l2Fdcuo3Deo4JFPg05H+qQ87Akj4c8wfNQxBatgbpyjbK0apjTG51R1dyaoKQWvdaCjapE9DUHqAQKo74IPm3QAG1OjY7SmUeSDOwU3Yn5PCHpRY1wJ1eo9T5a5TRyCUG/FanDrSivXSdh83Eeg3krb+WCkbHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704110047; c=relaxed/simple; bh=pK1MKG+FqxcrWRE3NDb7LcOhtDJMNi969X0yE7hYf4k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uSOE7LL0muCDdPhGfdRDCFQLKDIyv+HAsNcf3UtTMVfERBXEICwYazcYYzeEN62HAjoSheYpBe+8v+Ckut11/pE9oJmvR/iW45gZ7LrdJcV6Tv9loqkT5Hcw3SwwEDBWP+S9fGkG79XFWE1YpEJn5cK2epxvljUld6Ccjbt5f7o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2cceb66a986so29179281fa.0 for ; Mon, 01 Jan 2024 03:54:01 -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=REBVuJ9k8Vb3qtcFGfcI5ADkBRLvaXTuz1zIet0PyEM=; b=QOfCJmOb55mlwReATubF9gvlrP0kFCkKlHSbjMyFbeHXaP6kCJYHap3jqFojziNAgL vEbJi71iEk8ISTeMVTKN3tq1yrDTXlmWx4k7tscyGSAU81Obqz0ro2MiUARl/aZ2SjOZ nmYJIj/g6pMhuYhxtPesBWNRH3+p9y34GdP/MfIcjQMZCCo4mKz0Kmq2nOW9g+IBV9YU j/KAU1TrY3hJnfGcxKYIR3w1UiuiOTkleYrGGS88KQ/eKuRCCjIJuvM3dyIlDz4fZA8g +0J01kdBJPSpXSwiSDDyGY1OXbf7WZgzunTB8RCSyNAWM4h8zMyX4NPqE0ZCpzS1vgS8 xzhQ== 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=REBVuJ9k8Vb3qtcFGfcI5ADkBRLvaXTuz1zIet0PyEM=; b=wp1go+wm/aI3GDgqV+lOafY+5pXBOwn2qY79S8y8TTeSSTCuKzV8qOsXAlnGeC2Zlr pMICpAynxxOQimH9EqvxbzF1Hme7D8FX/JVC/70251ibcdaNlAwo4WlfS3IHoVGVjDMv bdlzAC+OlGzMIVAoDqPSPlzVC6Nwz9k3WCILqvkTFKVe1UbkR+lySi79Ig6V0a+f9aT3 E1/hz/MFe5a35tB6q2Tz/4E491+89Oc4LIHag+u98WMFG3jHvCIASaPi8AMZgUw2aYP1 9Td0HS7YD0MHVDSQI+6mnM6XyyppA07bwJMYWdvXgVLtAKp6LrkJqISWpTZ2OV2jIbVm 93yA== X-Gm-Message-State: AOJu0YyKdGFHWtMnnIYs+/RLl6/pjEEwu8kzhcqE6kPfEoZNqohtvwRr mr7a2BPGpWqRt2JwarkCxFOmpL/SxPE= X-Google-Smtp-Source: AGHT+IGmExiLMi2gByvdkqh29YUj0D+q7LNA6dau+HxZnoyKieBRT54bIVgLimnTogCCjVDJhyJWdQ== X-Received: by 2002:a05:651c:b1f:b0:2cc:fbf7:8669 with SMTP id b31-20020a05651c0b1f00b002ccfbf78669mr1379513ljr.32.1704110039560; Mon, 01 Jan 2024 03:53:59 -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.58 (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 2/3] aarch64: Add support for aarch64-gnu (GNU/Hurd on AArch64) Date: Mon, 1 Jan 2024 14:53:55 +0300 Message-ID: <20240101115356.614446-2-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+incoming=patchwork.ozlabs.org@gcc.gnu.org Coupled with a corresponding binutils patch, this produces a toolchain that can sucessfully build working binaries targeting aarch64-gnu. Signed-off-by: Sergey Bugaev --- gcc/config.gcc | 6 +++ gcc/config/aarch64/aarch64-gnu.h | 68 ++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 gcc/config/aarch64/aarch64-gnu.h diff --git a/gcc/config.gcc b/gcc/config.gcc index f0676c830..d8dd127ad 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1263,6 +1263,12 @@ aarch64*-*-linux*) done TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` ;; +aarch64*-*-gnu*) + tm_file="${tm_file} elfos.h gnu-user.h gnu.h glibc-stdint.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-gnu.h" + tmake_file="${tmake_file} aarch64/t-aarch64" + tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1" + ;; aarch64*-wrs-vxworks*) tm_file="${tm_file} elfos.h aarch64/aarch64-elf.h" tm_file="${tm_file} vx-common.h vxworks.h aarch64/aarch64-vxworks.h" diff --git a/gcc/config/aarch64/aarch64-gnu.h b/gcc/config/aarch64/aarch64-gnu.h new file mode 100644 index 000000000..ee5494034 --- /dev/null +++ b/gcc/config/aarch64/aarch64-gnu.h @@ -0,0 +1,68 @@ +/* Definitions for AArch64 running GNU/Hurd. + Copyright (C) 2009-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. + + 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_GNU_H +#define GCC_AARCH64_GNU_H + +#define GNU_USER_DYNAMIC_LINKER "/lib/ld-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + +#define CPP_SPEC "%{pthread:-D_REENTRANT}" + +#define GNU_TARGET_LINK_SPEC "%{h*} \ + %{static:-Bstatic} \ + %{shared:-shared} \ + %{symbolic:-Bsymbolic} \ + %{!static:%{!static-pie: \ + %{rdynamic:-export-dynamic} \ + %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}} \ + %{static-pie:-Bstatic -pie --no-dynamic-linker -z text} \ + -X \ + %{mbig-endian:-EB} %{mlittle-endian:-EL} \ + -maarch64gnu%{mabi=ilp32:32}%{mbig-endian:b}" + + +#define LINK_SPEC GNU_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC + +#define GNU_USER_TARGET_MATHFILE_SPEC \ + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + GNU_USER_TARGET_MATHFILE_SPEC " " \ + GNU_USER_TARGET_ENDFILE_SPEC + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + GNU_USER_TARGET_OS_CPP_BUILTINS(); \ + } \ + while (0) + +#define TARGET_ASM_FILE_END aarch64_file_end_indicate_exec_stack + +/* Uninitialized common symbols in non-PIE executables, even with + strong definitions in dependent shared libraries, will resolve + to COPY relocated symbol in the executable. See PR65780. */ +#undef TARGET_BINDS_LOCAL_P +#define TARGET_BINDS_LOCAL_P default_binds_local_p_2 + +/* Define this to be nonzero if static stack checking is supported. */ +#define STACK_CHECK_STATIC_BUILTIN 1 + +#endif /* GCC_AARCH64_GNU_H */ 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: 1881440 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=gcNkAU8i; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T3ZF51LvVz1ygb for ; Mon, 1 Jan 2024 22:55:53 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D2724385E021 for ; Mon, 1 Jan 2024 11:55:49 +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-Google-Smtp-Source: AGHT+IF1IxWiJ1qfVqjIhEkPyRKNgElkgASv46OtNBwrChNgajl+cma/njJtgwbinxJ0PTlEKNA1ew== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org 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__