libelf.h (62b628a68db596a2d75a316dc7ffef658079231f) | libelf.h (7a3fc0ccaf807a654980fdce2d9187503628b99d) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 10 unchanged lines hidden (view full) --- 19 * CDDL HEADER END 20 */ 21/* Copyright (c) 1988 AT&T */ 22/* All Rights Reserved */ 23 24/* 25 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms. | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 10 unchanged lines hidden (view full) --- 19 * CDDL HEADER END 20 */ 21/* Copyright (c) 1988 AT&T */ 22/* All Rights Reserved */ 23 24/* 25 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms. |
27 * Copyright 2014 PALO, Richard. All rights reserved. |
|
27 */ 28 29#ifndef _LIBELF_H 30#define _LIBELF_H 31 32#include <sys/types.h> 33#include <sys/elf.h> 34 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40 41#if defined(_ILP32) && (_FILE_OFFSET_BITS != 32) 42#error "large files are not supported by libelf" 43#endif 44 | 28 */ 29 30#ifndef _LIBELF_H 31#define _LIBELF_H 32 33#include <sys/types.h> 34#include <sys/elf.h> 35 36 37#ifdef __cplusplus 38extern "C" { 39#endif 40 41 42#if defined(_ILP32) && (_FILE_OFFSET_BITS != 32) 43#error "large files are not supported by libelf" 44#endif 45 |
46typedef void Elf_Void; |
|
45 | 47 |
46#undef _ 47#ifdef __STDC__ 48typedef void Elf_Void; 49#define _(a) a 50#else 51typedef char Elf_Void; 52#define _(a) () 53#undef const 54#define const 55#endif 56 57 | |
58/* 59 * Commands 60 */ 61typedef enum { 62 ELF_C_NULL = 0, /* must be first, 0 */ 63 ELF_C_READ, 64 ELF_C_WRITE, 65 ELF_C_CLR, --- 95 unchanged lines hidden (view full) --- 161 size_t d_align; /* alignment in section */ 162 unsigned d_version; /* elf version */ 163} Elf_Data; 164 165 166/* 167 * Function declarations 168 */ | 48/* 49 * Commands 50 */ 51typedef enum { 52 ELF_C_NULL = 0, /* must be first, 0 */ 53 ELF_C_READ, 54 ELF_C_WRITE, 55 ELF_C_CLR, --- 95 unchanged lines hidden (view full) --- 151 size_t d_align; /* alignment in section */ 152 unsigned d_version; /* elf version */ 153} Elf_Data; 154 155 156/* 157 * Function declarations 158 */ |
169Elf *elf_begin _((int, Elf_Cmd, Elf *)); 170int elf_cntl _((Elf *, Elf_Cmd)); 171int elf_end _((Elf *)); 172const char *elf_errmsg _((int)); 173int elf_errno _((void)); 174void elf_fill _((int)); 175unsigned elf_flagdata _((Elf_Data *, Elf_Cmd, unsigned)); 176unsigned elf_flagehdr _((Elf *, Elf_Cmd, unsigned)); 177unsigned elf_flagelf _((Elf *, Elf_Cmd, unsigned)); 178unsigned elf_flagphdr _((Elf *, Elf_Cmd, unsigned)); 179unsigned elf_flagscn _((Elf_Scn *, Elf_Cmd, unsigned)); 180unsigned elf_flagshdr _((Elf_Scn *, Elf_Cmd, unsigned)); 181size_t elf32_fsize _((Elf_Type, size_t, unsigned)); 182Elf_Arhdr *elf_getarhdr _((Elf *)); 183Elf_Arsym *elf_getarsym _((Elf *, size_t *)); 184off_t elf_getbase _((Elf *)); 185Elf_Data *elf_getdata _((Elf_Scn *, Elf_Data *)); 186Elf32_Ehdr *elf32_getehdr _((Elf *)); 187char *elf_getident _((Elf *, size_t *)); 188Elf32_Phdr *elf32_getphdr _((Elf *)); 189Elf_Scn *elf_getscn _((Elf *elf, size_t)); 190Elf32_Shdr *elf32_getshdr _((Elf_Scn *)); 191int elf_getphnum _((Elf *, size_t *)); 192int elf_getphdrnum _((Elf *, size_t *)); 193int elf_getshnum _((Elf *, size_t *)); 194int elf_getshdrnum _((Elf *, size_t *)); 195int elf_getshstrndx _((Elf *, size_t *)); 196int elf_getshdrstrndx _((Elf *, size_t *)); 197unsigned long elf_hash _((const char *)); 198uint_t elf_sys_encoding _((void)); 199long elf32_checksum _((Elf *)); 200Elf_Kind elf_kind _((Elf *)); 201Elf *elf_memory _((char *, size_t)); 202size_t elf_ndxscn _((Elf_Scn *)); 203Elf_Data *elf_newdata _((Elf_Scn *)); 204Elf32_Ehdr *elf32_newehdr _((Elf *)); 205Elf32_Phdr *elf32_newphdr _((Elf *, size_t)); 206Elf_Scn *elf_newscn _((Elf *)); 207Elf_Scn *elf_nextscn _((Elf *, Elf_Scn *)); 208Elf_Cmd elf_next _((Elf *)); 209size_t elf_rand _((Elf *, size_t)); 210Elf_Data *elf_rawdata _((Elf_Scn *, Elf_Data *)); 211char *elf_rawfile _((Elf *, size_t *)); 212char *elf_strptr _((Elf *, size_t, size_t)); 213off_t elf_update _((Elf *, Elf_Cmd)); 214unsigned elf_version _((unsigned)); 215Elf_Data *elf32_xlatetof _((Elf_Data *, const Elf_Data *, unsigned)); 216Elf_Data *elf32_xlatetom _((Elf_Data *, const Elf_Data *, unsigned)); | 159Elf *elf_begin(int, Elf_Cmd, Elf *); 160int elf_cntl(Elf *, Elf_Cmd); 161int elf_end(Elf *); 162const char *elf_errmsg(int); 163int elf_errno(void); 164void elf_fill(int); 165unsigned elf_flagdata(Elf_Data *, Elf_Cmd, unsigned); 166unsigned elf_flagehdr(Elf *, Elf_Cmd, unsigned); 167unsigned elf_flagelf(Elf *, Elf_Cmd, unsigned); 168unsigned elf_flagphdr(Elf *, Elf_Cmd, unsigned); 169unsigned elf_flagscn(Elf_Scn *, Elf_Cmd, unsigned); 170unsigned elf_flagshdr(Elf_Scn *, Elf_Cmd, unsigned); 171size_t elf32_fsize(Elf_Type, size_t, unsigned); 172Elf_Arhdr *elf_getarhdr(Elf *); 173Elf_Arsym *elf_getarsym(Elf *, size_t *); 174off_t elf_getbase(Elf *); 175Elf_Data *elf_getdata(Elf_Scn *, Elf_Data *); 176Elf32_Ehdr *elf32_getehdr(Elf *); 177char *elf_getident(Elf *, size_t *); 178Elf32_Phdr *elf32_getphdr(Elf *); 179Elf_Scn *elf_getscn(Elf *elf, size_t); 180Elf32_Shdr *elf32_getshdr(Elf_Scn *); 181int elf_getphnum(Elf *, size_t *); 182int elf_getphdrnum(Elf *, size_t *); 183int elf_getshnum(Elf *, size_t *); 184int elf_getshdrnum(Elf *, size_t *); 185int elf_getshstrndx(Elf *, size_t *); 186int elf_getshdrstrndx(Elf *, size_t *); 187unsigned long elf_hash(const char *); 188uint_t elf_sys_encoding(void); 189long elf32_checksum(Elf *); 190Elf_Kind elf_kind(Elf *); 191Elf *elf_memory(char *, size_t); 192size_t elf_ndxscn(Elf_Scn *); 193Elf_Data *elf_newdata(Elf_Scn *); 194Elf32_Ehdr *elf32_newehdr(Elf *); 195Elf32_Phdr *elf32_newphdr(Elf *, size_t); 196Elf_Scn *elf_newscn(Elf *); 197Elf_Scn *elf_nextscn(Elf *, Elf_Scn *); 198Elf_Cmd elf_next(Elf *); 199size_t elf_rand(Elf *, size_t); 200Elf_Data *elf_rawdata(Elf_Scn *, Elf_Data *); 201char *elf_rawfile(Elf *, size_t *); 202char *elf_strptr(Elf *, size_t, size_t); 203off_t elf_update(Elf *, Elf_Cmd); 204unsigned elf_version(unsigned); 205Elf_Data *elf32_xlatetof(Elf_Data *, const Elf_Data *, unsigned); 206Elf_Data *elf32_xlatetom(Elf_Data *, const Elf_Data *, unsigned); |
217 218#if defined(_LP64) || defined(_LONGLONG_TYPE) | 207 208#if defined(_LP64) || defined(_LONGLONG_TYPE) |
219size_t elf64_fsize _((Elf_Type, size_t, unsigned)); 220Elf64_Ehdr *elf64_getehdr _((Elf *)); 221Elf64_Phdr *elf64_getphdr _((Elf *)); 222Elf64_Shdr *elf64_getshdr _((Elf_Scn *)); 223long elf64_checksum _((Elf *)); 224Elf64_Ehdr *elf64_newehdr _((Elf *)); 225Elf64_Phdr *elf64_newphdr _((Elf *, size_t)); 226Elf_Data *elf64_xlatetof _((Elf_Data *, const Elf_Data *, unsigned)); 227Elf_Data *elf64_xlatetom _((Elf_Data *, const Elf_Data *, unsigned)); | 209size_t elf64_fsize(Elf_Type, size_t, unsigned); 210Elf64_Ehdr *elf64_getehdr(Elf *); 211Elf64_Phdr *elf64_getphdr(Elf *); 212Elf64_Shdr *elf64_getshdr(Elf_Scn *); 213long elf64_checksum(Elf *); 214Elf64_Ehdr *elf64_newehdr(Elf *); 215Elf64_Phdr *elf64_newphdr(Elf *, size_t); 216Elf_Data *elf64_xlatetof(Elf_Data *, const Elf_Data *, unsigned); 217Elf_Data *elf64_xlatetom(Elf_Data *, const Elf_Data *, unsigned); |
228#endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */ 229 | 218#endif /* (defined(_LP64) || defined(_LONGLONG_TYPE) */ 219 |
230#undef _ 231 | |
232#ifdef __cplusplus 233} 234#endif 235 236#endif /* _LIBELF_H */ | 220#ifdef __cplusplus 221} 222#endif 223 224#endif /* _LIBELF_H */ |