From: Sergey Bugaev <bugaevc@gmail.com>
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 [thread overview]
Message-ID: <20240101115356.614446-2-bugaevc@gmail.com> (raw)
In-Reply-To: <20240101115356.614446-1-bugaevc@gmail.com>
Coupled with a corresponding binutils patch, this produces a toolchain that can
sucessfully build working binaries targeting aarch64-gnu.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
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
+ <http://www.gnu.org/licenses/>. */
+
+#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
next prev parent reply other threads:[~2024-01-01 11:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-01 11:53 [PATCH gcc 1/3] Move GNU/Hurd startfile spec from config/i386/gnu.h to config/gnu.h Sergey Bugaev
2024-01-01 11:53 ` Sergey Bugaev [this message]
2024-01-01 11:53 ` [PATCH gcc 3/3] libgcc: Add basic support for aarch64-gnu (GNU/Hurd on AArch64) Sergey Bugaev
2024-01-03 9:49 ` [PATCH gcc 1/3] Move GNU/Hurd startfile spec from config/i386/gnu.h to config/gnu.h Richard Sandiford
2024-03-20 19:20 ` Thomas Schwinge
2024-03-23 14:38 ` Sergey Bugaev
2024-03-23 14:35 ` [PATCH v2 " Sergey Bugaev
2024-03-23 14:35 ` [PATCH v2 2/3] aarch64: Add support for aarch64-gnu (GNU/Hurd on AArch64) Sergey Bugaev
2024-04-02 17:26 ` Richard Sandiford
2024-04-05 12:13 ` Sergey Bugaev
2024-04-09 7:27 ` Thomas Schwinge
2024-04-09 8:04 ` Sergey Bugaev
2024-04-09 16:24 ` Palmer Dabbelt
2024-04-09 16:57 ` Sergey Bugaev
2024-04-10 0:04 ` Palmer Dabbelt
2024-04-10 7:12 ` Regeneration of 'gcc/config/riscv/riscv.opt.urls' (was: [PATCH v2 2/3] aarch64: Add support for aarch64-gnu (GNU/Hurd on AArch64)) Thomas Schwinge
2024-03-23 14:35 ` [PATCH v2 3/3] libgcc: Add basic support for aarch64-gnu (GNU/Hurd on AArch64) Sergey Bugaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240101115356.614446-2-bugaevc@gmail.com \
--to=bugaevc@gmail.com \
--cc=bug-hurd@gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).