1/* 2 * Copyright 2019 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6/** This file contains the first part of the ".init" and ".fini" sections in 7 * the ELF executable. 8 * The functions defined here will be called during initialization/termination 9 * of the loaded executable/library. The ".init" and ".fini" sections are 10 * stacked together like this: 11 * 12 * crti.S entry point 13 * call to _init_before/_term_before 14 * crtbegin.S GCC specific: constructors/destructors are called, ... 15 * crtend.S 16 * crtn.S call to _init_after/_term_after 17 * exit 18 */ 19 20#define FUNCTION(x) .globl x; .type _init, %function; x 21 22.section .init, "ax", @progbits 23.p2align 16 24FUNCTION(_init): 25 sub sp, sp, #16 26 str lr, [sp] 27 28.section .fini, "ax", @progbits 29.p2align 16 30FUNCTION(_fini): 31 sub sp, sp, #16 32 str lr, [sp] 33