blob: 2c50047825a483bbe9fe1a27df15b1262807ee9d [file] [log] [blame]
Nicolas Geoffray50cfe742014-02-19 13:27:42 +00001/*
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
Brian Carlstrom8758c642014-06-11 14:22:02 -070020#include <sys/cdefs.h>
21
Brian Carlstrome130ee62014-07-01 23:54:20 -070022// Explicitly include our own elf.h to avoid Linux and other dependencies.
23#include "./elf.h"
Nicolas Geoffray50cfe742014-02-19 13:27:42 +000024
25// Architecture dependent flags for the ELF header.
26#define EF_ARM_EABI_VER5 0x05000000
27#define EF_MIPS_ABI_O32 0x00001000
28#define EF_MIPS_ARCH_32R2 0x70000000
29
30#define EI_ABIVERSION 8
31#define EM_ARM 40
32#define EF_MIPS_NOREORDER 1
33#define EF_MIPS_PIC 2
34#define EF_MIPS_CPIC 4
35#define STV_DEFAULT 0
36
Stuart Monteithb95a5342014-03-12 13:32:32 +000037#define EM_AARCH64 183
38
Nicolas Geoffray50cfe742014-02-19 13:27:42 +000039#define DT_BIND_NOW 24
40#define DT_INIT_ARRAY 25
41#define DT_FINI_ARRAY 26
42#define DT_INIT_ARRAYSZ 27
43#define DT_FINI_ARRAYSZ 28
44#define DT_RUNPATH 29
45#define DT_FLAGS 30
46
47/* MIPS dependent d_tag field for Elf32_Dyn. */
48#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */
49#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
50#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */
51#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
52#define DT_MIPS_FLAGS 0x70000005 /* Flags */
53#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */
54#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */
55#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */
56#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */
57#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */
58#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */
59#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */
60#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
61#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
62#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
63#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
64
65inline void SetBindingAndType(Elf32_Sym* sym, unsigned char b, unsigned char t) {
66 sym->st_info = (b << 4) + (t & 0x0f);
67}
68
69#endif // ART_RUNTIME_ELF_UTILS_H_