link.h revision 2020b2b6df0384feda1732f65486c4604fbf5bea
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _LINK_H
#define _LINK_H
#ifndef _ASM
#include <libelf.h>
#include <dlfcn.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
/*
* ld support library calls
*/
#ifdef __STDC__
extern void ld_input_done(uint_t *);
extern void ld_start(const char *, const Elf32_Half, const char *);
extern void ld_atexit(int);
#if defined(_LP64) || defined(_LONGLONG_TYPE)
extern void ld_start64(const char *, const Elf64_Half, const char *);
extern void ld_atexit64(int);
#endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */
#else
extern void ld_version();
extern void ld_input_done();
extern void ld_start();
extern void ld_atexit();
extern void ld_open();
extern void ld_file();
extern void ld_input_section();
extern void ld_section();
#if defined(_LP64) || defined(_LONGLONG_TYPE)
extern void ld_start64();
extern void ld_atexit64();
extern void ld_open64();
extern void ld_file64();
extern void ld_input_section64();
extern void ld_section64();
#endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */
#endif /* __STDC__ */
/*
* ld_version() version values.
*/
#define LD_SUP_VNONE 0
#define LD_SUP_VERSION1 1
#define LD_SUP_VERSION2 2
#define LD_SUP_VERSION3 3
#define LD_SUP_VCURRENT LD_SUP_VERSION3
/*
* Flags passed to ld support calls.
*/
#endif
/*
* Runtime link-map identifiers.
*/
#define LM_ID_BASE 0x00
#define LM_ID_LDSO 0x01
#define LM_ID_NUM 2
/*
* Runtime Link-Edit Auditing.
*/
#define LAV_NONE 0
#define LAV_VERSION1 1
#define LAV_VERSION2 2
#define LAV_VERSION3 3
#define LAV_VERSION4 4
#define LAV_VERSION5 5
#define LAV_CURRENT LAV_VERSION5
#define LAV_NUM 6
/*
* Flags that can be or'd into the la_objopen() return code
*/
/*
* Flags that can be or'd into the 'flags' argument of la_symbind()
*/
/* structure as it's return code */
/* a call to dlsym() */
/* by la_symbind() */
/*
* Flags that describe the object passed to la_objsearch()
*/
/*
* Flags that describe the la_activity()
*/
#define LA_ACT_MAX 3
#ifndef _KERNEL
#ifndef _ASM
#if defined(_LP64)
typedef long lagreg_t;
#else
typedef int lagreg_t;
#endif
struct _la_sparc_regs {
};
#if defined(_LP64)
typedef struct _la_sparc_regs La_sparcv9_regs;
typedef struct {
#else
typedef struct _la_sparc_regs La_sparcv8_regs;
typedef struct {
} La_i86_regs;
#endif
#if !defined(_SYS_INT_TYPES_H)
typedef unsigned long uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#endif
#ifdef __STDC__
extern void la_preinit(uintptr_t *);
uint_t);
#if defined(_LP64)
const char *);
const char *);
#else /* !defined(_LP64) */
#endif /* _LP64 */
#else /* __STDC__ */
extern uint_t la_version();
extern void la_preinit();
extern uint_t la_objopen();
extern uint_t la_objclose();
extern int la_objfilter();
#if defined(_LP64)
extern uintptr_t la_sparcv9_pltenter();
extern uintptr_t la_pltexit64();
extern uintptr_t la_symbind64();
#else /* _ILP32 */
extern uintptr_t la_sparcv8_pltenter();
extern uintptr_t la_i86_pltenter();
extern uintptr_t la_pltexit();
extern uintptr_t la_symbind32();
#endif /* _LP64 */
#endif /* __STDC__ */
#ifdef __STDC__
/*
* the dl_phdr_info structure used by dl_phdr_iterate(), which also
* originated under Linux. Given an ELF data type, without the ElfXX_
* prefix, it supplies the appropriate prefix (Elf32_ or Elf64_) for
* the ELFCLASS of the code being compiled.
*
* Note that ElfW() is not suitable in situations in which the ELFCLASS
* of the code being compiled does not match that of the objects that
* code is intended to operate on (e.g. a 32-bit link-editor building
* recommended in such cases.
*/
#ifdef _LP64
#else
#endif
/*
* The callback function to dl_interate_phdr() receives a pointer
* to a structure of this type.
*
* dlpi_addr is defined such that the address of any segment in
* the program header array can be calculated as:
*
* addr == info->dlpi_addr + info->dlpi_phdr[x].p_vaddr;
*
* It is therefore 0 for ET_EXEC objects, and the base address at
* which the object is mapped otherwise.
*/
struct dl_phdr_info {
const char *dlpi_name; /* Null-terminated obj name */
/*
* Note: Following members were introduced after the first version
* of this structure was available. The dl_iterate_phdr() callback
* function is passed a 'size' argument giving the size of the info
* structure, and must compare that size to the offset of these fields
* before accessing them to ensure that they are present.
*/
/* Incremented when a new object is mapped into the process */
/* Incremented when an object is unmapped from the process */
};
void *);
#endif /* __STDC__ */
#endif /* _ASM */
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _LINK_H */