From 3e08219154a35f690606a7cf6f3db3cb95be5466 Mon Sep 17 00:00:00 2001 From: Jaroslaw Pelczar Date: Mon, 2 Sep 2019 20:34:02 +0200 Subject: [PATCH] glue: Add code for ARM64 This allows ARM64 to bootstrap for building of GCC. Signed-off-by: Jaroslaw Pelczar Change-Id: Ia2ea34d1fc1a8e4d3c77a7ef05a32a8603a4fb51 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1851 Reviewed-by: waddlesplash --- src/system/glue/arch/arm64/crti.S | 16 ++++++++++------ src/system/glue/arch/arm64/crtn.S | 21 +++++++++------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/system/glue/arch/arm64/crti.S b/src/system/glue/arch/arm64/crti.S index 680b4f24a5..b95f2d7131 100644 --- a/src/system/glue/arch/arm64/crti.S +++ b/src/system/glue/arch/arm64/crti.S @@ -1,5 +1,5 @@ /* - * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2019 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ @@ -17,12 +17,16 @@ * exit */ -#define FUNCTION(x) .global x; .type x,%function; x +#define FUNCTION(x) .globl x; .type _init, %function; x -.section .init +.section .init, "ax", @progbits +.p2align 16 FUNCTION(_init): - // crtbegin.o stuff comes here + sub sp, sp, #16 + str lr, [sp] -.section .fini +.section .fini, "ax", @progbits +.p2align 16 FUNCTION(_fini): - // crtbegin.o stuff comes here + sub sp, sp, #16 + str lr, [sp] diff --git a/src/system/glue/arch/arm64/crtn.S b/src/system/glue/arch/arm64/crtn.S index 48e3dc6170..eb2822a280 100644 --- a/src/system/glue/arch/arm64/crtn.S +++ b/src/system/glue/arch/arm64/crtn.S @@ -1,17 +1,14 @@ /* - * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2019 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ -/** This file contains the final part of the ".init" and ".fini" sections in - * the ELF executable. It is tightly connected to crti.S. - * Have a look at crti.S to find a description of what happens here. - */ - -.section .init - // the image ID and program args are still on the stack - - -.section .fini - // the image ID and program args are still on the stack +.section .init, "ax", @progbits + ldr lr, [sp] + add sp, sp, #16 + ret +.section .fini, "ax", @progbits + ldr lr, [sp] + add sp, sp, #16 + ret