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: 184160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp3949468dyb; Mon, 1 Jan 2024 04:58:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcUXQA6GLu4UCPgSrteU6ILp51H+Y9OPzFgitrm1FNPGwQAp9X34FshOMdNCn92r9c/IyC X-Received: by 2002:a05:620a:5360:b0:781:616a:542f with SMTP id op32-20020a05620a536000b00781616a542fmr8534265qkn.16.1704113928649; Mon, 01 Jan 2024 04:58:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704113928; cv=pass; d=google.com; s=arc-20160816; b=m4pMgjQso6yW1bxyBdBI2ng/ULMk1EqgiASLxn14txKQm289BGDuNpxtVfAzSUCLY/ xeq/1m+hJefLQ4id6j4tUefmpVZQ6BGB7UJh7PZc10894qICfgNG7FZvG+JzvttHhHfw jsJrNnAMltbIkY4jYu/TJ91NzAWm+glY1Xio6bMJcVc8Mh7MUWN4cCo2zfuISDcY+4xo CnPI0K7qnkbqXeiHZZHOkTkQI9chPJXmj6Re9jLePuWEwacbqTRbx1zKqDvDc+zYy0lP STW6+QfgsQAlmm+0+LXxj2Cam9dkapl8d8sSsDMyLrwzW18zlsCCb1zCfTyY7w9Ylqvq 5bQQ== 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=REBVuJ9k8Vb3qtcFGfcI5ADkBRLvaXTuz1zIet0PyEM=; fh=9bJenRX/cD8CU3PEmvrB+wrE7mB8Fw2pK3nnUaGV76o=; b=lEEB+2Q2Z87ysQkh1pkAMX+GW+N5Pl0QiQQ5xepMyi+Pu0RggUCmbwM10S3rBRrFw9 3NntGpP3vhxhhAYGyExpDPudoYPIk+JevV6AFxc2sfT4t2l/oWhoPVDCXIfzYHRA5Dst 98WDPm7EUFfPDzr3f1u98swGmVqNoj17OfVMbQqI0uZfkxS9RL/f5OvtjZVIl0GGKa34 0faI/muCTATUB+Euej5zE3QKcdjDQUzpTj0aukB6YJhIiZZnStbS9zIH9tamz7/llvun T0Nqj5UapYw/UNo6SKe8rfsaeGZkWzAYX6Et8F2JltjREH+aNHjoyjdzcln1UESzgEe9 8o3Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QOfCJmOb; 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 de13-20020a05620a370d00b007813eebc6b2si19075382qkb.611.2024.01.01.04.58.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 04:58:48 -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=QOfCJmOb; 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 C167F385DC10 for ; Mon, 1 Jan 2024 11:55:41 +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-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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786892966895238260 X-GMAIL-MSGID: 1786892966895238260 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 */