Path: blob/main/libexec/rtld-elf/arm/rtld_machdep.h
34923 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 1999, 2000 John D. Polstra.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#ifndef RTLD_MACHDEP_H29#define RTLD_MACHDEP_H 13031#include <sys/types.h>32#include <machine/atomic.h>33#include <machine/acle-compat.h>34#include <machine/tls.h>3536struct Struct_Obj_Entry;3738#define MD_OBJ_ENTRY3940/* Return the address of the .dynamic section in the dynamic linker. */41#define rtld_dynamic(obj) (&_DYNAMIC)4243/* No arch-specific dynamic tags */44#define arch_digest_dynamic(obj, dynp) false4546/* No architecture specific notes */47#define arch_digest_note(obj, note) false4849Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target,50const struct Struct_Obj_Entry *defobj, const struct Struct_Obj_Entry *obj,51const Elf_Rel *rel);5253#define make_function_pointer(def, defobj) \54((defobj)->relocbase + (def)->st_value)5556#define call_initfini_pointer(obj, target) \57(((InitFunc)(target))())5859#define call_init_pointer(obj, target) \60(((InitArrFunc)(target))(main_argc, main_argv, environ))6162#define call_ifunc_resolver(ptr) \63(((Elf_Addr (*)(void))ptr)())6465typedef struct {66unsigned long ti_module;67unsigned long ti_offset;68} tls_index;6970#define round(size, align) \71(((size) + (align) - 1) & ~((align) - 1))72#define calculate_first_tls_offset(size, align, offset) \73round(8, align)74#define calculate_tls_offset(prev_offset, prev_size, size, align, offset) \75round(prev_offset + prev_size, align)76#define calculate_tls_post_size(align) \77round(TLS_TCB_SIZE, align) - TLS_TCB_SIZE7879extern void *__tls_get_addr(tls_index *ti);8081#define md_abi_variant_hook(x)8283#endif848586