xref: /aosp_15_r20/external/elfutils/backends/arc_symbol.c (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1 /* ARC specific symbolic name handling.
2    This file is part of elfutils.
3 
4    This file is free software; you can redistribute it and/or modify
5    it under the terms of either
6 
7      * the GNU Lesser General Public License as published by the Free
8        Software Foundation; either version 3 of the License, or (at
9        your option) any later version
10 
11    or
12 
13      * the GNU General Public License as published by the Free
14        Software Foundation; either version 2 of the License, or (at
15        your option) any later version
16 
17    or both in parallel, as here.
18 
19    elfutils is distributed in the hope that it will be useful, but
20    WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22    General Public License for more details.
23 
24    You should have received copies of the GNU General Public License and
25    the GNU Lesser General Public License along with this program.  If
26    not, see <http://www.gnu.org/licenses/>.  */
27 
28 #ifdef HAVE_CONFIG_H
29 # include <config.h>
30 #endif
31 
32 #include <assert.h>
33 #include <elf.h>
34 #include <stddef.h>
35 #include <string.h>
36 
37 #define BACKEND arc_
38 #include "libebl_CPU.h"
39 
40 
41 /* Check whether machine flags are valid.  */
42 bool
arc_machine_flag_check(GElf_Word flags)43 arc_machine_flag_check (GElf_Word flags)
44 {
45   return ((flags & ~EF_ARC_ALL_MSK) == 0);
46 }
47 
48 /* Check for the simple reloc types.  */
49 Elf_Type
arc_reloc_simple_type(Ebl * ebl,int type,int * addsub __attribute ((unused)))50 arc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
51 		       int *addsub __attribute ((unused)))
52 {
53   switch (type)
54     {
55     case R_ARC_32:
56       return ELF_T_WORD;
57     case R_ARC_16:
58       return ELF_T_HALF;
59     case R_ARC_8:
60       return ELF_T_BYTE;
61     default:
62       return ELF_T_NUM;
63     }
64 }
65 
66 /* Return symbolic representation of section type.  */
67 const char *
arc_section_type_name(int type,char * buf,size_t len)68 arc_section_type_name (int type,
69 		       char *buf __attribute__ ((unused)),
70 		       size_t len __attribute__ ((unused)))
71 {
72   switch (type)
73     {
74     case SHT_ARC_ATTRIBUTES:
75       return "ARC_ATTRIBUTES";
76     default:
77       break;
78     }
79 
80   return NULL;
81 }
82