Nicolas Geoffray | 50cfe74 | 2014-02-19 13:27:42 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2014 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 | #ifndef ART_RUNTIME_ELF_UTILS_H_ |
| 18 | #define ART_RUNTIME_ELF_UTILS_H_ |
| 19 | |
| 20 | // Include the micro-API to avoid potential macro conflicts with the |
| 21 | // compiler's own elf.h file. |
| 22 | #include "../../bionic/libc/kernel/uapi/linux/elf.h" |
| 23 | |
| 24 | // Architecture dependent flags for the ELF header. |
| 25 | #define EF_ARM_EABI_VER5 0x05000000 |
| 26 | #define EF_MIPS_ABI_O32 0x00001000 |
| 27 | #define EF_MIPS_ARCH_32R2 0x70000000 |
| 28 | |
| 29 | #define EI_ABIVERSION 8 |
| 30 | #define EM_ARM 40 |
| 31 | #define EF_MIPS_NOREORDER 1 |
| 32 | #define EF_MIPS_PIC 2 |
| 33 | #define EF_MIPS_CPIC 4 |
| 34 | #define STV_DEFAULT 0 |
| 35 | |
| 36 | #define DT_BIND_NOW 24 |
| 37 | #define DT_INIT_ARRAY 25 |
| 38 | #define DT_FINI_ARRAY 26 |
| 39 | #define DT_INIT_ARRAYSZ 27 |
| 40 | #define DT_FINI_ARRAYSZ 28 |
| 41 | #define DT_RUNPATH 29 |
| 42 | #define DT_FLAGS 30 |
| 43 | |
| 44 | /* MIPS dependent d_tag field for Elf32_Dyn. */ |
| 45 | #define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */ |
| 46 | #define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ |
| 47 | #define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */ |
| 48 | #define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ |
| 49 | #define DT_MIPS_FLAGS 0x70000005 /* Flags */ |
| 50 | #define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */ |
| 51 | #define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */ |
| 52 | #define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */ |
| 53 | #define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */ |
| 54 | #define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */ |
| 55 | #define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */ |
| 56 | #define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */ |
| 57 | #define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ |
| 58 | #define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */ |
| 59 | #define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ |
| 60 | #define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */ |
| 61 | |
| 62 | inline void SetBindingAndType(Elf32_Sym* sym, unsigned char b, unsigned char t) { |
| 63 | sym->st_info = (b << 4) + (t & 0x0f); |
| 64 | } |
| 65 | |
| 66 | #endif // ART_RUNTIME_ELF_UTILS_H_ |