blob: e41ce347c483ce2f5f2054fcd27bee18c73ccf0c [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001/* Arm specific symbolic name handling.
Roland McGratheb9ba472009-04-14 18:44:45 -07002 Copyright (C) 2002-2009 Red Hat, Inc.
Mark Wielaardde2ed972012-06-05 17:15:16 +02003 This file is part of elfutils.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00004
Mark Wielaardde2ed972012-06-05 17:15:16 +02005 This file is free software; you can redistribute it and/or modify
6 it under the terms of either
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00007
Mark Wielaardde2ed972012-06-05 17:15:16 +02008 * 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
Ulrich Drepper361df7d2006-04-04 21:38:57 +000021 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
Mark Wielaardde2ed972012-06-05 17:15:16 +020025 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/>. */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000028
29#ifdef HAVE_CONFIG_H
30# include <config.h>
31#endif
32
33#include <elf.h>
34#include <stddef.h>
35
Roland McGrathcd60ea82005-11-16 01:57:40 +000036#define BACKEND arm_
37#include "libebl_CPU.h"
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000038
Roland McGratheb9ba472009-04-14 18:44:45 -070039
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
Roland McGrathcd60ea82005-11-16 01:57:40 +0000109/* Check for the simple reloc types. */
110Elf_Type
111arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000112{
Roland McGrathcd60ea82005-11-16 01:57:40 +0000113 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 }
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000124}