2009-03-04 04:28:35 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 The Android Open Source Project
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
2016-07-22 23:56:18 +02:00
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
#ifndef _ELF_H
|
|
|
|
#define _ELF_H
|
|
|
|
|
2016-11-08 03:27:16 +01:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
2012-02-28 20:49:41 +01:00
|
|
|
#include <linux/auxvec.h>
|
2014-02-11 02:46:57 +01:00
|
|
|
#include <linux/elf.h>
|
|
|
|
#include <linux/elf-em.h>
|
|
|
|
#include <machine/elf_machdep.h>
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2015-05-08 07:58:00 +02:00
|
|
|
#define ELF32_R_INFO(sym, type) ((((Elf32_Word)sym) << 8) | ((type) & 0xff))
|
|
|
|
#define ELF64_R_INFO(sym, type) ((((Elf64_Xword)sym) << 32) | ((type) & 0xffffffff))
|
|
|
|
|
|
|
|
typedef __s64 Elf32_Sxword;
|
|
|
|
|
2013-01-11 23:43:05 +01:00
|
|
|
typedef struct {
|
2014-02-11 02:46:57 +01:00
|
|
|
__u32 a_type;
|
2013-01-11 23:43:05 +01:00
|
|
|
union {
|
2014-02-11 02:46:57 +01:00
|
|
|
__u32 a_val;
|
2013-01-11 23:43:05 +01:00
|
|
|
} a_un;
|
|
|
|
} Elf32_auxv_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2014-02-11 02:46:57 +01:00
|
|
|
__u64 a_type;
|
2013-01-11 23:43:05 +01:00
|
|
|
union {
|
2014-02-11 02:46:57 +01:00
|
|
|
__u64 a_val;
|
2013-01-11 23:43:05 +01:00
|
|
|
} a_un;
|
|
|
|
} Elf64_auxv_t;
|
|
|
|
|
2015-04-09 22:58:53 +02:00
|
|
|
typedef Elf32_Half Elf32_Versym;
|
|
|
|
typedef Elf64_Half Elf64_Versym;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Elf32_Half vd_version;
|
|
|
|
Elf32_Half vd_flags;
|
|
|
|
Elf32_Half vd_ndx;
|
|
|
|
Elf32_Half vd_cnt;
|
|
|
|
Elf32_Word vd_hash;
|
|
|
|
Elf32_Word vd_aux;
|
|
|
|
Elf32_Word vd_next;
|
|
|
|
} Elf32_Verdef;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Elf32_Word vda_name;
|
|
|
|
Elf32_Word vda_next;
|
|
|
|
} Elf32_Verdaux;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Elf64_Half vd_version;
|
|
|
|
Elf64_Half vd_flags;
|
|
|
|
Elf64_Half vd_ndx;
|
|
|
|
Elf64_Half vd_cnt;
|
|
|
|
Elf64_Word vd_hash;
|
|
|
|
Elf64_Word vd_aux;
|
|
|
|
Elf64_Word vd_next;
|
|
|
|
} Elf64_Verdef;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Elf64_Word vda_name;
|
|
|
|
Elf64_Word vda_next;
|
|
|
|
} Elf64_Verdaux;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Elf32_Half vn_version;
|
|
|
|
Elf32_Half vn_cnt;
|
|
|
|
Elf32_Word vn_file;
|
|
|
|
Elf32_Word vn_aux;
|
|
|
|
Elf32_Word vn_next;
|
|
|
|
} Elf32_Verneed;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Elf32_Word vna_hash;
|
|
|
|
Elf32_Half vna_flags;
|
|
|
|
Elf32_Half vna_other;
|
|
|
|
Elf32_Word vna_name;
|
|
|
|
Elf32_Word vna_next;
|
|
|
|
} Elf32_Vernaux;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Elf64_Half vn_version;
|
|
|
|
Elf64_Half vn_cnt;
|
|
|
|
Elf64_Word vn_file;
|
|
|
|
Elf64_Word vn_aux;
|
|
|
|
Elf64_Word vn_next;
|
|
|
|
} Elf64_Verneed;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
Elf64_Word vna_hash;
|
|
|
|
Elf64_Half vna_flags;
|
|
|
|
Elf64_Half vna_other;
|
|
|
|
Elf64_Word vna_name;
|
|
|
|
Elf64_Word vna_next;
|
|
|
|
} Elf64_Vernaux;
|
|
|
|
|
2014-02-11 02:46:57 +01:00
|
|
|
#define DF_ORIGIN 0x00000001
|
|
|
|
#define DF_SYMBOLIC 0x00000002
|
|
|
|
#define DF_TEXTREL 0x00000004
|
|
|
|
#define DF_BIND_NOW 0x00000008
|
|
|
|
#define DF_STATIC_TLS 0x00000010
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2014-10-13 21:23:55 +02:00
|
|
|
#define DF_1_NOW 0x00000001 /* Perform complete relocation processing. */
|
|
|
|
#define DF_1_GLOBAL 0x00000002 /* implies RTLD_GLOBAL */
|
2014-09-30 04:14:45 +02:00
|
|
|
#define DF_1_GROUP 0x00000004
|
2014-10-13 21:23:55 +02:00
|
|
|
#define DF_1_NODELETE 0x00000008 /* implies RTLD_NODELETE */
|
2014-09-30 04:14:45 +02:00
|
|
|
#define DF_1_LOADFLTR 0x00000010
|
|
|
|
#define DF_1_INITFIRST 0x00000020
|
2014-10-13 21:23:55 +02:00
|
|
|
#define DF_1_NOOPEN 0x00000040 /* Object can not be used with dlopen(3) */
|
2014-09-30 04:14:45 +02:00
|
|
|
#define DF_1_ORIGIN 0x00000080
|
|
|
|
#define DF_1_DIRECT 0x00000100
|
|
|
|
#define DF_1_TRANS 0x00000200
|
|
|
|
#define DF_1_INTERPOSE 0x00000400
|
|
|
|
#define DF_1_NODEFLIB 0x00000800
|
2014-10-13 21:23:55 +02:00
|
|
|
#define DF_1_NODUMP 0x00001000 /* Object cannot be dumped with dldump(3) */
|
2014-09-30 04:14:45 +02:00
|
|
|
#define DF_1_CONFALT 0x00002000
|
|
|
|
#define DF_1_ENDFILTEE 0x00004000
|
|
|
|
#define DF_1_DISPRELDNE 0x00008000
|
|
|
|
#define DF_1_DISPRELPND 0x00010000
|
|
|
|
#define DF_1_NODIRECT 0x00020000
|
2014-10-13 21:23:55 +02:00
|
|
|
#define DF_1_IGNMULDEF 0x00040000 /* Internal use */
|
|
|
|
#define DF_1_NOKSYMS 0x00080000 /* Internal use */
|
|
|
|
#define DF_1_NOHDR 0x00100000 /* Internal use */
|
2014-09-30 04:14:45 +02:00
|
|
|
#define DF_1_EDITED 0x00200000
|
2014-10-13 21:23:55 +02:00
|
|
|
#define DF_1_NORELOC 0x00400000 /* Internal use */
|
2014-09-30 04:14:45 +02:00
|
|
|
#define DF_1_SYMINTPOSE 0x00800000
|
|
|
|
#define DF_1_GLOBAUDIT 0x01000000
|
|
|
|
#define DF_1_SINGLETON 0x02000000
|
|
|
|
#define DF_1_STUB 0x04000000
|
|
|
|
#define DF_1_PIE 0x08000000
|
|
|
|
|
2014-02-11 02:46:57 +01:00
|
|
|
#define DT_BIND_NOW 24
|
|
|
|
#define DT_INIT_ARRAY 25
|
|
|
|
#define DT_FINI_ARRAY 26
|
|
|
|
#define DT_INIT_ARRAYSZ 27
|
|
|
|
#define DT_FINI_ARRAYSZ 28
|
|
|
|
#define DT_RUNPATH 29
|
|
|
|
#define DT_FLAGS 30
|
|
|
|
/* glibc and BSD disagree for DT_ENCODING; glibc looks wrong. */
|
|
|
|
#define DT_PREINIT_ARRAY 32
|
|
|
|
#define DT_PREINIT_ARRAYSZ 33
|
|
|
|
|
2015-02-05 01:05:30 +01:00
|
|
|
/* Android compressed rel/rela sections */
|
|
|
|
#define DT_ANDROID_REL (DT_LOOS + 2)
|
|
|
|
#define DT_ANDROID_RELSZ (DT_LOOS + 3)
|
|
|
|
|
|
|
|
#define DT_ANDROID_RELA (DT_LOOS + 4)
|
|
|
|
#define DT_ANDROID_RELASZ (DT_LOOS + 5)
|
|
|
|
|
2014-11-10 04:27:20 +01:00
|
|
|
/* gnu hash entry */
|
|
|
|
#define DT_GNU_HASH 0x6ffffef5
|
|
|
|
|
2014-02-11 02:46:57 +01:00
|
|
|
#define ELFOSABI_SYSV 0 /* Synonym for ELFOSABI_NONE used by valgrind. */
|
|
|
|
|
|
|
|
#define PT_GNU_RELRO 0x6474e552
|
|
|
|
|
2014-07-23 20:22:25 +02:00
|
|
|
#define STB_LOOS 10
|
|
|
|
#define STB_HIOS 12
|
|
|
|
#define STB_LOPROC 13
|
|
|
|
#define STB_HIPROC 15
|
2014-02-11 02:46:57 +01:00
|
|
|
|
2015-02-14 01:25:43 +01:00
|
|
|
#define SHT_LOOS 0x60000000
|
|
|
|
#define SHT_HIOS 0x6fffffff
|
|
|
|
|
2014-07-23 20:22:25 +02:00
|
|
|
#define STT_GNU_IFUNC 10
|
|
|
|
#define STT_LOOS 10
|
|
|
|
#define STT_HIOS 12
|
|
|
|
#define STT_LOPROC 13
|
|
|
|
#define STT_HIPROC 15
|
|
|
|
|
2015-05-05 04:30:49 +02:00
|
|
|
#define STV_DEFAULT 0
|
|
|
|
#define STV_INTERNAL 1
|
|
|
|
#define STV_HIDDEN 2
|
|
|
|
#define STV_PROTECTED 3
|
|
|
|
|
2014-10-13 21:23:55 +02:00
|
|
|
/* The kernel uses NT_PRFPREG but glibc also offers NT_FPREGSET */
|
|
|
|
#define NT_FPREGSET NT_PRFPREG
|
|
|
|
|
2015-03-13 18:32:45 +01:00
|
|
|
#define ELF_NOTE_GNU "GNU"
|
|
|
|
|
|
|
|
#define NT_GNU_BUILD_ID 3
|
|
|
|
|
2015-04-09 22:42:33 +02:00
|
|
|
#define VER_FLG_BASE 0x1
|
|
|
|
#define VER_FLG_WEAK 0x2
|
|
|
|
|
|
|
|
#define VER_NDX_LOCAL 0
|
|
|
|
#define VER_NDX_GLOBAL 1
|
|
|
|
|
2013-10-01 03:43:46 +02:00
|
|
|
#endif /* _ELF_H */
|