192195Sjake/*-
292195Sjake * Copyright (c) 1999, 2000 John D. Polstra.
392195Sjake * All rights reserved.
492195Sjake *
592195Sjake * Redistribution and use in source and binary forms, with or without
692195Sjake * modification, are permitted provided that the following conditions
792195Sjake * are met:
892195Sjake * 1. Redistributions of source code must retain the above copyright
992195Sjake *    notice, this list of conditions and the following disclaimer.
1092195Sjake * 2. Redistributions in binary form must reproduce the above copyright
1192195Sjake *    notice, this list of conditions and the following disclaimer in the
1292195Sjake *    documentation and/or other materials provided with the distribution.
1392195Sjake *
1492195Sjake * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1592195Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1692195Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1792195Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1892195Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1992195Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2092195Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2192195Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2292195Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2392195Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2492195Sjake * SUCH DAMAGE.
2592195Sjake *
2692195Sjake * $FreeBSD: releng/11.0/libexec/rtld-elf/sparc64/rtld_machdep.h 293066 2016-01-03 04:32:02Z imp $
2792195Sjake */
2892195Sjake
2992195Sjake#ifndef RTLD_MACHDEP_H
3092195Sjake#define RTLD_MACHDEP_H	1
3192195Sjake
32104724Sru#include <sys/types.h>
3392195Sjake#include <machine/atomic.h>
3492195Sjake
3592195Sjakestruct Struct_Obj_Entry;
3692195Sjake
3792195Sjake/* Return the address of the .dynamic section in the dynamic linker. */
38174128SrwatsonElf_Dyn *rtld_dynamic_addr(void);
39130661Stmm#define	rtld_dynamic(obj)	rtld_dynamic_addr()
40130661Stmm#define	RTLD_IS_DYNAMIC()	(rtld_dynamic_addr() != NULL)
4192195Sjake
4292195SjakeElf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr,
43107071Stmm		       const struct Struct_Obj_Entry *,
44107071Stmm		       const struct Struct_Obj_Entry *,
45107071Stmm		       const Elf_Rel *);
4692195Sjake
4792195Sjake#define make_function_pointer(def, defobj) \
4892195Sjake	((defobj)->relocbase + (def)->st_value)
4992195Sjake
5092195Sjake#define call_initfini_pointer(obj, target) \
5192195Sjake	(((InitFunc)(target))())
5292195Sjake
53232831Skib#define call_init_pointer(obj, target) \
54232831Skib	(((InitArrFunc)(target))(main_argc, main_argv, environ))
55232831Skib
56133063Sdfr#define round(size, align) \
57133063Sdfr	(((size) + (align) - 1) & ~((align) - 1))
58133063Sdfr#define calculate_first_tls_offset(size, align) \
59133063Sdfr	round(size, align)
60133063Sdfr#define calculate_tls_offset(prev_offset, prev_size, size, align) \
61133063Sdfr	round((prev_offset) + (size), align)
62133063Sdfr#define calculate_tls_end(off, size) 	((off) + (size))
63133063Sdfr
64133063Sdfrtypedef struct {
65133063Sdfr    unsigned long ti_module;
66133063Sdfr    unsigned long ti_offset;
67133063Sdfr} tls_index;
68133063Sdfr
69133063Sdfrextern void *__tls_get_addr(tls_index *ti);
70133063Sdfr
71217851Skib#define	RTLD_DEFAULT_STACK_PF_EXEC	0
72217851Skib#define	RTLD_DEFAULT_STACK_EXEC		0
73217851Skib
74293066Simp#define md_abi_variant_hook(x)
75293066Simp
7692195Sjake#endif
77