Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 1 | /* Internal definitions for interface for libebl. |
Mark Wielaard | c1c1c06 | 2014-06-14 17:15:37 +0200 | [diff] [blame] | 2 | Copyright (C) 2000-2009, 2013, 2014 Red Hat, Inc. |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 3 | This file is part of elfutils. |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 4 | |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 5 | This file is free software; you can redistribute it and/or modify |
| 6 | it under the terms of either |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 7 | |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 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 |
Ulrich Drepper | 361df7d | 2006-04-04 21:38:57 +0000 | [diff] [blame] | 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 | |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 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/>. */ |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 28 | |
| 29 | #ifndef _LIBEBLP_H |
| 30 | #define _LIBEBLP_H 1 |
| 31 | |
| 32 | #include <gelf.h> |
Ulrich Drepper | 3cbdd38 | 2008-01-02 17:44:39 +0000 | [diff] [blame] | 33 | #include <libasm.h> |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 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 | |
Ulrich Drepper | a38998e | 2005-08-03 02:05:39 +0000 | [diff] [blame] | 47 | /* ELF machine, class, and data encoding. */ |
Roland McGrath | cd60ea8 | 2005-11-16 01:57:40 +0000 | [diff] [blame] | 48 | uint_fast16_t machine; |
| 49 | uint_fast8_t class; |
| 50 | uint_fast8_t data; |
Ulrich Drepper | a38998e | 2005-08-03 02:05:39 +0000 | [diff] [blame] | 51 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 52 | /* The libelf handle (if known). */ |
| 53 | Elf *elf; |
| 54 | |
Roland McGrath | cd60ea8 | 2005-11-16 01:57:40 +0000 | [diff] [blame] | 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 |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 59 | |
Ulrich Drepper | 28ed895 | 2006-07-07 03:43:47 +0000 | [diff] [blame] | 60 | /* Size of entry in Sysv-style hash table. */ |
| 61 | int sysvhash_entrysize; |
| 62 | |
Jan Kratochvil | 0b86746 | 2013-05-30 14:37:38 +0200 | [diff] [blame] | 63 | /* Number of registers to allocate for ebl_set_initial_registers_tid. |
| 64 | Ebl architecture can unwind iff FRAME_NREGS > 0. */ |
| 65 | size_t frame_nregs; |
| 66 | |
Jose E. Marchesi | 42f0df1 | 2015-12-08 19:10:40 +0100 | [diff] [blame] | 67 | /* Offset to apply to the value of the return_address_register, as |
| 68 | fetched from a Dwarf CFI. This is used by some backends, where |
| 69 | the return_address_register actually contains the call |
| 70 | address. */ |
| 71 | int ra_offset; |
| 72 | |
Mark Wielaard | c1c1c06 | 2014-06-14 17:15:37 +0200 | [diff] [blame] | 73 | /* Mask to use to turn a function value into a real function address |
| 74 | in case the architecture adds some extra non-address bits to it. |
| 75 | If not initialized (0) then ebl_func_addr_mask will return ~0, |
| 76 | otherwise it should be the actual mask to use. */ |
| 77 | GElf_Addr func_addr_mask; |
| 78 | |
Mark Wielaard | 159ac52 | 2013-12-18 11:05:54 +0100 | [diff] [blame] | 79 | /* Function descriptor load address and table as used by |
| 80 | ebl_resolve_sym_value if available for this arch. */ |
| 81 | GElf_Addr fd_addr; |
| 82 | Elf_Data *fd_data; |
| 83 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 84 | /* Internal data. */ |
| 85 | void *dlhandle; |
| 86 | }; |
| 87 | |
| 88 | |
| 89 | /* Type of the initialization functions in the backend modules. */ |
| 90 | typedef const char *(*ebl_bhinit_t) (Elf *, GElf_Half, Ebl *, size_t); |
| 91 | |
| 92 | |
| 93 | /* gettext helper macros. */ |
Ulrich Drepper | 28ed895 | 2006-07-07 03:43:47 +0000 | [diff] [blame] | 94 | #undef _ |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 95 | #define _(Str) dgettext ("elfutils", Str) |
| 96 | |
Roland McGrath | 3c84db3 | 2009-06-24 17:41:40 -0700 | [diff] [blame] | 97 | |
| 98 | /* LEB128 constant helper macros. */ |
| 99 | #define ULEB128_7(x) (BUILD_BUG_ON_ZERO ((x) >= (1U << 7)) + (x)) |
| 100 | |
| 101 | #define BUILD_BUG_ON_ZERO(x) (sizeof (char [(x) ? -1 : 1]) - 1) |
| 102 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 103 | #endif /* libeblP.h */ |