Skip to content

Commit

Permalink
libgcc: Add basic support for aarch64-gnu (GNU/Hurd on AArch64)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bugaevc authored and tschwinge committed Apr 9, 2024
1 parent 9670a23 commit 46c9166
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
9 changes: 9 additions & 0 deletions libgcc/config.host
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,15 @@ aarch64*-*-linux*)
tmake_file="${tmake_file} t-dfprules"
tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline"
;;
aarch64*-*-gnu*)
extra_parts="$extra_parts crtfastmath.o"
md_unwind_header=aarch64/gnu-unwind.h
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc"
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
tmake_file="${tmake_file} t-dfprules"
tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline"
;;
aarch64*-*-vxworks7*)
extra_parts="$extra_parts crtfastmath.o"
md_unwind_header=aarch64/aarch64-unwind.h
Expand Down
36 changes: 36 additions & 0 deletions libgcc/config/aarch64/gnu-unwind.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* DWARF2 EH unwinding support for GNU Hurd: aarch64.
Copyright (C) 2020-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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */

/* Always include AArch64 unwinder header file. */
#include "config/aarch64/aarch64-unwind.h"

#ifndef inhibit_libc

#include <signal.h>

/*
* TODO: support for aarch64 needs to be implemented.
*/

#endif /* ifndef inhibit_libc */
4 changes: 2 additions & 2 deletions libgcc/config/aarch64/heap-trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void *allocate_trampoline_page (void);
void __gcc_nested_func_ptr_created (void *chain, void *func, void *dst);
void __gcc_nested_func_ptr_deleted (void);

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

#if defined(__linux__)
#if defined(__linux__) || defined(__gnu_hurd__)
page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC,
MAP_ANON | MAP_PRIVATE, 0, 0);
#elif __APPLE__
Expand Down

0 comments on commit 46c9166

Please sign in to comment.