[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.3

1.1       christos    1: /* ARC-specific header file for PLT support.
1.1.1.3 ! christos    2:    Copyright (C) 2016-2020 Free Software Foundation, Inc.
1.1       christos    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: /* Instructions appear in memory as a sequence of half-words (16 bit);
                     26:    individual half-words are represented on the target in target byte order.
                     27:    We use 'unsigned short' on the host to represent the PLT templates,
                     28:    and translate to target byte order as we copy to the target.  */
                     29: typedef uint16_t insn_hword;
                     30:
                     31: enum plt_reloc_symbol
                     32: {
                     33:   LAST_RELOC = 0,
                     34:
                     35:   SGOT = 1,
                     36:
                     37:   RELATIVE = (1 << 8),
                     38:   RELATIVE_INSN_32 = (1 << 9),
                     39:   RELATIVE_INSN_24 = (1 << 10),
                     40:
                     41:   MIDDLE_ENDIAN = (1 << 11)
                     42: };
                     43:
1.1.1.2   christos   44: #define IS_RELATIVE(S)     ((S & (RELATIVE | RELATIVE_INSN_24 | RELATIVE_INSN_32)) != 0)
                     45: #define IS_INSN_32(S)      ((S & RELATIVE_INSN_32) != 0)
                     46: #define IS_INSN_24(S)      ((S & RELATIVE_INSN_24) != 0)
1.1       christos   47: #define IS_MIDDLE_ENDIAN(S) ((S & MIDDLE_ENDIAN) != 0)
1.1.1.2   christos   48: #define SYM_ONLY(S)        (S & 0xFF)
1.1       christos   49:
                     50: struct plt_reloc
                     51: {
                     52:   bfd_vma        offset;
                     53:   bfd_vma        size;
                     54:   bfd_vma        mask;
                     55:   enum plt_reloc_symbol symbol;
                     56:   bfd_vma        addend;
                     57: };
                     58:
                     59:
                     60: #define PLT_TYPE_START(NAME) NAME,
                     61: #define PLT_TYPE_END(NAME)
                     62: #define PLT_ENTRY(...)
                     63: #define PLT_ELEM(...)
                     64: #define ENTRY_RELOC(...)
                     65: #define ELEM_RELOC(...)
                     66:
                     67: enum plt_types_enum
                     68: {
                     69:   PLT_START = -1,
                     70: #include "arc-plt.def"
                     71:   PLT_MAX
                     72: };
                     73:
                     74: #undef PLT_TYPE_START
                     75: #undef PLT_TYPE_END
                     76: #undef PLT_ENTRY
                     77: #undef PLT_ELEM
                     78: #undef ENTRY_RELOC
                     79: #undef ELEM_RELOC
                     80:
                     81: typedef insn_hword insn_hword_array[];
                     82:
                     83: struct plt_version_t
                     84: {
                     85:   const insn_hword_array *entry;
                     86:   const bfd_vma                  entry_size;
                     87:   const insn_hword_array *elem;
                     88:   const bfd_vma                  elem_size;
                     89:
                     90:   const struct plt_reloc *entry_relocs;
                     91:   const struct plt_reloc *elem_relocs;
                     92: };
                     93:
                     94: #define PLT_TYPE_START(NAME) \
                     95:   const insn_hword NAME##_plt_entry[] = {
                     96: #define PLT_TYPE_END(NAME) };
                     97: #define PLT_ENTRY(...) __VA_ARGS__,
                     98: #define PLT_ELEM(...)
                     99: #define ENTRY_RELOC(...)
                    100: #define ELEM_RELOC(...)
                    101:
                    102: #include "arc-plt.def"
                    103:
                    104: #undef PLT_TYPE_START
                    105: #undef PLT_TYPE_END
                    106: #undef PLT_ENTRY
                    107: #undef PLT_ELEM
                    108: #undef ENTRY_RELOC
                    109: #undef ELEM_RELOC
                    110:
                    111: #define PLT_TYPE_START(NAME) \
                    112:   const struct plt_reloc NAME##_plt_entry_relocs[] = {
                    113: #define PLT_TYPE_END(NAME) \
                    114:     {0, 0, 0, LAST_RELOC, 0} \
                    115:   };
1.1.1.2   christos  116: #define PLT_ENTRY(...)
1.1       christos  117: #define PLT_ELEM(...)
                    118: #define ENTRY_RELOC(...) { __VA_ARGS__ },
                    119: #define ELEM_RELOC(...)
                    120:
                    121: #include "arc-plt.def"
                    122:
                    123: #undef PLT_TYPE_START
                    124: #undef PLT_TYPE_END
                    125: #undef PLT_ENTRY
                    126: #undef PLT_ELEM
                    127: #undef ENTRY_RELOC
                    128: #undef ELEM_RELOC
                    129:
                    130:
                    131: #define PLT_TYPE_START(NAME) \
                    132:   const insn_hword NAME##_plt_elem[] = {
                    133: #define PLT_TYPE_END(NAME) };
                    134: #define PLT_ENTRY(...)
                    135: #define PLT_ELEM(...) __VA_ARGS__,
                    136: #define ENTRY_RELOC(...)
                    137: #define ELEM_RELOC(...)
                    138:
                    139: #include "arc-plt.def"
                    140:
                    141: #undef PLT_TYPE_START
                    142: #undef PLT_TYPE_END
                    143: #undef PLT_ENTRY
                    144: #undef PLT_ELEM
                    145: #undef ENTRY_RELOC
                    146: #undef ELEM_RELOC
                    147:
                    148: #define PLT_TYPE_START(NAME) \
                    149:   const struct plt_reloc NAME##_plt_elem_relocs[] = {
                    150: #define PLT_TYPE_END(NAME) \
                    151:     {0, 0, 0, LAST_RELOC, 0} \
                    152:   };
1.1.1.2   christos  153: #define PLT_ENTRY(...)
1.1       christos  154: #define PLT_ELEM(...)
                    155: #define ENTRY_RELOC(...)
                    156: #define ELEM_RELOC(...) { __VA_ARGS__ },
                    157:
                    158: #include "arc-plt.def"
                    159:
                    160: #undef PLT_TYPE_START
                    161: #undef PLT_TYPE_END
                    162: #undef PLT_ENTRY
                    163: #undef PLT_ELEM
                    164: #undef ENTRY_RELOC
                    165: #undef ELEM_RELOC
                    166:
                    167:
                    168: #define PLT_TYPE_START(NAME) \
                    169:   { \
                    170:     .entry = &NAME##_plt_entry, \
                    171:     .entry_size = sizeof (NAME##_plt_entry), \
                    172:     .elem = &NAME##_plt_elem, \
                    173:     .elem_size = sizeof (NAME##_plt_elem),  \
                    174:     .entry_relocs = NAME##_plt_entry_relocs, \
                    175:     .elem_relocs = NAME##_plt_elem_relocs
                    176: #define PLT_TYPE_END(NAME) },
                    177: #define PLT_ENTRY(...)
                    178: #define PLT_ELEM(...)
                    179: #define ENTRY_RELOC(...)
                    180: #define ELEM_RELOC(...)
                    181: struct plt_version_t plt_versions[PLT_MAX] = {
                    182:
                    183: #include "arc-plt.def"
                    184:
                    185: };
                    186: #undef PLT_TYPE_START
                    187: #undef PLT_TYPE_END
                    188: #undef PLT_ENTRY
                    189: #undef PLT_ELEM
                    190: #undef ENTRY_RELOC
                    191: #undef ELEM_RELOC
                    192:
                    193:
                    194: #endif /* ARC_PLT_H */

CVSweb <webmaster@jp.NetBSD.org>