Skip to content

Commit 46c9166

Browse files
bugaevctschwinge
authored andcommitted
libgcc: Add basic support for aarch64-gnu (GNU/Hurd on AArch64)
There is currently no unwinding implementation. libgcc/ChangeLog: * config.host: Recognize aarch64*-*-gnu* hosts. * config/aarch64/gnu-unwind.h: New file. * config/aarch64/heap-trampoline.c (allocate_trampoline_page): Support GNU/Hurd. Signed-off-by: Sergey Bugaev <[email protected]>
1 parent 9670a23 commit 46c9166

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

libgcc/config.host

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,15 @@ aarch64*-*-linux*)
448448
tmake_file="${tmake_file} t-dfprules"
449449
tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline"
450450
;;
451+
aarch64*-*-gnu*)
452+
extra_parts="$extra_parts crtfastmath.o"
453+
md_unwind_header=aarch64/gnu-unwind.h
454+
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
455+
tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc"
456+
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
457+
tmake_file="${tmake_file} t-dfprules"
458+
tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline"
459+
;;
451460
aarch64*-*-vxworks7*)
452461
extra_parts="$extra_parts crtfastmath.o"
453462
md_unwind_header=aarch64/aarch64-unwind.h

libgcc/config/aarch64/gnu-unwind.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* DWARF2 EH unwinding support for GNU Hurd: aarch64.
2+
Copyright (C) 2020-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
7+
it 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,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
Under Section 7 of GPL version 3, you are granted additional
17+
permissions described in the GCC Runtime Library Exception, version
18+
3.1, as published by the Free Software Foundation.
19+
20+
You should have received a copy of the GNU General Public License and
21+
a copy of the GCC Runtime Library Exception along with this program;
22+
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23+
<http://www.gnu.org/licenses/>. */
24+
25+
/* Always include AArch64 unwinder header file. */
26+
#include "config/aarch64/aarch64-unwind.h"
27+
28+
#ifndef inhibit_libc
29+
30+
#include <signal.h>
31+
32+
/*
33+
* TODO: support for aarch64 needs to be implemented.
34+
*/
35+
36+
#endif /* ifndef inhibit_libc */

libgcc/config/aarch64/heap-trampoline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void *allocate_trampoline_page (void);
2929
void __gcc_nested_func_ptr_created (void *chain, void *func, void *dst);
3030
void __gcc_nested_func_ptr_deleted (void);
3131

32-
#if defined(__linux__)
32+
#if defined(__linux__) || defined(__gnu_hurd__)
3333
static const unsigned char aarch64_trampoline_insns[6][4] = {
3434
{0x5f, 0x24, 0x03, 0xd5}, /* hint 34 */
3535
{0xb1, 0x00, 0x00, 0x58}, /* ldr x17, .+20 */
@@ -82,7 +82,7 @@ allocate_trampoline_page (void)
8282
{
8383
void *page;
8484

85-
#if defined(__linux__)
85+
#if defined(__linux__) || defined(__gnu_hurd__)
8686
page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC,
8787
MAP_ANON | MAP_PRIVATE, 0, 0);
8888
#elif __APPLE__

0 commit comments

Comments
 (0)