Imported Upstream version 0.155
[platform/upstream/elfutils.git] / libebl / libeblP.h
1 /* Internal definitions for interface for libebl.
2    Copyright (C) 2000-2009 Red Hat, Inc.
3    This file is part of elfutils.
4
5    This file is free software; you can redistribute it and/or modify
6    it under the terms of either
7
8      * the GNU Lesser General Public License as published by the Free
9        Software Foundation; either version 3 of the License, or (at
10        your option) any later version
11
12    or
13
14      * the GNU General Public License as published by the Free
15        Software Foundation; either version 2 of the License, or (at
16        your option) any later version
17
18    or both in parallel, as here.
19
20    elfutils is distributed in the hope that it will be useful, but
21    WITHOUT ANY WARRANTY; without even the implied warranty of
22    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23    General Public License for more details.
24
25    You should have received copies of the GNU General Public License and
26    the GNU Lesser General Public License along with this program.  If
27    not, see <http://www.gnu.org/licenses/>.  */
28
29 #ifndef _LIBEBLP_H
30 #define _LIBEBLP_H 1
31
32 #include <gelf.h>
33 #include <libasm.h>
34 #include <libebl.h>
35 #include <libintl.h>
36
37
38 /* Backend handle.  */
39 struct ebl
40 {
41   /* Machine name.  */
42   const char *name;
43
44   /* Emulation name.  */
45   const char *emulation;
46
47   /* ELF machine, class, and data encoding.  */
48   uint_fast16_t machine;
49   uint_fast8_t class;
50   uint_fast8_t data;
51
52   /* The libelf handle (if known).  */
53   Elf *elf;
54
55   /* See ebl-hooks.h for the declarations of the hook functions.  */
56 # define EBLHOOK(name) (*name)
57 # include "ebl-hooks.h"
58 # undef EBLHOOK
59
60   /* Size of entry in Sysv-style hash table.  */
61   int sysvhash_entrysize;
62
63   /* Internal data.  */
64   void *dlhandle;
65 };
66
67
68 /* Type of the initialization functions in the backend modules.  */
69 typedef const char *(*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *, size_t);
70
71
72 /* gettext helper macros.  */
73 #undef _
74 #define _(Str) dgettext ("elfutils", Str)
75
76
77 /* LEB128 constant helper macros.  */
78 #define ULEB128_7(x)    (BUILD_BUG_ON_ZERO ((x) >= (1U << 7)) + (x))
79
80 #define BUILD_BUG_ON_ZERO(x) (sizeof (char [(x) ? -1 : 1]) - 1)
81
82 #endif  /* libeblP.h */