Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 1 | /* Arm specific symbolic name handling. |
Roland McGrath | eb9ba47 | 2009-04-14 18:44:45 -0700 | [diff] [blame] | 2 | Copyright (C) 2002-2009 Red Hat, Inc. |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 3 | This file is part of elfutils. |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 4 | |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 5 | This file is free software; you can redistribute it and/or modify |
| 6 | it under the terms of either |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 7 | |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 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 |
Ulrich Drepper | 361df7d | 2006-04-04 21:38:57 +0000 | [diff] [blame] | 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 | |
Mark Wielaard | de2ed97 | 2012-06-05 17:15:16 +0200 | [diff] [blame] | 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/>. */ |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 28 | |
| 29 | #ifdef HAVE_CONFIG_H |
| 30 | # include <config.h> |
| 31 | #endif |
| 32 | |
| 33 | #include <elf.h> |
| 34 | #include <stddef.h> |
| 35 | |
Roland McGrath | cd60ea8 | 2005-11-16 01:57:40 +0000 | [diff] [blame] | 36 | #define BACKEND arm_ |
| 37 | #include "libebl_CPU.h" |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 38 | |
Roland McGrath | eb9ba47 | 2009-04-14 18:44:45 -0700 | [diff] [blame] | 39 | |
| 40 | const char * |
| 41 | arm_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. */ |
| 53 | const char * |
| 54 | arm_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. */ |
| 72 | bool |
| 73 | arm_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 McGrath | cd60ea8 | 2005-11-16 01:57:40 +0000 | [diff] [blame] | 109 | /* Check for the simple reloc types. */ |
| 110 | Elf_Type |
| 111 | arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 112 | { |
Roland McGrath | cd60ea8 | 2005-11-16 01:57:40 +0000 | [diff] [blame] | 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 | } |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 124 | } |