• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* C-SKY specific symbolic name handling.
2    Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
3    This file is part of elfutils.
4 
5    This file is free software; you can redistribute it and/or modify
6    it under the terms of either
7 
8      * the GNU Lesser General Public License as published by the Free
9        Software Foundation; either version 3 of the License, or (at
10        your option) any later version
11 
12    or
13 
14      * the GNU General Public License as published by the Free
15        Software Foundation; either version 2 of the License, or (at
16        your option) any later version
17 
18    or both in parallel, as here.
19 
20    elfutils is distributed in the hope that it will be useful, but
21    WITHOUT ANY WARRANTY; without even the implied warranty of
22    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23    General Public License for more details.
24 
25    You should have received copies of the GNU General Public License and
26    the GNU Lesser General Public License along with this program.  If
27    not, see <http://www.gnu.org/licenses/>.  */
28 
29 #ifdef HAVE_CONFIG_H
30 # include <config.h>
31 #endif
32 
33 #include <assert.h>
34 #include <elf.h>
35 #include <stddef.h>
36 #include <string.h>
37 
38 #define BACKEND csky_
39 #include "libebl_CPU.h"
40 
41 /* Check for the simple reloc types.  */
42 Elf_Type
csky_reloc_simple_type(Ebl * ebl,int type,int * addsub)43 csky_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
44 			int *addsub __attribute__ ((unused)))
45 {
46   switch (type)
47     {
48     case R_CKCORE_ADDR32:
49       return ELF_T_WORD;
50     default:
51       return ELF_T_NUM;
52     }
53 }
54 
55 bool
csky_machine_flag_check(GElf_Word flags)56 csky_machine_flag_check (GElf_Word flags)
57 {
58   switch (flags & EF_CSKY_ABIMASK)
59     {
60     case EF_CSKY_ABIV2:
61       return true;
62     case EF_CSKY_ABIV1:
63     default:
64       return false;
65     }
66 }
67 
68 const char *
csky_section_type_name(int type,char * buf,size_t len)69 csky_section_type_name (int type,
70 		       char *buf __attribute__ ((unused)),
71 		       size_t len __attribute__ ((unused)))
72 {
73   if (type == SHT_CSKY_ATTRIBUTES)
74     return "CSKY_ATTRIBUTES";
75 
76   return NULL;
77 }
78