From patchwork Sat Mar 23 14:35:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 87563 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 81AD63858286 for ; Sat, 23 Mar 2024 14:35:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id 0E4233858D33 for ; Sat, 23 Mar 2024 14:35:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0E4233858D33 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 0E4233858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::133 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711204525; cv=none; b=mkRcK+K0OyOOenLCRUFFpe0kxmI04h+7gFfP+4QJWegganfOlWslIC5alFP/FwBaS+DqT1M2Y3iXueEqJTzGwlEmgAtEhHiQMBHAbnfUm6cAtwAa8bRufnUIQIBfUNr3quAdwRdo52L/h4/ZAisMiMqLIer+c1VT0g84yZ3rNv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711204525; c=relaxed/simple; bh=D4GugKY7HKMfHQx5UEGnfm5NVZ3NVh5Y83Ytlt+qv9U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VFMSjrvR6AmiStjpveouuk/LjhISF9F2ZTjO+lyvqphCQtOd83X7drqk8aKf/QXaP/Mjcl2oW+uKvPC+tmCue8gJ8ZJxZvDJKFvY2mx+3gBOXx3j9Q1lxT5bBv4y+xxLoNq1rI9r9CrAvgteX1Xe+VVka2aEo0E9S8o1VE0uMDA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5148ea935b8so3495207e87.1 for ; Sat, 23 Mar 2024 07:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711204521; x=1711809321; 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=jP6h4HTI7IaG6/yAg4uWMw0Ejxa2xtcUAPY05AZiDU8=; b=L3EL2sqac/uWnTJeg+6ZV02ljEDlKW8OWQBn/wskA87fiPuhgB/RmFXHdUWNKi9gD7 agy9L75cM/a0KyTsJ/TCMlAetZWjOg3NZYPzyF8/3WfruSDuCWSsWLH/kZYyOKxTLmf1 oYc2Z8L64VZdjOQB94sFA0g/SACyV3um3WGB+FRszj9oetk1eAfb9qvvbGzbyUiFsHV6 ziwH3pvdIjeYZHgjYRY/dcWbjgshjwiXTuey484XOw0Z9ELnEa4VIKMtT/sdvS4p2xpH ect/1SNrtIuzcr1t6KQk9yOT6yf3a9xQpKkYqQbXi1bql2c4pki2u4bKUsLjeL6RQQJb uWsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711204521; x=1711809321; 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=jP6h4HTI7IaG6/yAg4uWMw0Ejxa2xtcUAPY05AZiDU8=; b=VCtbym2ulHHtljYLPrXeHgydZgSZDKBpTaSPKJUnUM0yLz9q9520oE7Wwu6d4TwOle gOE5TDQMz8z/E5l3vLlWl1yr2486ou0H99fy94b5rl1/9vnqKx2ui9a0mcqnIvuy5DjT qbD3DtSn7OQqNROSsfT0C/PA985iKBWoh/jaoN++O04tR5tA/HuuBtwgQWMMiHy18t1W QdkM4jReb7tac7igT2ZFzHjFjdk20ZAH5AlRA/cYHDI6FhBWBBicXSYgiBeawUBIU22y Sc5yrrmWVTeg7oItcQBd8mp1HWVjpXos6RQ/0aXh0LqjcykVst8KpzEDR9zlOV9yM53h qmXg== X-Gm-Message-State: AOJu0Yyy3qK1XNtFr6P9OTWnVzKnNsczd3UVsunmZ8vueui1SDYbsL40 DxK+Fk+RqatQORz3JM0OdhHGst7Vu6Jn1Z/VX3UhWOwdprI+dUjLgKha0u2z X-Google-Smtp-Source: AGHT+IElW1rKrvUqITrwseRw2HsHHtlyvWrqO/6YMnsehcDsK2d0KWrnSY1ICQhgxSVypGCPHuMG5A== X-Received: by 2002:ac2:4da3:0:b0:513:5ec6:348b with SMTP id h3-20020ac24da3000000b005135ec6348bmr1769526lfe.6.1711204521236; Sat, 23 Mar 2024 07:35:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 07:35:20 -0700 (PDT) From: Sergey Bugaev To: gcc-patches@gcc.gnu.org Cc: bug-hurd@gnu.org, Thomas Schwinge , Richard Sandiford Subject: [PATCH v2 2/3] aarch64: Add support for aarch64-gnu (GNU/Hurd on AArch64) Date: Sat, 23 Mar 2024 17:35:12 +0300 Message-ID: <20240323143513.120786-2-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 Coupled with a corresponding binutils patch, this produces a toolchain that can sucessfully build working binaries targeting aarch64-gnu. gcc/Changelog: * config.gcc: Recognize aarch64*-*-gnu* targets. * config/aarch64/aarch64-gnu.h: New file. 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 87a5c92b6..9d935164c 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1264,6 +1264,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 */