Home | History | Annotate | Download | only in X86
      1 //===- X86RelocationFunction.h --------------------------------------------===//
      2 //
      3 //                     The MCLinker Project
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #define DECL_X86_32_APPLY_RELOC_FUNC(Name) \
     11 static X86Relocator::Result Name(Relocation& pEntry, X86_32Relocator& pParent);
     12 
     13 #define DECL_X86_32_APPLY_RELOC_FUNCS \
     14 DECL_X86_32_APPLY_RELOC_FUNC(none)             \
     15 DECL_X86_32_APPLY_RELOC_FUNC(abs)              \
     16 DECL_X86_32_APPLY_RELOC_FUNC(rel)              \
     17 DECL_X86_32_APPLY_RELOC_FUNC(plt32)            \
     18 DECL_X86_32_APPLY_RELOC_FUNC(got32)            \
     19 DECL_X86_32_APPLY_RELOC_FUNC(gotoff32)         \
     20 DECL_X86_32_APPLY_RELOC_FUNC(gotpc32)          \
     21 DECL_X86_32_APPLY_RELOC_FUNC(tls_gd)           \
     22 DECL_X86_32_APPLY_RELOC_FUNC(tls_ie)           \
     23 DECL_X86_32_APPLY_RELOC_FUNC(tls_gotie)        \
     24 DECL_X86_32_APPLY_RELOC_FUNC(tls_le)           \
     25 DECL_X86_32_APPLY_RELOC_FUNC(tls_ldm)          \
     26 DECL_X86_32_APPLY_RELOC_FUNC(tls_ldo_32)       \
     27 DECL_X86_32_APPLY_RELOC_FUNC(unsupport)
     28 
     29 
     30 #define DECL_X86_32_APPLY_RELOC_FUNC_PTRS \
     31   { &none,               0, "R_386_NONE",             0  },  \
     32   { &abs,                1, "R_386_32",               32 },  \
     33   { &rel,                2, "R_386_PC32",             32 },  \
     34   { &got32,              3, "R_386_GOT32",            32 },  \
     35   { &plt32,              4, "R_386_PLT32",            32 },  \
     36   { &none,               5, "R_386_COPY",             0  },  \
     37   { &none,               6, "R_386_GLOB_DAT",         0  },  \
     38   { &none,               7, "R_386_JMP_SLOT",         0  },  \
     39   { &none,               8, "R_386_RELATIVE",         0  },  \
     40   { &gotoff32,           9, "R_386_GOTOFF",           32 },  \
     41   { &gotpc32,           10, "R_386_GOTPC",            32 },  \
     42   { &unsupport,         11, "R_386_32PLT",            0  },  \
     43   { &unsupport,         12, "",                       0  },  \
     44   { &unsupport,         13, "",                       0  },  \
     45   { &unsupport,         14, "R_386_TLS_TPOFF",        0  },  \
     46   { &tls_ie,            15, "R_386_TLS_IE",           0  },  \
     47   { &tls_gotie,         16, "R_386_TLS_GOTIE",        0  },  \
     48   { &tls_le,            17, "R_386_TLS_LE",           0  },  \
     49   { &tls_gd,            18, "R_386_TLS_GD",           0  },  \
     50   { &tls_ldm,           19, "R_386_TLS_LDM",          0  },  \
     51   { &abs,               20, "R_386_16",               16 },  \
     52   { &rel,               21, "R_386_PC16",             16 },  \
     53   { &abs,               22, "R_386_8",                8  },  \
     54   { &rel,               23, "R_386_PC8",              8  },  \
     55   { &unsupport,         24, "R_386_TLS_GD_32",        0  },  \
     56   { &unsupport,         25, "R_386_TLS_GD_PUSH",      0  },  \
     57   { &unsupport,         26, "R_386_TLS_GD_CALL",      0  },  \
     58   { &unsupport,         27, "R_386_TLS_GD_POP",       0  },  \
     59   { &unsupport,         28, "R_386_TLS_LDM_32",       0  },  \
     60   { &unsupport,         29, "R_386_TLS_LDM_PUSH",     0  },  \
     61   { &unsupport,         30, "R_386_TLS_LDM_CALL",     0  },  \
     62   { &unsupport,         31, "R_386_TLS_LDM_POP",      0  },  \
     63   { &tls_ldo_32,        32, "R_386_TLS_LDO_32",       0  },  \
     64   { &unsupport,         33, "R_386_TLS_IE_32",        0  },  \
     65   { &unsupport,         34, "R_386_TLS_LE_32",        0  },  \
     66   { &unsupport,         35, "R_386_TLS_DTPMOD32",     0  },  \
     67   { &unsupport,         36, "R_386_TLS_DTPOFF32",     0  },  \
     68   { &unsupport,         37, "R_386_TLS_TPOFF32",      0  },  \
     69   { &unsupport,         38, "",                       0  },  \
     70   { &unsupport,         39, "R_386_TLS_GOTDESC",      0  },  \
     71   { &unsupport,         40, "R_386_TLS_DESC_CALL",    0  },  \
     72   { &unsupport,         41, "R_386_TLS_DESC",         0  },  \
     73   { &unsupport,         42, "R_386_IRELATIVE",        0  },  \
     74   { &unsupport,         43, "R_386_NUM",              0  },  \
     75   { &none,              44, "R_386_TLS_OPT",          0  }
     76 
     77 #define DECL_X86_64_APPLY_RELOC_FUNC(Name) \
     78 static X86Relocator::Result Name(Relocation& pEntry, X86_64Relocator& pParent);
     79 
     80 #define DECL_X86_64_APPLY_RELOC_FUNCS \
     81 DECL_X86_64_APPLY_RELOC_FUNC(none)             \
     82 DECL_X86_64_APPLY_RELOC_FUNC(abs)              \
     83 DECL_X86_64_APPLY_RELOC_FUNC(signed32)         \
     84 DECL_X86_64_APPLY_RELOC_FUNC(gotpcrel)         \
     85 DECL_X86_64_APPLY_RELOC_FUNC(plt32)            \
     86 DECL_X86_64_APPLY_RELOC_FUNC(rel)              \
     87 DECL_X86_64_APPLY_RELOC_FUNC(unsupport)
     88 
     89 #define DECL_X86_64_APPLY_RELOC_FUNC_PTRS \
     90   { &none,               0, "R_X86_64_NONE",            0  },  \
     91   { &abs,                1, "R_X86_64_64",              64 },  \
     92   { &rel,                2, "R_X86_64_PC32",            32 },  \
     93   { &unsupport,          3, "R_X86_64_GOT32",           32 },  \
     94   { &plt32,              4, "R_X86_64_PLT32",           32 },  \
     95   { &none,               5, "R_X86_64_COPY",            0  },  \
     96   { &none,               6, "R_X86_64_GLOB_DAT",        0  },  \
     97   { &none,               7, "R_X86_64_JMP_SLOT",        0  },  \
     98   { &none,               8, "R_X86_64_RELATIVE",        0  },  \
     99   { &gotpcrel,           9, "R_X86_64_GOTPCREL",        32 },  \
    100   { &abs,               10, "R_X86_64_32",              32 },  \
    101   { &signed32,          11, "R_X86_64_32S",             32 },  \
    102   { &abs,               12, "R_X86_64_16",              16 },  \
    103   { &rel,               13, "R_X86_64_PC16",            16 },  \
    104   { &abs,               14, "R_X86_64_8",               8  },  \
    105   { &rel,               15, "R_X86_64_PC8",             8  },  \
    106   { &none,              16, "R_X86_64_DTPMOD64",        0  },  \
    107   { &unsupport,         17, "R_X86_64_DTPOFF64",        0  },  \
    108   { &none,              18, "R_X86_64_TPOFF64",         0  },  \
    109   { &unsupport,         19, "R_X86_64_TLSGD",           0  },  \
    110   { &unsupport,         20, "R_X86_64_TLSLD",           0  },  \
    111   { &unsupport,         21, "R_X86_64_DTPOFF32",        0  },  \
    112   { &unsupport,         22, "R_X86_64_GOTTPOFF",        0  },  \
    113   { &unsupport,         23, "R_X86_64_TPOFF32",         0  },  \
    114   { &unsupport,         24, "R_X86_64_PC64",            64 },  \
    115   { &unsupport,         25, "R_X86_64_GOTOFF64",        64 },  \
    116   { &unsupport,         26, "R_X86_64_GOTPC32",         32 },  \
    117   { &unsupport,         27, "R_X86_64_GOT64",           64 },  \
    118   { &unsupport,         28, "R_X86_64_GOTPCREL64",      64 },  \
    119   { &unsupport,         29, "R_X86_64_GOTPC64",         64 },  \
    120   { &unsupport,         30, "R_X86_64_GOTPLT64",        64 },  \
    121   { &unsupport,         31, "R_X86_64_PLTOFF64",        64 },  \
    122   { &unsupport,         32, "R_X86_64_SIZE32",          32 },  \
    123   { &unsupport,         33, "R_X86_64_SIZE64",          64 },  \
    124   { &unsupport,         34, "R_X86_64_GOTPC32_TLSDESC", 0  },  \
    125   { &unsupport,         35, "R_X86_64_TLSDESC_CALL",    0  },  \
    126   { &none,              36, "R_X86_64_TLSDESC",         0  },  \
    127   { &none,              37, "R_X86_64_IRELATIVE",       0  },  \
    128   { &none,              38, "R_X86_64_RELATIVE64",      0  }
    129