blob: cd467ffc1da8dc92ab43352c0ea5ec26afc54414 [file] [log] [blame]
Ben Cheng25b3c042013-11-20 14:45:36 -08001/* Arm specific symbolic name handling.
Elliott Hughes03333822015-02-18 22:19:45 -08002 Copyright (C) 2002-2009, 2014 Red Hat, Inc.
3 This file is part of elfutils.
Ben Cheng25b3c042013-11-20 14:45:36 -08004
Elliott Hughes03333822015-02-18 22:19:45 -08005 This file is free software; you can redistribute it and/or modify
6 it under the terms of either
Ben Cheng25b3c042013-11-20 14:45:36 -08007
Elliott Hughes03333822015-02-18 22:19:45 -08008 * 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
Ben Cheng25b3c042013-11-20 14:45:36 -080021 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
Elliott Hughes03333822015-02-18 22:19:45 -080025 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/>. */
Ben Cheng25b3c042013-11-20 14:45:36 -080028
29#ifdef HAVE_CONFIG_H
30# include <config.h>
31#endif
32
33#include <elf.h>
34#include <stddef.h>
35
36#define BACKEND arm_
37#include "libebl_CPU.h"
38
39
40const char *
41arm_segment_type_name (int segment, char *buf __attribute__ ((unused)),
42 size_t len __attribute__ ((unused)))
43{
44 switch (segment)
45 {
46 case PT_ARM_EXIDX:
47 return "ARM_EXIDX";
48 }
49 return NULL;
50}
51
52/* Return symbolic representation of section type. */
53const char *
54arm_section_type_name (int type,
55 char *buf __attribute__ ((unused)),
56 size_t len __attribute__ ((unused)))
57{
58 switch (type)
59 {
60 case SHT_ARM_EXIDX:
61 return "ARM_EXIDX";
62 case SHT_ARM_PREEMPTMAP:
63 return "ARM_PREEMPTMAP";
64 case SHT_ARM_ATTRIBUTES:
65 return "ARM_ATTRIBUTES";
66 }
67
68 return NULL;
69}
70
71/* Check whether machine flags are valid. */
72bool
73arm_machine_flag_check (GElf_Word flags)
74{
75 switch (flags & EF_ARM_EABIMASK)
76 {
77 case EF_ARM_EABI_UNKNOWN:
78 case EF_ARM_EABI_VER1:
79 case EF_ARM_EABI_VER2:
80 case EF_ARM_EABI_VER3:
81 case EF_ARM_EABI_VER4:
82 case EF_ARM_EABI_VER5:
83 break;
84 default:
85 return false;
86 }
87
88 return ((flags &~ (EF_ARM_EABIMASK
89 | EF_ARM_RELEXEC
90 | EF_ARM_HASENTRY
91 | EF_ARM_INTERWORK
92 | EF_ARM_APCS_26
93 | EF_ARM_APCS_FLOAT
94 | EF_ARM_PIC
95 | EF_ARM_ALIGN8
96 | EF_ARM_NEW_ABI
97 | EF_ARM_OLD_ABI
98 | EF_ARM_SOFT_FLOAT
99 | EF_ARM_VFP_FLOAT
100 | EF_ARM_MAVERICK_FLOAT
101 | EF_ARM_SYMSARESORTED
102 | EF_ARM_DYNSYMSUSESEGIDX
103 | EF_ARM_MAPSYMSFIRST
104 | EF_ARM_EABIMASK
105 | EF_ARM_BE8
106 | EF_ARM_LE8)) == 0);
107}
108
109/* Check for the simple reloc types. */
110Elf_Type
111arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
112{
113 switch (type)
114 {
115 case R_ARM_ABS32:
116 return ELF_T_WORD;
117 case R_ARM_ABS16:
118 return ELF_T_HALF;
119 case R_ARM_ABS8:
120 return ELF_T_BYTE;
121 default:
122 return ELF_T_NUM;
123 }
124}
Elliott Hughes03333822015-02-18 22:19:45 -0800125
126/* The SHT_ARM_EXIDX section type is a valid target for relocation. */
127bool
128arm_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_type)
129{
130 return sh_type == SHT_ARM_EXIDX;
131}