[BACK]Return to arc-plt.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / external / gpl3 / binutils.old / dist / bfd

Annotation of src/external/gpl3/binutils.old/dist/bfd/arc-plt.h, Revision 1.1.1.1

1.1       christos    1: /* ARC-specific header file for PLT support.
                      2:    Copyright (C) 2016 Free Software Foundation, Inc.
                      3:    Contributed by Cupertino Miranda (cmiranda@synopsys.com).
                      4:
                      5:    This file is part of BFD, the Binary File Descriptor library.
                      6:
                      7:    This program is free software; you can redistribute it and/or modify
                      8:    it under the terms of the GNU General Public License as published by
                      9:    the Free Software Foundation; either version 3 of the License, or
                     10:    (at your option) any later version.
                     11:
                     12:    This program is distributed in the hope that it will be useful,
                     13:    but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15:    GNU General Public License for more details.
                     16:
                     17:    You should have received a copy of the GNU General Public License
                     18:    along with this program; if not, write to the Free Software
                     19:    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
                     20:    MA 02110-1301, USA.  */
                     21:
                     22: #ifndef ARC_PLT_H
                     23: #define ARC_PLT_H
                     24:
                     25: #include <stdint.h>
                     26:
                     27: /* Instructions appear in memory as a sequence of half-words (16 bit);
                     28:    individual half-words are represented on the target in target byte order.
                     29:    We use 'unsigned short' on the host to represent the PLT templates,
                     30:    and translate to target byte order as we copy to the target.  */
                     31: typedef uint16_t insn_hword;
                     32:
                     33: enum plt_reloc_symbol
                     34: {
                     35:   LAST_RELOC = 0,
                     36:
                     37:   SGOT = 1,
                     38:
                     39:   RELATIVE = (1 << 8),
                     40:   RELATIVE_INSN_32 = (1 << 9),
                     41:   RELATIVE_INSN_24 = (1 << 10),
                     42:
                     43:   MIDDLE_ENDIAN = (1 << 11)
                     44: };
                     45:
                     46: #define IS_RELATIVE(S)      ((S & (RELATIVE | RELATIVE_INSN_24 | RELATIVE_INSN_32)) != 0)
                     47: #define IS_INSN_32(S)       ((S & RELATIVE_INSN_32) != 0)
                     48: #define IS_INSN_24(S)       ((S & RELATIVE_INSN_24) != 0)
                     49: #define IS_MIDDLE_ENDIAN(S) ((S & MIDDLE_ENDIAN) != 0)
                     50: #define SYM_ONLY(S)         (S & 0xFF)
                     51:
                     52: struct plt_reloc
                     53: {
                     54:   bfd_vma        offset;
                     55:   bfd_vma        size;
                     56:   bfd_vma        mask;
                     57:   enum plt_reloc_symbol symbol;
                     58:   bfd_vma        addend;
                     59: };
                     60:
                     61:
                     62: #define PLT_TYPE_START(NAME) NAME,
                     63: #define PLT_TYPE_END(NAME)
                     64: #define PLT_ENTRY(...)
                     65: #define PLT_ELEM(...)
                     66: #define ENTRY_RELOC(...)
                     67: #define ELEM_RELOC(...)
                     68:
                     69: enum plt_types_enum
                     70: {
                     71:   PLT_START = -1,
                     72: #include "arc-plt.def"
                     73:   PLT_MAX
                     74: };
                     75:
                     76: #undef PLT_TYPE_START
                     77: #undef PLT_TYPE_END
                     78: #undef PLT_ENTRY
                     79: #undef PLT_ELEM
                     80: #undef ENTRY_RELOC
                     81: #undef ELEM_RELOC
                     82:
                     83: typedef insn_hword insn_hword_array[];
                     84:
                     85: struct plt_version_t
                     86: {
                     87:   const insn_hword_array *entry;
                     88:   const bfd_vma                  entry_size;
                     89:   const insn_hword_array *elem;
                     90:   const bfd_vma                  elem_size;
                     91:
                     92:   const struct plt_reloc *entry_relocs;
                     93:   const struct plt_reloc *elem_relocs;
                     94: };
                     95:
                     96: #define PLT_TYPE_START(NAME) \
                     97:   const insn_hword NAME##_plt_entry[] = {
                     98: #define PLT_TYPE_END(NAME) };
                     99: #define PLT_ENTRY(...) __VA_ARGS__,
                    100: #define PLT_ELEM(...)
                    101: #define ENTRY_RELOC(...)
                    102: #define ELEM_RELOC(...)
                    103:
                    104: #include "arc-plt.def"
                    105:
                    106: #undef PLT_TYPE_START
                    107: #undef PLT_TYPE_END
                    108: #undef PLT_ENTRY
                    109: #undef PLT_ELEM
                    110: #undef ENTRY_RELOC
                    111: #undef ELEM_RELOC
                    112:
                    113: #define PLT_TYPE_START(NAME) \
                    114:   const struct plt_reloc NAME##_plt_entry_relocs[] = {
                    115: #define PLT_TYPE_END(NAME) \
                    116:     {0, 0, 0, LAST_RELOC, 0} \
                    117:   };
                    118: #define PLT_ENTRY(...)
                    119: #define PLT_ELEM(...)
                    120: #define ENTRY_RELOC(...) { __VA_ARGS__ },
                    121: #define ELEM_RELOC(...)
                    122:
                    123: #include "arc-plt.def"
                    124:
                    125: #undef PLT_TYPE_START
                    126: #undef PLT_TYPE_END
                    127: #undef PLT_ENTRY
                    128: #undef PLT_ELEM
                    129: #undef ENTRY_RELOC
                    130: #undef ELEM_RELOC
                    131:
                    132:
                    133: #define PLT_TYPE_START(NAME) \
                    134:   const insn_hword NAME##_plt_elem[] = {
                    135: #define PLT_TYPE_END(NAME) };
                    136: #define PLT_ENTRY(...)
                    137: #define PLT_ELEM(...) __VA_ARGS__,
                    138: #define ENTRY_RELOC(...)
                    139: #define ELEM_RELOC(...)
                    140:
                    141: #include "arc-plt.def"
                    142:
                    143: #undef PLT_TYPE_START
                    144: #undef PLT_TYPE_END
                    145: #undef PLT_ENTRY
                    146: #undef PLT_ELEM
                    147: #undef ENTRY_RELOC
                    148: #undef ELEM_RELOC
                    149:
                    150: #define PLT_TYPE_START(NAME) \
                    151:   const struct plt_reloc NAME##_plt_elem_relocs[] = {
                    152: #define PLT_TYPE_END(NAME) \
                    153:     {0, 0, 0, LAST_RELOC, 0} \
                    154:   };
                    155: #define PLT_ENTRY(...)
                    156: #define PLT_ELEM(...)
                    157: #define ENTRY_RELOC(...)
                    158: #define ELEM_RELOC(...) { __VA_ARGS__ },
                    159:
                    160: #include "arc-plt.def"
                    161:
                    162: #undef PLT_TYPE_START
                    163: #undef PLT_TYPE_END
                    164: #undef PLT_ENTRY
                    165: #undef PLT_ELEM
                    166: #undef ENTRY_RELOC
                    167: #undef ELEM_RELOC
                    168:
                    169:
                    170: #define PLT_TYPE_START(NAME) \
                    171:   { \
                    172:     .entry = &NAME##_plt_entry, \
                    173:     .entry_size = sizeof (NAME##_plt_entry), \
                    174:     .elem = &NAME##_plt_elem, \
                    175:     .elem_size = sizeof (NAME##_plt_elem),  \
                    176:     .entry_relocs = NAME##_plt_entry_relocs, \
                    177:     .elem_relocs = NAME##_plt_elem_relocs
                    178: #define PLT_TYPE_END(NAME) },
                    179: #define PLT_ENTRY(...)
                    180: #define PLT_ELEM(...)
                    181: #define ENTRY_RELOC(...)
                    182: #define ELEM_RELOC(...)
                    183: struct plt_version_t plt_versions[PLT_MAX] = {
                    184:
                    185: #include "arc-plt.def"
                    186:
                    187: };
                    188: #undef PLT_TYPE_START
                    189: #undef PLT_TYPE_END
                    190: #undef PLT_ENTRY
                    191: #undef PLT_ELEM
                    192: #undef ENTRY_RELOC
                    193: #undef ELEM_RELOC
                    194:
                    195:
                    196: #endif /* ARC_PLT_H */

CVSweb <webmaster@jp.NetBSD.org>