rtld_machdep.h revision 50476
145501Sjdp/*-
245501Sjdp * Copyright (c) 1999 John D. Polstra.
345501Sjdp * All rights reserved.
445501Sjdp *
545501Sjdp * Redistribution and use in source and binary forms, with or without
645501Sjdp * modification, are permitted provided that the following conditions
745501Sjdp * are met:
845501Sjdp * 1. Redistributions of source code must retain the above copyright
945501Sjdp *    notice, this list of conditions and the following disclaimer.
1045501Sjdp * 2. Redistributions in binary form must reproduce the above copyright
1145501Sjdp *    notice, this list of conditions and the following disclaimer in the
1245501Sjdp *    documentation and/or other materials provided with the distribution.
1345501Sjdp *
1445501Sjdp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1545501Sjdp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1645501Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1745501Sjdp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1845501Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1945501Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2045501Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2145501Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2245501Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2345501Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2445501Sjdp * SUCH DAMAGE.
2545501Sjdp *
2650476Speter * $FreeBSD: head/libexec/rtld-elf/amd64/rtld_machdep.h 50476 1999-08-28 00:22:10Z peter $
2745501Sjdp */
2845501Sjdp
2945501Sjdp#ifndef RTLD_MACHDEP_H
3045501Sjdp#define RTLD_MACHDEP_H	1
3145501Sjdp
3245501Sjdp/* Return the address of the .dynamic section in the dynamic linker. */
3345501Sjdp#define rtld_dynamic(obj) \
3445501Sjdp    ((const Elf_Dyn *)((obj)->relocbase + (Elf_Addr)&_DYNAMIC))
3545501Sjdp
3648205Sjdp/* Fixup the jump slot at "where" to transfer control to "target". */
3748205Sjdp#define reloc_jmpslot(where, target)			\
3848205Sjdp    do {						\
3948205Sjdp	dbg("reloc_jmpslot: *%p = %p", (void *)(where),	\
4048205Sjdp	  (void *)(target));				\
4148205Sjdp	(*(Elf_Addr *)(where) = (Elf_Addr)(target));	\
4248205Sjdp    } while (0)
4348205Sjdp
4445501Sjdp#endif
45