Skip to content

Commit 9670a23

Browse files
bugaevctschwinge
authored andcommitted
aarch64: Add support for aarch64-gnu (GNU/Hurd on AArch64)
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 <[email protected]>
1 parent 532c57f commit 9670a23

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

gcc/config.gcc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,12 @@ aarch64*-*-linux*)
12651265
done
12661266
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
12671267
;;
1268+
aarch64*-*-gnu*)
1269+
tm_file="${tm_file} elfos.h gnu-user.h gnu.h glibc-stdint.h"
1270+
tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-gnu.h"
1271+
tmake_file="${tmake_file} aarch64/t-aarch64"
1272+
tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
1273+
;;
12681274
aarch64*-wrs-vxworks*)
12691275
tm_file="${tm_file} elfos.h aarch64/aarch64-elf.h"
12701276
tm_file="${tm_file} vx-common.h vxworks.h aarch64/aarch64-vxworks.h"

gcc/config/aarch64/aarch64-gnu.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* Definitions for AArch64 running GNU/Hurd.
2+
Copyright (C) 2009-2024 Free Software Foundation, Inc.
3+
4+
This file is part of GCC.
5+
6+
GCC is free software; you can redistribute it and/or modify it
7+
under the terms of the GNU General Public License as published by
8+
the Free Software Foundation; either version 3, or (at your option)
9+
any later version.
10+
11+
GCC is distributed in the hope that it will be useful, but
12+
WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with GCC; see the file COPYING3. If not see
18+
<http://www.gnu.org/licenses/>. */
19+
20+
#ifndef GCC_AARCH64_GNU_H
21+
#define GCC_AARCH64_GNU_H
22+
23+
#define GNU_USER_DYNAMIC_LINKER "/lib/ld-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
24+
25+
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
26+
27+
#define GNU_TARGET_LINK_SPEC "%{h*} \
28+
%{static:-Bstatic} \
29+
%{shared:-shared} \
30+
%{symbolic:-Bsymbolic} \
31+
%{!static:%{!static-pie: \
32+
%{rdynamic:-export-dynamic} \
33+
%{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}} \
34+
%{static-pie:-Bstatic -pie --no-dynamic-linker -z text} \
35+
-X \
36+
%{mbig-endian:-EB} %{mlittle-endian:-EL} \
37+
-maarch64gnu%{mabi=ilp32:32}%{mbig-endian:b}"
38+
39+
40+
#define LINK_SPEC GNU_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC
41+
42+
#define GNU_USER_TARGET_MATHFILE_SPEC \
43+
"%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
44+
45+
#undef ENDFILE_SPEC
46+
#define ENDFILE_SPEC \
47+
GNU_USER_TARGET_MATHFILE_SPEC " " \
48+
GNU_USER_TARGET_ENDFILE_SPEC
49+
50+
#define TARGET_OS_CPP_BUILTINS() \
51+
do \
52+
{ \
53+
GNU_USER_TARGET_OS_CPP_BUILTINS(); \
54+
} \
55+
while (0)
56+
57+
#define TARGET_ASM_FILE_END aarch64_file_end_indicate_exec_stack
58+
59+
/* Uninitialized common symbols in non-PIE executables, even with
60+
strong definitions in dependent shared libraries, will resolve
61+
to COPY relocated symbol in the executable. See PR65780. */
62+
#undef TARGET_BINDS_LOCAL_P
63+
#define TARGET_BINDS_LOCAL_P default_binds_local_p_2
64+
65+
/* Define this to be nonzero if static stack checking is supported. */
66+
#define STACK_CHECK_STATIC_BUILTIN 1
67+
68+
#endif /* GCC_AARCH64_GNU_H */

0 commit comments

Comments
 (0)