clang-format
This commit is contained in:
parent
568859d16f
commit
f598fa13a9
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -1,6 +1,5 @@
|
||||
* @markus-oberhumer @jreiser
|
||||
|
||||
/src/p_elf* @jreiser
|
||||
/src/p_lx_* @jreiser
|
||||
/src/p_mach* @jreiser
|
||||
/src/p_unix* @jreiser
|
||||
|
||||
@ -98,7 +98,7 @@ endif
|
||||
ifeq ($(shell uname),Linux)
|
||||
# Markus loves clang-format, but John hates it; find a compromise
|
||||
CLANG_FORMAT_EXCLUDE_FILES += miniacc.h stub/%.h
|
||||
CLANG_FORMAT_EXCLUDE_FILES += p_elf.h p_elf_enum.h p_lx_% p_mach% p_unix% p_vmlin%
|
||||
CLANG_FORMAT_EXCLUDE_FILES += p_lx_% p_mach% p_unix% p_vmlin%
|
||||
CLANG_FORMAT_FILES := $(sort $(wildcard *.[ch]* ../maint/src/*.[ch]* */*.[ch]*))
|
||||
CLANG_FORMAT_FILES += $(sort $(wildcard stub/tools/*/*.[ch]*))
|
||||
CLANG_FORMAT_FILES += $(sort $(wildcard ../misc/cmake/try_compile/*.[ch]*))
|
||||
|
||||
94
src/p_elf.h
94
src/p_elf.h
@ -35,8 +35,7 @@ namespace N_Elf {
|
||||
|
||||
// integral types
|
||||
template <class THalf, class TWord, class TXword, class TAddr, class TOff>
|
||||
struct ElfITypes
|
||||
{
|
||||
struct ElfITypes {
|
||||
typedef THalf Half;
|
||||
typedef TWord Word;
|
||||
typedef TXword Xword;
|
||||
@ -46,7 +45,6 @@ struct ElfITypes
|
||||
typedef THalf Versym;
|
||||
};
|
||||
|
||||
|
||||
// The ELF file header. This appears at the start of every ELF file.
|
||||
template <class TElfITypes>
|
||||
packed_struct(Ehdr) {
|
||||
@ -70,11 +68,10 @@ packed_struct(Ehdr) {
|
||||
Half e_shnum; /* Section header table entry count */
|
||||
Half e_shstrndx; /* Section header string table index */
|
||||
|
||||
# define WANT_EHDR_ENUM 1
|
||||
# include "p_elf_enum.h"
|
||||
#define WANT_EHDR_ENUM 1
|
||||
#include "p_elf_enum.h"
|
||||
};
|
||||
|
||||
|
||||
template <class TElfITypes>
|
||||
packed_struct(Dyn) {
|
||||
typedef typename TElfITypes::Xword Xword;
|
||||
@ -83,11 +80,10 @@ packed_struct(Dyn) {
|
||||
Xword d_tag;
|
||||
Addr d_val;
|
||||
|
||||
# define WANT_DYN_ENUM 1
|
||||
# include "p_elf_enum.h"
|
||||
#define WANT_DYN_ENUM 1
|
||||
#include "p_elf_enum.h"
|
||||
};
|
||||
|
||||
|
||||
template <class TElfITypes>
|
||||
packed_struct(Rel) {
|
||||
typedef typename TElfITypes::Xword Xword;
|
||||
@ -97,7 +93,6 @@ packed_struct(Rel) {
|
||||
Xword r_info;
|
||||
};
|
||||
|
||||
|
||||
template <class TElfITypes>
|
||||
packed_struct(Rela) {
|
||||
typedef typename TElfITypes::Xword Xword;
|
||||
@ -108,7 +103,6 @@ packed_struct(Rela) {
|
||||
Xword r_addend;
|
||||
};
|
||||
|
||||
|
||||
template <class TElfITypes>
|
||||
packed_struct(External_Note) {
|
||||
typedef typename TElfITypes::Word Word;
|
||||
@ -116,14 +110,12 @@ packed_struct(External_Note) {
|
||||
Word xn_namesz; // includes terminating '\0'
|
||||
Word xn_datasz;
|
||||
Word xn_type;
|
||||
//char xn_name[N]; // terminate with '\0'
|
||||
//char xn_data[M]; // aligned to 0 mod 4
|
||||
// char xn_name[N]; // terminate with '\0'
|
||||
// char xn_data[M]; // aligned to 0 mod 4
|
||||
};
|
||||
|
||||
|
||||
} // namespace N_Elf
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// N_Elf32
|
||||
**************************************************************************/
|
||||
@ -145,11 +137,10 @@ packed_struct(Phdr) {
|
||||
Word p_flags; /* Segment flags */
|
||||
Word p_align; /* Segment alignment */
|
||||
|
||||
# define WANT_PHDR_ENUM 1
|
||||
# include "p_elf_enum.h"
|
||||
#define WANT_PHDR_ENUM 1
|
||||
#include "p_elf_enum.h"
|
||||
};
|
||||
|
||||
|
||||
template <class TElfITypes>
|
||||
packed_struct(Shdr) {
|
||||
typedef typename TElfITypes::Word Word;
|
||||
@ -167,11 +158,10 @@ packed_struct(Shdr) {
|
||||
Word sh_addralign; /* Section alignment */
|
||||
Word sh_entsize; /* Entry size if section holds table */
|
||||
|
||||
# define WANT_SHDR_ENUM 1
|
||||
# include "p_elf_enum.h"
|
||||
#define WANT_SHDR_ENUM 1
|
||||
#include "p_elf_enum.h"
|
||||
};
|
||||
|
||||
|
||||
template <class TElfITypes>
|
||||
packed_struct(Sym) {
|
||||
typedef typename TElfITypes::Word Word;
|
||||
@ -185,19 +175,18 @@ packed_struct(Sym) {
|
||||
unsigned char st_other; /* symbol visibility */
|
||||
Section st_shndx; /* section index */
|
||||
|
||||
# define WANT_SYM_ENUM 1
|
||||
# include "p_elf_enum.h"
|
||||
#define WANT_SYM_ENUM 1
|
||||
#include "p_elf_enum.h"
|
||||
|
||||
static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); }
|
||||
static unsigned int get_st_type(unsigned x) { return 0xf & x ; }
|
||||
static unsigned char make_st_info(unsigned bind, unsigned type)
|
||||
{ return (unsigned char) (((bind<<4) + (0xf & type)) & 0xff); }
|
||||
static unsigned int get_st_bind(unsigned x) { return 0xf & (x >> 4); }
|
||||
static unsigned int get_st_type(unsigned x) { return 0xf & x; }
|
||||
static unsigned char make_st_info(unsigned bind, unsigned type) {
|
||||
return (unsigned char) (((bind << 4) + (0xf & type)) & 0xff);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace N_Elf32
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// N_Elf64
|
||||
**************************************************************************/
|
||||
@ -220,11 +209,10 @@ packed_struct(Phdr) {
|
||||
Xword p_memsz; /* Segment size in memory */
|
||||
Xword p_align; /* Segment alignment */
|
||||
|
||||
# define WANT_PHDR_ENUM 1
|
||||
# include "p_elf_enum.h"
|
||||
#define WANT_PHDR_ENUM 1
|
||||
#include "p_elf_enum.h"
|
||||
};
|
||||
|
||||
|
||||
template <class TElfITypes>
|
||||
packed_struct(Shdr) {
|
||||
typedef typename TElfITypes::Word Word;
|
||||
@ -243,11 +231,10 @@ packed_struct(Shdr) {
|
||||
Xword sh_addralign; /* Section alignment */
|
||||
Xword sh_entsize; /* Entry size if section holds table */
|
||||
|
||||
# define WANT_SHDR_ENUM 1
|
||||
# include "p_elf_enum.h"
|
||||
#define WANT_SHDR_ENUM 1
|
||||
#include "p_elf_enum.h"
|
||||
};
|
||||
|
||||
|
||||
template <class TElfITypes>
|
||||
packed_struct(Sym) {
|
||||
typedef typename TElfITypes::Word Word;
|
||||
@ -262,19 +249,18 @@ packed_struct(Sym) {
|
||||
Addr st_value; /* symbol value */
|
||||
Xword st_size; /* symbol size */
|
||||
|
||||
# define WANT_SYM_ENUM 1
|
||||
# include "p_elf_enum.h"
|
||||
#define WANT_SYM_ENUM 1
|
||||
#include "p_elf_enum.h"
|
||||
|
||||
static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); }
|
||||
static unsigned int get_st_type(unsigned x) { return 0xf & x ; }
|
||||
static unsigned char make_st_info(unsigned bind, unsigned type)
|
||||
{ return (unsigned char) (((bind<<4) + (0xf & type)) & 0xff); }
|
||||
static unsigned int get_st_bind(unsigned x) { return 0xf & (x >> 4); }
|
||||
static unsigned int get_st_type(unsigned x) { return 0xf & x; }
|
||||
static unsigned char make_st_info(unsigned bind, unsigned type) {
|
||||
return (unsigned char) (((bind << 4) + (0xf & type)) & 0xff);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace N_Elf64
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// aggregate types into an ElfClass
|
||||
**************************************************************************/
|
||||
@ -282,8 +268,7 @@ packed_struct(Sym) {
|
||||
namespace N_Elf {
|
||||
|
||||
template <class TP>
|
||||
struct ElfClass_32
|
||||
{
|
||||
struct ElfClass_32 {
|
||||
typedef TP BeLePolicy;
|
||||
|
||||
// integral types (target endianness)
|
||||
@ -296,10 +281,10 @@ struct ElfClass_32
|
||||
typedef N_Elf ::Ehdr<ElfITypes> Ehdr;
|
||||
typedef N_Elf32::Phdr<ElfITypes> Phdr;
|
||||
typedef N_Elf32::Shdr<ElfITypes> Shdr;
|
||||
typedef N_Elf ::Dyn <ElfITypes> Dyn;
|
||||
typedef N_Elf ::Rel <ElfITypes> Rel;
|
||||
typedef N_Elf ::Dyn<ElfITypes> Dyn;
|
||||
typedef N_Elf ::Rel<ElfITypes> Rel;
|
||||
typedef N_Elf ::Rela<ElfITypes> Rela;
|
||||
typedef N_Elf32::Sym <ElfITypes> Sym;
|
||||
typedef N_Elf32::Sym<ElfITypes> Sym;
|
||||
typedef N_Elf ::External_Note<ElfITypes> External_Note;
|
||||
|
||||
static void compileTimeAssertions() {
|
||||
@ -323,10 +308,8 @@ struct ElfClass_32
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class TP>
|
||||
struct ElfClass_64
|
||||
{
|
||||
struct ElfClass_64 {
|
||||
typedef TP BeLePolicy;
|
||||
|
||||
// integral types (target endianness)
|
||||
@ -339,10 +322,10 @@ struct ElfClass_64
|
||||
typedef N_Elf ::Ehdr<ElfITypes> Ehdr;
|
||||
typedef N_Elf64::Phdr<ElfITypes> Phdr;
|
||||
typedef N_Elf64::Shdr<ElfITypes> Shdr;
|
||||
typedef N_Elf ::Dyn <ElfITypes> Dyn;
|
||||
typedef N_Elf ::Rel <ElfITypes> Rel;
|
||||
typedef N_Elf ::Dyn<ElfITypes> Dyn;
|
||||
typedef N_Elf ::Rel<ElfITypes> Rel;
|
||||
typedef N_Elf ::Rela<ElfITypes> Rela;
|
||||
typedef N_Elf64::Sym <ElfITypes> Sym;
|
||||
typedef N_Elf64::Sym<ElfITypes> Sym;
|
||||
typedef N_Elf ::External_Note<ElfITypes> External_Note;
|
||||
|
||||
static void compileTimeAssertions() {
|
||||
@ -366,10 +349,8 @@ struct ElfClass_64
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace N_Elf
|
||||
|
||||
|
||||
typedef N_Elf::ElfClass_32<N_BELE_CTP::HostPolicy> ElfClass_Host32;
|
||||
typedef N_Elf::ElfClass_64<N_BELE_CTP::HostPolicy> ElfClass_Host64;
|
||||
typedef N_Elf::ElfClass_32<N_BELE_CTP::BEPolicy> ElfClass_BE32;
|
||||
@ -377,7 +358,6 @@ typedef N_Elf::ElfClass_64<N_BELE_CTP::BEPolicy> ElfClass_BE64;
|
||||
typedef N_Elf::ElfClass_32<N_BELE_CTP::LEPolicy> ElfClass_LE32;
|
||||
typedef N_Elf::ElfClass_64<N_BELE_CTP::LEPolicy> ElfClass_LE64;
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// shortcuts
|
||||
**************************************************************************/
|
||||
|
||||
144
src/p_elf_enum.h
144
src/p_elf_enum.h
@ -25,7 +25,6 @@
|
||||
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Use the preprocessor to work around
|
||||
// - that the types embedding these enums have to be PODs, and
|
||||
@ -36,22 +35,22 @@
|
||||
|
||||
#ifdef WANT_EHDR_ENUM
|
||||
#undef WANT_EHDR_ENUM
|
||||
enum { // indices for e_ident[16]
|
||||
enum { // indices for e_ident[16]
|
||||
EI_CLASS = 4,
|
||||
EI_DATA = 5, /* Data encoding */
|
||||
EI_VERSION = 6,
|
||||
EI_OSABI = 7,
|
||||
EI_ABIVERSION = 8,
|
||||
};
|
||||
enum { // e_ident[EI_CLASS]
|
||||
};
|
||||
enum { // e_ident[EI_CLASS]
|
||||
ELFCLASS32 = 1, /* 32-bit objects */
|
||||
ELFCLASS64 = 2, /* 64-bit objects */
|
||||
};
|
||||
enum { // e_ident[EI_DATA]
|
||||
};
|
||||
enum { // e_ident[EI_DATA]
|
||||
ELFDATA2LSB = 1, /* 2's complement, little endian */
|
||||
ELFDATA2MSB = 2, /* 2's complement, big endian */
|
||||
};
|
||||
enum { // e_ident[EI_OSABI]
|
||||
};
|
||||
enum { // e_ident[EI_OSABI]
|
||||
ELFOSABI_NONE = 0, // == ELFOSABI_SYSV
|
||||
ELFOSABI_NETBSD = 2,
|
||||
ELFOSABI_LINUX = 3,
|
||||
@ -61,15 +60,15 @@
|
||||
ELFOSABI_OPENBSD = 12,
|
||||
ELFOSABI_ARM = 97,
|
||||
ELFOSABI_STANDALONE = 255 // Standalone (embedded) application
|
||||
};
|
||||
enum { // e_type
|
||||
};
|
||||
enum { // e_type
|
||||
ET_NONE = 0, /* No file type */
|
||||
ET_REL = 1, /* Relocatable file */
|
||||
ET_EXEC = 2, /* Executable file */
|
||||
ET_DYN = 3, /* Shared object file */
|
||||
ET_CORE = 4, /* Core file */
|
||||
};
|
||||
enum { // e_machine
|
||||
};
|
||||
enum { // e_machine
|
||||
EM_386 = 3, // i386
|
||||
EM_MIPS = 8,
|
||||
EM_MIPS_RS3_LE = 10, // MIPS R3000 little-endian
|
||||
@ -82,16 +81,15 @@
|
||||
EM_ARM64 = EM_AARCH64,
|
||||
EM_RISCV = 243, // risc-v
|
||||
EM_LOONGARCH = 258,
|
||||
};
|
||||
enum { // e_version
|
||||
};
|
||||
enum { // e_version
|
||||
EV_CURRENT = 1,
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WANT_PHDR_ENUM
|
||||
#undef WANT_PHDR_ENUM
|
||||
enum { // p_type
|
||||
enum { // p_type
|
||||
PT_NULL = 0, /* Ignore: a "comment" */
|
||||
PT_LOAD = 1, /* Loadable program segment */
|
||||
PT_DYNAMIC = 2, /* Dynamic linking information */
|
||||
@ -101,19 +99,18 @@
|
||||
PT_NUM = 8, /* Number of defined types in low range */
|
||||
PT_GNU_STACK = 0x6474e551, /* Indicates stack executability */
|
||||
PT_GNU_RELRO = 0x6474e552, /* Read-only after relocation */
|
||||
};
|
||||
};
|
||||
|
||||
enum { // p_flags
|
||||
enum { // p_flags
|
||||
PF_X = 1, /* Segment is executable */
|
||||
PF_W = 2, /* Segment is writable */
|
||||
PF_R = 4, /* Segment is readable */
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WANT_SHDR_ENUM
|
||||
#undef WANT_SHDR_ENUM
|
||||
enum { // sh_type
|
||||
enum { // sh_type
|
||||
SHT_NULL = 0, /* Section header table entry unused */
|
||||
SHT_PROGBITS = 1, /* Program data */
|
||||
SHT_SYMTAB = 2, /* Symbol table */
|
||||
@ -141,9 +138,9 @@
|
||||
SHT_LOOS = 0x60000000, /* LOcal OS; SHT_ANDROID_REL{,A} is +1, +2 */
|
||||
SHT_LOPROC = 0x70000000, /* Start of processor-specific */
|
||||
SHT_ARM_ATTRIBUTES = (SHT_LOPROC + 3), /* ARM attributes section. */
|
||||
};
|
||||
};
|
||||
|
||||
enum { // sh_flags
|
||||
enum { // sh_flags
|
||||
SHF_WRITE = (1 << 0), /* Writable */
|
||||
SHF_ALLOC = (1 << 1), /* Occupies memory during execution */
|
||||
SHF_EXECINSTR = (1 << 2), /* Executable */
|
||||
@ -151,13 +148,12 @@
|
||||
SHF_STRINGS = (1 << 5), /* Contains nul-terminated strings */
|
||||
SHF_INFO_LINK = (1 << 6), /* 'sh_info' contains SHT index */
|
||||
SHF_LINK_ORDER = (1 << 7), /* Preserve order after combining */
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WANT_DYN_ENUM
|
||||
#undef WANT_DYN_ENUM
|
||||
enum { // d_tag
|
||||
enum { // d_tag
|
||||
DT_NULL = 0, /* End flag */
|
||||
DT_NEEDED = 1, /* Name of needed library */
|
||||
DT_PLTRELSZ = 2, /* Size in bytes of PLT relocs */
|
||||
@ -181,10 +177,10 @@
|
||||
DT_JMPREL = 23, /* Address of PLT relocs */
|
||||
DT_INIT_ARRAY = 25, /* Array with addresses of init fct */
|
||||
DT_FINI_ARRAY = 26, /* Array with addresses of fini fct */
|
||||
DT_INIT_ARRAYSZ= 27, /* size in bytes */
|
||||
DT_FINI_ARRAYSZ= 28, /* size in bytes */
|
||||
DT_INIT_ARRAYSZ = 27, /* size in bytes */
|
||||
DT_FINI_ARRAYSZ = 28, /* size in bytes */
|
||||
DT_PREINIT_ARRAY = 32, /* Array with addresses of preinit fct*/
|
||||
DT_PREINIT_ARRAYSZ= 33, /* size in bytes */
|
||||
DT_PREINIT_ARRAYSZ = 33, /* size in bytes */
|
||||
DT_NUM = 35, /* end of easy range */
|
||||
|
||||
DT_CHECKSUM = 0x6ffffdf8, /* Only for prelink? */
|
||||
@ -193,23 +189,22 @@
|
||||
DT_FLAGS_1 = 0x6ffffffb, /* DF_1_* */
|
||||
DT_VERDEF = 0x6ffffffc, /* version definitions[] */
|
||||
DT_VERNEED = 0x6ffffffe, /* version[] needed */
|
||||
};
|
||||
enum { // DT_FLAGS_1
|
||||
};
|
||||
enum { // DT_FLAGS_1
|
||||
DF_1_NOW = 0x00000001, /* Set RTLD_NOW for this object. */
|
||||
DF_1_PIE = 0x08000000, // Position-Independent Executable (main program)
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WANT_SYM_ENUM
|
||||
#undef WANT_SYM_ENUM
|
||||
enum { // st_bind (high 4 bits of st_info)
|
||||
enum { // st_bind (high 4 bits of st_info)
|
||||
STB_LOCAL = 0, /* Local symbol */
|
||||
STB_GLOBAL = 1, /* Global symbol */
|
||||
STB_WEAK = 2, /* Weak symbol */
|
||||
};
|
||||
};
|
||||
|
||||
enum { // st_type (low 4 bits of st_info)
|
||||
enum { // st_type (low 4 bits of st_info)
|
||||
STT_NOTYPE = 0, /* Symbol type is unspecified */
|
||||
STT_OBJECT = 1, /* Symbol is a data object */
|
||||
STT_FUNC = 2, /* Symbol is a code object */
|
||||
@ -217,39 +212,40 @@
|
||||
STT_FILE = 4, /* Symbol's name is file name */
|
||||
STT_COMMON = 5, /* Symbol is a common data object */
|
||||
STT_TLS = 6, /* Symbol is thread-local data object*/
|
||||
};
|
||||
};
|
||||
|
||||
enum { // st_other (visibility)
|
||||
enum { // st_other (visibility)
|
||||
STV_DEFAULT = 0, /* Default symbol visibility rules */
|
||||
STV_INTERNAL = 1, /* Processor specific hidden class */
|
||||
STV_HIDDEN = 2, /* Sym unavailable in other modules */
|
||||
STV_PROTECTED= 3, /* Not preemptible, not exported */
|
||||
};
|
||||
STV_PROTECTED = 3, /* Not preemptible, not exported */
|
||||
};
|
||||
|
||||
enum { // st_shndx
|
||||
enum { // st_shndx
|
||||
SHN_UNDEF = 0, /* Undefined section */
|
||||
SHN_ABS = 0xfff1, /* Associated symbol is absolute */
|
||||
SHN_COMMON = 0xfff2, /* Associated symbol is common */
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WANT_REL_ENUM //{
|
||||
#undef WANT_REL_ENUM
|
||||
static inline unsigned ELF32_R_TYPE(unsigned x) { return 0xff & x; }
|
||||
static inline unsigned ELF64_R_TYPE(upx_uint64_t x) { return 0xffffffff & (unsigned)x; }
|
||||
static inline unsigned ELF32_R_SYM(unsigned x) { return x >> 8; }
|
||||
static inline unsigned ELF64_R_SYM(upx_uint64_t x) { return x >> 32; }
|
||||
static inline unsigned ELF32_R_INFO(unsigned sym, unsigned type)
|
||||
{ return (sym << 8) + (type & 0xff); }
|
||||
static inline upx_int64_t ELF64_R_INFO(unsigned sym, unsigned type)
|
||||
{ return ((upx_uint64_t)sym << 32) + type; }
|
||||
static inline unsigned ELF32_R_TYPE(unsigned x) { return 0xff & x; }
|
||||
static inline unsigned ELF64_R_TYPE(upx_uint64_t x) { return 0xffffffff & (unsigned) x; }
|
||||
static inline unsigned ELF32_R_SYM(unsigned x) { return x >> 8; }
|
||||
static inline unsigned ELF64_R_SYM(upx_uint64_t x) { return x >> 32; }
|
||||
static inline unsigned ELF32_R_INFO(unsigned sym, unsigned type) {
|
||||
return (sym << 8) + (type & 0xff);
|
||||
}
|
||||
static inline upx_int64_t ELF64_R_INFO(unsigned sym, unsigned type) {
|
||||
return ((upx_uint64_t) sym << 32) + type;
|
||||
}
|
||||
|
||||
# undef R_PPC_RELATIVE
|
||||
# undef R_PPC64_RELATIVE
|
||||
# undef R_PPC_JMP_SLOT
|
||||
# undef R_PPC64_JMP_SLOT
|
||||
enum { // relocation types
|
||||
#undef R_PPC_RELATIVE
|
||||
#undef R_PPC64_RELATIVE
|
||||
#undef R_PPC_JMP_SLOT
|
||||
#undef R_PPC64_JMP_SLOT
|
||||
enum { // relocation types
|
||||
R_386_RELATIVE = 8,
|
||||
R_AARCH64_RELATIVE = 1027,
|
||||
R_ARM_RELATIVE = 23,
|
||||
@ -274,12 +270,12 @@
|
||||
R_AARCH64_ABS64 = 257,
|
||||
R_AARCH64_GLOB_DAT = 1025,
|
||||
|
||||
};
|
||||
};
|
||||
#endif //}
|
||||
|
||||
#ifdef WANT_NHDR_ENUM
|
||||
#undef WANT_NHDR_ENUM
|
||||
enum { // ELF PT_NOTE types
|
||||
enum { // ELF PT_NOTE types
|
||||
#define ELF_NOTE_GNU_NAME "GNU\0"
|
||||
NT_GNU_ABI_TAG = 1,
|
||||
NT_GNU_HWCAP = 2,
|
||||
@ -292,38 +288,38 @@
|
||||
NHDR_NETBSD_TAG = 1,
|
||||
NHDR_CHECKSUM_TAG = 2,
|
||||
NHDR_PAX_TAG = 3,
|
||||
};
|
||||
};
|
||||
|
||||
enum { // descsz descriptor sizes
|
||||
enum { // descsz descriptor sizes
|
||||
GNU_ABI_DESCSZ = 16, // int GNU_OS, major, minor, subminor;
|
||||
NETBSD_DESCSZ = 4, // major_ver * (10**8) + minor
|
||||
OPENBSD_DESCSZ = 4, // 32-bit zero
|
||||
// CHECKSUM_DESCSZ is 2*sizeof(short) + sizeof(checksum)
|
||||
PAX_DESCSZ = 4, // 32-bit mask
|
||||
};
|
||||
};
|
||||
|
||||
enum { // GNU OS/version
|
||||
enum { // GNU OS/version
|
||||
GNU_OS_LINUX = 0,
|
||||
GNU_OS_HURD = 1,
|
||||
GNU_OS_SOLARIS = 2,
|
||||
};
|
||||
};
|
||||
|
||||
enum { // NetBSD checksum methods
|
||||
enum { // NetBSD checksum methods
|
||||
CHECKSUM_CRC32 = 1,
|
||||
CHECKSUM_MD5 = 2,
|
||||
CHECKSUM_SHA1 = 3,
|
||||
CHECKSUM_SHA256 = 4,
|
||||
};
|
||||
};
|
||||
|
||||
#define ELF_NOTE_PAX_NAME "PaX\0"
|
||||
enum { // NetBSD PaX bit values
|
||||
PAX_MPROTECT = (1<<0), /* force enable Mprotect */
|
||||
PAX_NOMPROTECT = (1<<1), /* force disable Mprotect */
|
||||
PAX_GUARD = (1<<2), /* force enable SEGVguard */
|
||||
PAX_NOGUARD = (1<<3), /* force disable SEGVguard */
|
||||
PAX_ASLR = (1<<4), /* force enable ASLR */
|
||||
PAX_NOASLR = (1<<5), /* force disable ASLR */
|
||||
};
|
||||
enum { // NetBSD PaX bit values
|
||||
PAX_MPROTECT = (1 << 0), /* force enable Mprotect */
|
||||
PAX_NOMPROTECT = (1 << 1), /* force disable Mprotect */
|
||||
PAX_GUARD = (1 << 2), /* force enable SEGVguard */
|
||||
PAX_NOGUARD = (1 << 3), /* force disable SEGVguard */
|
||||
PAX_ASLR = (1 << 4), /* force enable ASLR */
|
||||
PAX_NOASLR = (1 << 5), /* force disable ASLR */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* vim:set ts=4 sw=4 et: */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user