Home | History | Annotate | Download | only in libebl
      1 /* IA-64 specific symbolic name handling.
      2    Copyright (C) 2002, 2003 Red Hat, Inc.
      3    Written by Ulrich Drepper <drepper (at) redhat.com>, 2002.
      4 
      5    This program is Open Source software; you can redistribute it and/or
      6    modify it under the terms of the Open Software License version 1.0 as
      7    published by the Open Source Initiative.
      8 
      9    You should have received a copy of the Open Software License along
     10    with this program; if not, you may obtain a copy of the Open Software
     11    License version 1.0 from http://www.opensource.org/licenses/osl.php or
     12    by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
     13    3001 King Ranch Road, Ukiah, CA 95482.   */
     14 
     15 #ifdef HAVE_CONFIG_H
     16 # include <config.h>
     17 #endif
     18 
     19 #include <elf.h>
     20 #include <stddef.h>
     21 
     22 #include <libebl_ia64.h>
     23 
     24 
     25 /* Return of the backend.  */
     26 const char *
     27 ia64_backend_name (void)
     28 {
     29   return "ia64";
     30 }
     31 
     32 
     33 /* Relocation mapping table.  */
     34 static const char *reloc_map_table[] =
     35   {
     36     [R_IA64_NONE] = "R_IA64_NONE",
     37     [R_IA64_IMM14] = "R_IA64_IMM14",
     38     [R_IA64_IMM22] = "R_IA64_IMM22",
     39     [R_IA64_IMM64] = "R_IA64_IMM64",
     40     [R_IA64_DIR32MSB] = "R_IA64_DIR32MSB",
     41     [R_IA64_DIR32LSB] = "R_IA64_DIR32LSB",
     42     [R_IA64_DIR64MSB] = "R_IA64_DIR64MSB",
     43     [R_IA64_DIR64LSB] = "R_IA64_DIR64LSB",
     44     [R_IA64_GPREL22] = "R_IA64_GPREL22",
     45     [R_IA64_GPREL64I] = "R_IA64_GPREL64I",
     46     [R_IA64_GPREL32MSB] = "R_IA64_GPREL32MSB",
     47     [R_IA64_GPREL32LSB] = "R_IA64_GPREL32LSB",
     48     [R_IA64_GPREL64MSB] = "R_IA64_GPREL64MSB",
     49     [R_IA64_GPREL64LSB] = "R_IA64_GPREL64LSB",
     50     [R_IA64_LTOFF22] = "R_IA64_LTOFF22",
     51     [R_IA64_LTOFF64I] = "R_IA64_LTOFF64I",
     52     [R_IA64_PLTOFF22] = "R_IA64_PLTOFF22",
     53     [R_IA64_PLTOFF64I] = "R_IA64_PLTOFF64I",
     54     [R_IA64_PLTOFF64MSB] = "R_IA64_PLTOFF64MSB",
     55     [R_IA64_PLTOFF64LSB] = "R_IA64_PLTOFF64LSB",
     56     [R_IA64_FPTR64I] = "R_IA64_FPTR64I",
     57     [R_IA64_FPTR32MSB] = "R_IA64_FPTR32MSB",
     58     [R_IA64_FPTR32LSB] = "R_IA64_FPTR32LSB",
     59     [R_IA64_FPTR64MSB] = "R_IA64_FPTR64MSB",
     60     [R_IA64_FPTR64LSB] = "R_IA64_FPTR64LSB",
     61     [R_IA64_PCREL60B] = "R_IA64_PCREL60B",
     62     [R_IA64_PCREL21B] = "R_IA64_PCREL21B",
     63     [R_IA64_PCREL21M] = "R_IA64_PCREL21M",
     64     [R_IA64_PCREL21F] = "R_IA64_PCREL21F",
     65     [R_IA64_PCREL32MSB] = "R_IA64_PCREL32MSB",
     66     [R_IA64_PCREL32LSB] = "R_IA64_PCREL32LSB",
     67     [R_IA64_PCREL64MSB] = "R_IA64_PCREL64MSB",
     68     [R_IA64_PCREL64LSB] = "R_IA64_PCREL64LSB",
     69     [R_IA64_LTOFF_FPTR22] = "R_IA64_LTOFF_FPTR22",
     70     [R_IA64_LTOFF_FPTR64I] = "R_IA64_LTOFF_FPTR64I",
     71     [R_IA64_LTOFF_FPTR32MSB] = "R_IA64_LTOFF_FPTR32MSB",
     72     [R_IA64_LTOFF_FPTR32LSB] = "R_IA64_LTOFF_FPTR32LSB",
     73     [R_IA64_LTOFF_FPTR64MSB] = "R_IA64_LTOFF_FPTR64MSB",
     74     [R_IA64_LTOFF_FPTR64LSB] = "R_IA64_LTOFF_FPTR64LSB",
     75     [R_IA64_SEGREL32MSB] = "R_IA64_SEGREL32MSB",
     76     [R_IA64_SEGREL32LSB] = "R_IA64_SEGREL32LSB",
     77     [R_IA64_SEGREL64MSB] = "R_IA64_SEGREL64MSB",
     78     [R_IA64_SEGREL64LSB] = "R_IA64_SEGREL64LSB",
     79     [R_IA64_SECREL32MSB] = "R_IA64_SECREL32MSB",
     80     [R_IA64_SECREL32LSB] = "R_IA64_SECREL32LSB",
     81     [R_IA64_SECREL64MSB] = "R_IA64_SECREL64MSB",
     82     [R_IA64_SECREL64LSB] = "R_IA64_SECREL64LSB",
     83     [R_IA64_REL32MSB] = "R_IA64_REL32MSB",
     84     [R_IA64_REL32LSB] = "R_IA64_REL32LSB",
     85     [R_IA64_REL64MSB] = "R_IA64_REL64MSB",
     86     [R_IA64_REL64LSB] = "R_IA64_REL64LSB",
     87     [R_IA64_LTV32MSB] = "R_IA64_LTV32MSB",
     88     [R_IA64_LTV32LSB] = "R_IA64_LTV32LSB",
     89     [R_IA64_LTV64MSB] = "R_IA64_LTV64MSB",
     90     [R_IA64_LTV64LSB] = "R_IA64_LTV64LSB",
     91     [R_IA64_PCREL21BI] = "R_IA64_PCREL21BI",
     92     [R_IA64_PCREL22] = "R_IA64_PCREL22",
     93     [R_IA64_PCREL64I] = "R_IA64_PCREL64I",
     94     [R_IA64_IPLTMSB] = "R_IA64_IPLTMSB",
     95     [R_IA64_IPLTLSB] = "R_IA64_IPLTLSB",
     96     [R_IA64_COPY] = "R_IA64_COPY",
     97     [R_IA64_SUB] = "R_IA64_SUB",
     98     [R_IA64_LTOFF22X] = "R_IA64_LTOFF22X",
     99     [R_IA64_LDXMOV] = "R_IA64_LDXMOV",
    100     [R_IA64_TPREL14] = "R_IA64_TPREL14",
    101     [R_IA64_TPREL22] = "R_IA64_TPREL22",
    102     [R_IA64_TPREL64I] = "R_IA64_TPREL64I",
    103     [R_IA64_TPREL64MSB] = "R_IA64_TPREL64MSB",
    104     [R_IA64_TPREL64LSB] = "R_IA64_TPREL64LSB",
    105     [R_IA64_LTOFF_TPREL22] = "R_IA64_LTOFF_TPREL22",
    106     [R_IA64_DTPMOD64MSB] = "R_IA64_DTPMOD64MSB",
    107     [R_IA64_DTPMOD64LSB] = "R_IA64_DTPMOD64LSB",
    108     [R_IA64_LTOFF_DTPMOD22] = "R_IA64_LTOFF_DTPMOD22",
    109     [R_IA64_DTPREL14] = "R_IA64_DTPREL14",
    110     [R_IA64_DTPREL22] = "R_IA64_DTPREL22",
    111     [R_IA64_DTPREL64I] = "R_IA64_DTPREL64I",
    112     [R_IA64_DTPREL32MSB] = "R_IA64_DTPREL32MSB",
    113     [R_IA64_DTPREL32LSB] = "R_IA64_DTPREL32LSB",
    114     [R_IA64_DTPREL64MSB] = "R_IA64_DTPREL64MSB",
    115     [R_IA64_DTPREL64LSB] = "R_IA64_DTPREL64LSB",
    116     [R_IA64_LTOFF_DTPREL22] = "R_IA64_LTOFF_DTPREL22"
    117   };
    118 
    119 
    120 /* Determine relocation type string for IA-64.  */
    121 const char *
    122 ia64_reloc_type_name (int type, char *buf, size_t len)
    123 {
    124   if (type < 0
    125       || ((size_t) type
    126 	  >= sizeof (reloc_map_table) / sizeof (reloc_map_table[0])))
    127     return NULL;
    128 
    129   return reloc_map_table[type];
    130 }
    131 
    132 
    133 /* Check for correct relocation type.  */
    134 bool
    135 ia64_reloc_type_check (int type)
    136 {
    137   return (type >= R_IA64_NONE
    138 	  && ((size_t) type
    139 	      < sizeof (reloc_map_table) / sizeof (reloc_map_table[0]))
    140 	  && reloc_map_table[type] != NULL) ? true : false;
    141 }
    142 
    143 
    144 const char *
    145 ia64_segment_type_name (int segment, char *buf, size_t len)
    146 {
    147   switch (segment)
    148     {
    149     case PT_IA_64_ARCHEXT:
    150       return "IA_64_ARCHEXT";
    151     case PT_IA_64_UNWIND:
    152       return "IA_64_UNWIND";
    153     case PT_IA_64_HP_OPT_ANOT:
    154       return "IA_64_HP_OPT_ANOT";
    155     case PT_IA_64_HP_HSL_ANOT:
    156       return "IA_64_HP_HSL_ANOT";
    157     case PT_IA_64_HP_STACK:
    158       return "IA_64_HP_STACK";
    159     default:
    160       break;
    161     }
    162   return NULL;
    163 }
    164 
    165 
    166 const char *
    167 ia64_dynamic_tag_name (int64_t tag, char *buf, size_t len)
    168 {
    169   switch (tag)
    170     {
    171     case DT_IA_64_PLT_RESERVE:
    172       return "IA_64_PLT_RESERVE";
    173     default:
    174       break;
    175     }
    176   return NULL;
    177 }
    178