mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 825901 - Remove the old linker code headers. r=blassey
This commit is contained in:
parent
5cfa56d91c
commit
bc11d22051
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __LINKER_BA_H
|
|
||||||
#define __LINKER_BA_H
|
|
||||||
|
|
||||||
struct ba_bits {
|
|
||||||
unsigned allocated:1; /* 1 if allocated, 0 if free */
|
|
||||||
unsigned order:7; /* size of the region in ba space */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ba {
|
|
||||||
/* start address of the ba space */
|
|
||||||
unsigned long base;
|
|
||||||
/* total size of the ba space */
|
|
||||||
unsigned long size;
|
|
||||||
/* the smaller allocation that can be made */
|
|
||||||
unsigned long min_alloc;
|
|
||||||
/* the order of the largest allocation that can be made */
|
|
||||||
unsigned long max_order;
|
|
||||||
/* number of entries in the ba space */
|
|
||||||
int num_entries;
|
|
||||||
/* the bitmap for the region indicating which entries are allocated
|
|
||||||
* and which are free */
|
|
||||||
struct ba_bits *bitmap;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void ba_init(struct ba *ba);
|
|
||||||
extern int ba_allocate(struct ba *ba, unsigned long len);
|
|
||||||
extern int ba_free(struct ba *ba, int index);
|
|
||||||
extern unsigned long ba_start_addr(struct ba *ba, int index);
|
|
||||||
extern unsigned long ba_len(struct ba *ba, int index);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,113 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
#ifndef _SYS_TLS_H
|
|
||||||
#define _SYS_TLS_H
|
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
|
||||||
|
|
||||||
/** WARNING WARNING WARNING
|
|
||||||
**
|
|
||||||
** This header file is *NOT* part of the public Bionic ABI/API
|
|
||||||
** and should not be used/included by user-serviceable parts of
|
|
||||||
** the system (e.g. applications).
|
|
||||||
**
|
|
||||||
** It is only provided here for the benefit of the system dynamic
|
|
||||||
** linker and the OpenGL sub-system (which needs to access the
|
|
||||||
** pre-allocated slot directly for performance reason).
|
|
||||||
**/
|
|
||||||
|
|
||||||
/* maximum number of elements in the TLS array */
|
|
||||||
#define BIONIC_TLS_SLOTS 64
|
|
||||||
|
|
||||||
/* note that slot 0, called TLS_SLOT_SELF must point to itself.
|
|
||||||
* this is required to implement thread-local storage with the x86
|
|
||||||
* Linux kernel, that reads the TLS from fs:[0], where 'fs' is a
|
|
||||||
* thread-specific segment descriptor...
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Well known TLS slots */
|
|
||||||
#define TLS_SLOT_SELF 0
|
|
||||||
#define TLS_SLOT_THREAD_ID 1
|
|
||||||
#define TLS_SLOT_ERRNO 2
|
|
||||||
|
|
||||||
#define TLS_SLOT_OPENGL_API 3
|
|
||||||
#define TLS_SLOT_OPENGL 4
|
|
||||||
|
|
||||||
/* this slot is only used to pass information from the dynamic linker to
|
|
||||||
* libc.so when the C library is loaded in to memory. The C runtime init
|
|
||||||
* function will then clear it. Since its use is extremely temporary,
|
|
||||||
* we reuse an existing location.
|
|
||||||
*/
|
|
||||||
#define TLS_SLOT_BIONIC_PREINIT (TLS_SLOT_ERRNO+1)
|
|
||||||
|
|
||||||
/* small technical note: it is not possible to call pthread_setspecific
|
|
||||||
* on keys that are <= TLS_SLOT_MAX_WELL_KNOWN, which is why it is set to
|
|
||||||
* TLS_SLOT_ERRNO.
|
|
||||||
*
|
|
||||||
* later slots like TLS_SLOT_OPENGL are pre-allocated through the use of
|
|
||||||
* TLS_DEFAULT_ALLOC_MAP. this means that there is no need to use
|
|
||||||
* pthread_key_create() to initialize them. on the other hand, there is
|
|
||||||
* no destructor associated to them (we might need to implement this later)
|
|
||||||
*/
|
|
||||||
#define TLS_SLOT_MAX_WELL_KNOWN TLS_SLOT_ERRNO
|
|
||||||
|
|
||||||
#define TLS_DEFAULT_ALLOC_MAP 0x0000001F
|
|
||||||
|
|
||||||
/* set the Thread Local Storage, must contain at least BIONIC_TLS_SLOTS pointers */
|
|
||||||
extern void __init_tls(void** tls, void* thread_info);
|
|
||||||
|
|
||||||
/* syscall only, do not call directly */
|
|
||||||
extern int __set_tls(void *ptr);
|
|
||||||
|
|
||||||
/* get the TLS */
|
|
||||||
#ifdef __arm__
|
|
||||||
/* Linux kernel helpers for its TLS implementation */
|
|
||||||
/* For performance reasons, avoid calling the kernel helper
|
|
||||||
* Note that HAVE_ARM_TLS_REGISTER is build-specific
|
|
||||||
* (it must match your kernel configuration)
|
|
||||||
*/
|
|
||||||
# ifdef HAVE_ARM_TLS_REGISTER
|
|
||||||
# define __get_tls() \
|
|
||||||
({ register unsigned int __val asm("r0"); \
|
|
||||||
asm ("mrc p15, 0, r0, c13, c0, 3" : "=r"(__val) ); \
|
|
||||||
(volatile void*)__val; })
|
|
||||||
# else /* !HAVE_ARM_TLS_REGISTER */
|
|
||||||
# define __get_tls() ( *((volatile void **) 0xffff0ff0) )
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
extern void* __get_tls( void );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* return the stack base and size, used by our malloc debugger */
|
|
||||||
extern void* __get_stack_base(int *p_stack_size);
|
|
||||||
|
|
||||||
__END_DECLS
|
|
||||||
|
|
||||||
#endif /* _SYS_TLS_H */
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
#ifndef __DLFCN_H__
|
|
||||||
#define __DLFCN_H__
|
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const char *dli_fname; /* Pathname of shared object that
|
|
||||||
contains address */
|
|
||||||
void *dli_fbase; /* Address at which shared object
|
|
||||||
is loaded */
|
|
||||||
const char *dli_sname; /* Name of nearest symbol with address
|
|
||||||
lower than addr */
|
|
||||||
void *dli_saddr; /* Exact address of symbol named
|
|
||||||
in dli_sname */
|
|
||||||
} Dl_info;
|
|
||||||
|
|
||||||
#pragma GCC visibility push(default)
|
|
||||||
extern void* moz_mapped_dlopen(const char* filename, int flag,
|
|
||||||
int fd, void *mem, unsigned int len, unsigned int offset);
|
|
||||||
extern void* __wrap_dlopen(const char* filename, int flag);
|
|
||||||
extern int __wrap_dlclose(void* handle);
|
|
||||||
extern const char* __wrap_dlerror(void);
|
|
||||||
extern void* __wrap_dlsym(void* handle, const char* symbol);
|
|
||||||
extern int __wrap_dladdr(void* addr, Dl_info *info);
|
|
||||||
#pragma GCC visibility pop
|
|
||||||
|
|
||||||
enum {
|
|
||||||
RTLD_NOW = 0,
|
|
||||||
RTLD_LAZY = 1,
|
|
||||||
|
|
||||||
RTLD_LOCAL = 0,
|
|
||||||
RTLD_GLOBAL = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define RTLD_DEFAULT ((void*) 0xffffffff)
|
|
||||||
#define RTLD_NEXT ((void*) 0xfffffffe)
|
|
||||||
|
|
||||||
__END_DECLS
|
|
||||||
|
|
||||||
#endif /* __DLFCN_H */
|
|
||||||
|
|
||||||
|
|
@ -1,243 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LINKER_H_
|
|
||||||
#define _LINKER_H_
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <linux/elf.h>
|
|
||||||
|
|
||||||
#undef PAGE_MASK
|
|
||||||
#undef PAGE_SIZE
|
|
||||||
#define PAGE_SIZE 4096
|
|
||||||
#define PAGE_MASK 4095
|
|
||||||
|
|
||||||
void debugger_init();
|
|
||||||
const char *addr_to_name(unsigned addr);
|
|
||||||
|
|
||||||
/* magic shared structures that GDB knows about */
|
|
||||||
|
|
||||||
struct link_map
|
|
||||||
{
|
|
||||||
uintptr_t l_addr;
|
|
||||||
char * l_name;
|
|
||||||
uintptr_t l_ld;
|
|
||||||
struct link_map * l_next;
|
|
||||||
struct link_map * l_prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* needed for dl_iterate_phdr to be passed to the callbacks provided */
|
|
||||||
struct dl_phdr_info
|
|
||||||
{
|
|
||||||
Elf32_Addr dlpi_addr;
|
|
||||||
const char *dlpi_name;
|
|
||||||
const Elf32_Phdr *dlpi_phdr;
|
|
||||||
Elf32_Half dlpi_phnum;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Values for r_debug->state
|
|
||||||
enum {
|
|
||||||
RT_CONSISTENT,
|
|
||||||
RT_ADD,
|
|
||||||
RT_DELETE
|
|
||||||
};
|
|
||||||
|
|
||||||
struct r_debug
|
|
||||||
{
|
|
||||||
int32_t r_version;
|
|
||||||
struct link_map * r_map;
|
|
||||||
void (*r_brk)(void);
|
|
||||||
int32_t r_state;
|
|
||||||
uintptr_t r_ldbase;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct soinfo soinfo;
|
|
||||||
|
|
||||||
#define FLAG_LINKED 0x00000001
|
|
||||||
#define FLAG_ERROR 0x00000002
|
|
||||||
#define FLAG_EXE 0x00000004 // The main executable
|
|
||||||
#define FLAG_PRELINKED 0x00000008 // This is a pre-linked lib
|
|
||||||
#define FLAG_MMAPPED 0x00000010 // The object was loaded through load_mapped_library
|
|
||||||
|
|
||||||
#define SOINFO_NAME_LEN 128
|
|
||||||
|
|
||||||
struct soinfo
|
|
||||||
{
|
|
||||||
const char name[SOINFO_NAME_LEN];
|
|
||||||
Elf32_Phdr *phdr;
|
|
||||||
int phnum;
|
|
||||||
unsigned entry;
|
|
||||||
unsigned base;
|
|
||||||
unsigned size;
|
|
||||||
// buddy-allocator index, negative for prelinked libraries
|
|
||||||
int ba_index;
|
|
||||||
|
|
||||||
unsigned *dynamic;
|
|
||||||
|
|
||||||
unsigned wrprotect_start;
|
|
||||||
unsigned wrprotect_end;
|
|
||||||
|
|
||||||
soinfo *next;
|
|
||||||
unsigned flags;
|
|
||||||
|
|
||||||
const char *strtab;
|
|
||||||
Elf32_Sym *symtab;
|
|
||||||
|
|
||||||
unsigned nbucket;
|
|
||||||
unsigned nchain;
|
|
||||||
unsigned *bucket;
|
|
||||||
unsigned *chain;
|
|
||||||
|
|
||||||
unsigned *plt_got;
|
|
||||||
|
|
||||||
Elf32_Rel *plt_rel;
|
|
||||||
unsigned plt_rel_count;
|
|
||||||
|
|
||||||
Elf32_Rel *rel;
|
|
||||||
unsigned rel_count;
|
|
||||||
|
|
||||||
#ifdef ANDROID_SH_LINKER
|
|
||||||
Elf32_Rela *plt_rela;
|
|
||||||
unsigned plt_rela_count;
|
|
||||||
|
|
||||||
Elf32_Rela *rela;
|
|
||||||
unsigned rela_count;
|
|
||||||
#endif /* ANDROID_SH_LINKER */
|
|
||||||
|
|
||||||
unsigned *preinit_array;
|
|
||||||
unsigned preinit_array_count;
|
|
||||||
|
|
||||||
unsigned *init_array;
|
|
||||||
unsigned init_array_count;
|
|
||||||
unsigned *fini_array;
|
|
||||||
unsigned fini_array_count;
|
|
||||||
|
|
||||||
void (*init_func)(void);
|
|
||||||
void (*fini_func)(void);
|
|
||||||
|
|
||||||
#ifdef ANDROID_ARM_LINKER
|
|
||||||
/* ARM EABI section used for stack unwinding. */
|
|
||||||
unsigned *ARM_exidx;
|
|
||||||
unsigned ARM_exidx_count;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned refcount;
|
|
||||||
struct link_map linkmap;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern soinfo libdl_info;
|
|
||||||
|
|
||||||
/* these must all be powers of two */
|
|
||||||
#ifdef ARCH_SH
|
|
||||||
#define LIBBASE 0x60000000
|
|
||||||
#define LIBLAST 0x70000000
|
|
||||||
#define LIBINC 0x00100000
|
|
||||||
#else
|
|
||||||
#define LIBBASE 0x70000000
|
|
||||||
#define LIBLAST 0x80000000
|
|
||||||
#define LIBINC 0x00100000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANDROID_ARM_LINKER
|
|
||||||
|
|
||||||
#define R_ARM_COPY 20
|
|
||||||
#define R_ARM_GLOB_DAT 21
|
|
||||||
#define R_ARM_JUMP_SLOT 22
|
|
||||||
#define R_ARM_RELATIVE 23
|
|
||||||
|
|
||||||
/* According to the AAPCS specification, we only
|
|
||||||
* need the above relocations. However, in practice,
|
|
||||||
* the following ones turn up from time to time.
|
|
||||||
*/
|
|
||||||
#define R_ARM_ABS32 2
|
|
||||||
#define R_ARM_REL32 3
|
|
||||||
|
|
||||||
#elif defined(ANDROID_X86_LINKER)
|
|
||||||
|
|
||||||
#define R_386_32 1
|
|
||||||
#define R_386_PC32 2
|
|
||||||
#define R_386_GLOB_DAT 6
|
|
||||||
#define R_386_JUMP_SLOT 7
|
|
||||||
#define R_386_RELATIVE 8
|
|
||||||
|
|
||||||
#elif defined(ANDROID_SH_LINKER)
|
|
||||||
|
|
||||||
#define R_SH_DIR32 1
|
|
||||||
#define R_SH_GLOB_DAT 163
|
|
||||||
#define R_SH_JUMP_SLOT 164
|
|
||||||
#define R_SH_RELATIVE 165
|
|
||||||
|
|
||||||
#endif /* ANDROID_*_LINKER */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DT_INIT_ARRAY
|
|
||||||
#define DT_INIT_ARRAY 25
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DT_FINI_ARRAY
|
|
||||||
#define DT_FINI_ARRAY 26
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DT_INIT_ARRAYSZ
|
|
||||||
#define DT_INIT_ARRAYSZ 27
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DT_FINI_ARRAYSZ
|
|
||||||
#define DT_FINI_ARRAYSZ 28
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DT_PREINIT_ARRAY
|
|
||||||
#define DT_PREINIT_ARRAY 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DT_PREINIT_ARRAYSZ
|
|
||||||
#define DT_PREINIT_ARRAYSZ 33
|
|
||||||
#endif
|
|
||||||
|
|
||||||
soinfo *find_library(const char *name);
|
|
||||||
soinfo *find_mapped_library(const char *name, int fd,
|
|
||||||
void *mem, size_t len, size_t offset);
|
|
||||||
unsigned unload_library(soinfo *si);
|
|
||||||
Elf32_Sym *lookup_in_library(soinfo *si, const char *name);
|
|
||||||
Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start);
|
|
||||||
soinfo *find_containing_library(void *addr);
|
|
||||||
Elf32_Sym *find_containing_symbol(void *addr, soinfo *si);
|
|
||||||
const char *linker_get_error(void);
|
|
||||||
void simple_linker_init(void);
|
|
||||||
|
|
||||||
#ifdef ANDROID_ARM_LINKER
|
|
||||||
typedef long unsigned int *_Unwind_Ptr;
|
|
||||||
_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
|
|
||||||
#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_SH_LINKER)
|
|
||||||
int dl_iterate_phdr(int (*cb)(struct dl_phdr_info *, size_t, void *), void *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,155 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2008-2010 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LINKER_DEBUG_H_
|
|
||||||
#define _LINKER_DEBUG_H_
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifndef LINKER_DEBUG
|
|
||||||
#error LINKER_DEBUG should be defined to either 1 or 0 in Android.mk
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* set LINKER_DEBUG_TO_LOG to 1 to send the logs to logcat,
|
|
||||||
* or 0 to use stdout instead.
|
|
||||||
*/
|
|
||||||
#define LINKER_DEBUG_TO_LOG 1
|
|
||||||
#define TRACE_DEBUG 1
|
|
||||||
#define DO_TRACE_LOOKUP 1
|
|
||||||
#define DO_TRACE_RELO 1
|
|
||||||
#define TIMING 0
|
|
||||||
#define STATS 0
|
|
||||||
#define COUNT_PAGES 0
|
|
||||||
|
|
||||||
/*********************************************************************
|
|
||||||
* You shouldn't need to modify anything below unless you are adding
|
|
||||||
* more debugging information.
|
|
||||||
*
|
|
||||||
* To enable/disable specific debug options, change the defines above
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
#undef TRUE
|
|
||||||
#undef FALSE
|
|
||||||
#define TRUE 1
|
|
||||||
#define FALSE 0
|
|
||||||
|
|
||||||
/* Only use printf() during debugging. We have seen occasional memory
|
|
||||||
* corruption when the linker uses printf().
|
|
||||||
*/
|
|
||||||
#if LINKER_DEBUG
|
|
||||||
#include "linker_format.h"
|
|
||||||
extern int debug_verbosity;
|
|
||||||
#if LINKER_DEBUG_TO_LOG
|
|
||||||
extern int format_log(int, const char *, const char *, ...);
|
|
||||||
#define _PRINTVF(v,f,x...) \
|
|
||||||
do { \
|
|
||||||
if (debug_verbosity > (v)) format_log(5-(v),"linker",x); \
|
|
||||||
} while (0)
|
|
||||||
#else /* !LINKER_DEBUG_TO_LOG */
|
|
||||||
extern int format_fd(int, const char *, ...);
|
|
||||||
#define _PRINTVF(v,f,x...) \
|
|
||||||
do { \
|
|
||||||
if (debug_verbosity > (v)) format_fd(1, x); \
|
|
||||||
} while (0)
|
|
||||||
#endif /* !LINKER_DEBUG_TO_LOG */
|
|
||||||
#else /* !LINKER_DEBUG */
|
|
||||||
#define _PRINTVF(v,f,x...) do {} while(0)
|
|
||||||
#endif /* LINKER_DEBUG */
|
|
||||||
|
|
||||||
#define PRINT(x...) _PRINTVF(-1, FALSE, x)
|
|
||||||
#define INFO(x...) _PRINTVF(0, TRUE, x)
|
|
||||||
#define TRACE(x...) _PRINTVF(1, TRUE, x)
|
|
||||||
#define WARN(fmt,args...) \
|
|
||||||
_PRINTVF(-1, TRUE, "%s:%d| WARNING: " fmt, __FILE__, __LINE__, ## args)
|
|
||||||
#define ERROR(fmt,args...) \
|
|
||||||
_PRINTVF(-1, TRUE, "%s:%d| ERROR: " fmt, __FILE__, __LINE__, ## args)
|
|
||||||
|
|
||||||
|
|
||||||
#if TRACE_DEBUG
|
|
||||||
#define DEBUG(x...) _PRINTVF(2, TRUE, "DEBUG: " x)
|
|
||||||
#else /* !TRACE_DEBUG */
|
|
||||||
#define DEBUG(x...) do {} while (0)
|
|
||||||
#endif /* TRACE_DEBUG */
|
|
||||||
|
|
||||||
#if LINKER_DEBUG
|
|
||||||
#define TRACE_TYPE(t,x...) do { if (DO_TRACE_##t) { TRACE(x); } } while (0)
|
|
||||||
#else /* !LINKER_DEBUG */
|
|
||||||
#define TRACE_TYPE(t,x...) do {} while (0)
|
|
||||||
#endif /* LINKER_DEBUG */
|
|
||||||
|
|
||||||
#if STATS
|
|
||||||
#define RELOC_ABSOLUTE 0
|
|
||||||
#define RELOC_RELATIVE 1
|
|
||||||
#define RELOC_COPY 2
|
|
||||||
#define RELOC_SYMBOL 3
|
|
||||||
#define NUM_RELOC_STATS 4
|
|
||||||
|
|
||||||
struct _link_stats {
|
|
||||||
int reloc[NUM_RELOC_STATS];
|
|
||||||
};
|
|
||||||
extern struct _link_stats linker_stats;
|
|
||||||
|
|
||||||
#define COUNT_RELOC(type) \
|
|
||||||
do { if (type >= 0 && type < NUM_RELOC_STATS) { \
|
|
||||||
linker_stats.reloc[type] += 1; \
|
|
||||||
} else { \
|
|
||||||
PRINT("Unknown reloc stat requested\n"); \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
#else /* !STATS */
|
|
||||||
#define COUNT_RELOC(type) do {} while(0)
|
|
||||||
#endif /* STATS */
|
|
||||||
|
|
||||||
#if TIMING
|
|
||||||
#undef WARN
|
|
||||||
#define WARN(x...) do {} while (0)
|
|
||||||
#endif /* TIMING */
|
|
||||||
|
|
||||||
#if COUNT_PAGES
|
|
||||||
extern unsigned bitmask[];
|
|
||||||
#define MARK(offset) do { \
|
|
||||||
bitmask[((offset) >> 12) >> 3] |= (1 << (((offset) >> 12) & 7)); \
|
|
||||||
} while(0)
|
|
||||||
#else
|
|
||||||
#define MARK(x) do {} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEBUG_DUMP_PHDR(phdr, name, pid) do { \
|
|
||||||
DEBUG("%5d %s (phdr = 0x%08x)\n", (pid), (name), (unsigned)(phdr)); \
|
|
||||||
DEBUG("\t\tphdr->offset = 0x%08x\n", (unsigned)((phdr)->p_offset)); \
|
|
||||||
DEBUG("\t\tphdr->p_vaddr = 0x%08x\n", (unsigned)((phdr)->p_vaddr)); \
|
|
||||||
DEBUG("\t\tphdr->p_paddr = 0x%08x\n", (unsigned)((phdr)->p_paddr)); \
|
|
||||||
DEBUG("\t\tphdr->p_filesz = 0x%08x\n", (unsigned)((phdr)->p_filesz)); \
|
|
||||||
DEBUG("\t\tphdr->p_memsz = 0x%08x\n", (unsigned)((phdr)->p_memsz)); \
|
|
||||||
DEBUG("\t\tphdr->p_flags = 0x%08x\n", (unsigned)((phdr)->p_flags)); \
|
|
||||||
DEBUG("\t\tphdr->p_align = 0x%08x\n", (unsigned)((phdr)->p_align)); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#endif /* _LINKER_DEBUG_H_ */
|
|
Loading…
Reference in New Issue
Block a user