diff options
Diffstat (limited to 'trunk/src/prelink.h')
-rw-r--r-- | trunk/src/prelink.h | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/trunk/src/prelink.h b/trunk/src/prelink.h index 8849539..741f0a4 100644 --- a/trunk/src/prelink.h +++ b/trunk/src/prelink.h @@ -1,6 +1,8 @@ /* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 Red Hat, Inc. + Copyright (C) 2008 CodeSourcery. Written by Jakub Jelinek <jakub@redhat.com>, 2001. + Updated by Maciej W. Rozycki <macro@codesourcery.com>, 2008. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,10 +24,16 @@ #include <elf.h> #include <libelf.h> #include <gelfx.h> +#include <ftw.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <sys/stat.h> +#include <utime.h> + +#ifndef HAVE_ELF64_BYTE +typedef uint8_t Elf64_Byte; +#endif #ifndef DT_GNU_LIBLIST #define DT_GNU_LIBLIST 0x6ffffef9 @@ -75,10 +83,28 @@ #define R_MIPS_TLS_TPREL32 47 #endif +#ifndef R_MIPS_TLS_DTPMOD64 +#define R_MIPS_TLS_DTPMOD64 40 +#define R_MIPS_TLS_DTPREL64 41 +#define R_MIPS_TLS_TPREL64 48 +#endif + #ifndef R_MIPS_GLOB_DAT #define R_MIPS_GLOB_DAT 51 #endif +#ifndef R_MIPS_COPY +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 +#define STO_MIPS_PLT 0x8 +#define DT_MIPS_PLTGOT 0x70000032 +#define DT_MIPS_RWPLT 0x70000034 +#endif + +#ifndef RSS_UNDEF +#define RSS_UNDEF 0 +#endif + #ifndef R_ARM_TLS_DTPMOD32 #define R_ARM_TLS_DTPMOD32 17 #define R_ARM_TLS_DTPOFF32 18 @@ -137,6 +163,7 @@ typedef struct GElf_Addr info_DT_MIPS_LOCAL_GOTNO; GElf_Addr info_DT_MIPS_GOTSYM; GElf_Addr info_DT_MIPS_SYMTABNO; + GElf_Addr info_DT_MIPS_PLTGOT; #define DT_GNU_PRELINKED_BIT 50 #define DT_CHECKSUM_BIT 51 #define DT_VERNEED_BIT 52 @@ -162,7 +189,11 @@ typedef struct GElf_Shdr shdr[0]; } DSO; -#define dynamic_info_is_set(dso,bit) ((dso)->info_set_mask & (1ULL << (bit))) +static inline int +dynamic_info_is_set (DSO *dso, int bit) +{ + return ((dso)->info_set_mask & (1ULL << (bit))) != 0; +} struct layout_libs; @@ -174,6 +205,7 @@ struct PLArch int alternate_machine[3]; int max_reloc_size; const char *dynamic_linker; + const char *dynamic_linker_alt; int R_COPY; int R_JMP_SLOT; int R_RELATIVE; @@ -285,7 +317,7 @@ struct data_iterator { GElf_Addr sec_offset; }; -unsigned char * get_data (DSO *dso, GElf_Addr addr, int *scnp); +unsigned char * get_data (DSO *dso, GElf_Addr addr, int *scnp, Elf_Type *typep); #define READWRITEPROTO(le,nn) \ uint##nn##_t buf_read_u##le##nn (unsigned char *data); \ uint##nn##_t read_u##le##nn (DSO *dso, GElf_Addr addr); \ @@ -311,8 +343,8 @@ unsigned char *get_data_from_iterator (struct data_iterator *it, GElf_Addr size); int get_sym_from_iterator (struct data_iterator *it, GElf_Sym *sym); -#define PL_ARCH \ -static struct PLArch plarch __attribute__((section("pl_arch"),used)) +#define PL_ARCH(F) \ +static struct PLArch plarch_##F __attribute__((section("pl_arch"),used)) #define addr_adjust(addr, start, adjust) \ do { \ @@ -541,4 +573,22 @@ extern int quick; extern long long seed; extern GElf_Addr mmap_reg_start, mmap_reg_end; +extern const char *sysroot; + +int wrap_readlink (const char *path, char *buf, int len); +int wrap_lstat64 (const char *file, struct stat64 *buf); +int wrap_stat64 (const char *file, struct stat64 *buf); +int wrap_open (const char *file, int mode, ...); +int wrap_access (const char *file, int mode); +int wrap_rename (const char *old, const char *new); +int wrap_link (const char *old, const char *new); +int wrap_nftw64 (const char *dir, __nftw64_func_t func, + int descriptors, int flag); +int wrap_utime (const char *file, struct utimbuf *file_times); +int wrap_mkstemp (char *filename); +int wrap_unlink (const char *filename); +char *sysroot_file_name (const char *name, int allow_last_link); + +extern const char *prelink_rtld; + #endif /* PRELINK_H */ |