1 /* 2 * Copyright 2011, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "ELFSectionHeader.h" 18 #include "ELF.h" 19 20 // ARM Section Header Type Definitions 21 22 // TODO: These definitions are not defined in external/elfutils/libelf/ 23 // elf.h. So we to this by ourself. Maybe we should update elf.h 24 // instead. 25 26 #ifndef SHT_ARM_EXIDX 27 #define SHT_ARM_EXIDX (SHT_LOPROC + 1) 28 #endif 29 30 #ifndef SHT_ARM_PREEMPTMAP 31 #define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) 32 #endif 33 34 #ifndef SHT_ARM_ATTRIBUTES 35 #define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) 36 #endif 37 38 char const *ELFSectionHeaderHelperMixin::getSectionTypeStr(uint32_t type) { 39 switch (type) { 40 default: return "(UNKNOWN)"; 41 42 #define CASE(TYPE) \ 43 case SHT_##TYPE: return #TYPE; 44 45 // General section header type 46 CASE(NULL) CASE(PROGBITS) CASE(SYMTAB) CASE(STRTAB) CASE(RELA) CASE(HASH) 47 CASE(DYNAMIC) CASE(NOTE) CASE(NOBITS) CASE(REL) CASE(SHLIB) 48 CASE(DYNSYM) CASE(INIT_ARRAY) CASE(FINI_ARRAY) CASE(PREINIT_ARRAY) 49 CASE(GROUP) CASE(SYMTAB_SHNDX) CASE(LOOS) CASE(HIOS) CASE(LOPROC) 50 CASE(HIPROC) CASE(LOUSER) CASE(HIUSER) 51 52 // ARM-specific section header type 53 CASE(ARM_EXIDX) CASE(ARM_PREEMPTMAP) CASE(ARM_ATTRIBUTES) 54 55 #undef CASE 56 } 57 } 58