From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 */ -- 2.43.0