• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Alpha specific symbolic name handling.
2    Copyright (C) 2002 Red Hat, Inc.
3    Written by Ulrich Drepper <drepper@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_alpha.h>
23 
24 
25 /* Return of the backend.  */
26 const char *
alpha_backend_name(void)27 alpha_backend_name (void)
28 {
29   return "alpha";
30 }
31 
32 
33 /* Relocation mapping table.  */
34 static const char *reloc_map_table[] =
35   {
36     [R_ALPHA_NONE] = "R_ALPHA_NONE",
37     [R_ALPHA_REFLONG] = "R_ALPHA_REFLONG",
38     [R_ALPHA_REFQUAD] = "R_ALPHA_REFQUAD",
39     [R_ALPHA_GPREL32] = "R_ALPHA_GPREL32",
40     [R_ALPHA_LITERAL] = "R_ALPHA_LITERAL",
41     [R_ALPHA_LITUSE] = "R_ALPHA_LITUSE",
42     [R_ALPHA_GPDISP] = "R_ALPHA_GPDISP",
43     [R_ALPHA_BRADDR] = "R_ALPHA_BRADDR",
44     [R_ALPHA_HINT] = "R_ALPHA_HINT",
45     [R_ALPHA_SREL16] = "R_ALPHA_SREL16",
46     [R_ALPHA_SREL32] = "R_ALPHA_SREL32",
47     [R_ALPHA_SREL64] = "R_ALPHA_SREL64",
48     [R_ALPHA_GPRELHIGH] = "R_ALPHA_GPRELHIGH",
49     [R_ALPHA_GPRELLOW] = "R_ALPHA_GPRELLOW",
50     [R_ALPHA_GPREL16] = "R_ALPHA_GPREL16",
51     [R_ALPHA_COPY] = "R_ALPHA_COPY",
52     [R_ALPHA_GLOB_DAT] = "R_ALPHA_GLOB_DAT",
53     [R_ALPHA_JMP_SLOT] = "R_ALPHA_JMP_SLOT",
54     [R_ALPHA_RELATIVE] = "R_ALPHA_RELATIVE",
55     [R_ALPHA_TLS_GD_HI] = "R_ALPHA_TLS_GD_HI",
56     [R_ALPHA_TLSGD] = "R_ALPHA_TLSGD",
57     [R_ALPHA_TLS_LDM] = "R_ALPHA_TLS_LDM",
58     [R_ALPHA_DTPMOD64] = "R_ALPHA_DTPMOD64",
59     [R_ALPHA_GOTDTPREL] = "R_ALPHA_GOTDTPREL",
60     [R_ALPHA_DTPREL64] = "R_ALPHA_DTPREL64",
61     [R_ALPHA_DTPRELHI] = "R_ALPHA_DTPRELHI",
62     [R_ALPHA_DTPRELLO] = "R_ALPHA_DTPRELLO",
63     [R_ALPHA_DTPREL16] = "R_ALPHA_DTPREL16",
64     [R_ALPHA_GOTTPREL] = "R_ALPHA_GOTTPREL",
65     [R_ALPHA_TPREL64] = "R_ALPHA_TPREL64",
66     [R_ALPHA_TPRELHI] = "R_ALPHA_TPRELHI",
67     [R_ALPHA_TPRELLO] = "R_ALPHA_TPRELLO",
68     [R_ALPHA_TPREL16] = "R_ALPHA_TPREL16"
69   };
70 
71 
72 /* Determine relocation type string for Alpha.  */
73 const char *
alpha_reloc_type_name(int type,char * buf,size_t len)74 alpha_reloc_type_name (int type, char *buf, size_t len)
75 {
76   if (type < 0
77       || ((size_t) type
78 	  >= sizeof (reloc_map_table) / sizeof (reloc_map_table[0])))
79     return NULL;
80 
81   return reloc_map_table[type];
82 }
83 
84 
85 /* Check for correct relocation type.  */
86 bool
alpha_reloc_type_check(int type)87 alpha_reloc_type_check (int type)
88 {
89   return (type >= R_ALPHA_NONE
90 	  && ((size_t) type
91 	      < sizeof (reloc_map_table) / sizeof (reloc_map_table[0]))
92 	  && reloc_map_table[type] != NULL) ? true : false;
93 }
94