summaryrefslogtreecommitdiff
path: root/ldso/ldso/linuxelf.h
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-01 14:20:45 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-01 14:20:45 +0000
commitb7bc129184a23d4c9c70774362f4eeaa5e0b44c8 (patch)
treef42053a86d7e4f8c156663b4c9c791deef7e2ef5 /ldso/ldso/linuxelf.h
parent22a9e5bbdf43e1086d80341480d0601ee9c6f898 (diff)
Yet another major rework. This time around, rework it to no longer
use linux kernel header files. -Erik
Diffstat (limited to 'ldso/ldso/linuxelf.h')
-rw-r--r--ldso/ldso/linuxelf.h200
1 files changed, 44 insertions, 156 deletions
diff --git a/ldso/ldso/linuxelf.h b/ldso/ldso/linuxelf.h
index e90a8c3a4..bab9cd47a 100644
--- a/ldso/ldso/linuxelf.h
+++ b/ldso/ldso/linuxelf.h
@@ -1,181 +1,69 @@
-/* This should eventually appear in the distribution version of linux/elf.h */
-#ifndef R_SPARC_NONE
-#define R_SPARC_NONE 0
-#define R_SPARC_8 1
-#define R_SPARC_16 2
-#define R_SPARC_32 3
-#define R_SPARC_DISP8 4
-#define R_SPARC_DISP16 5
-#define R_SPARC_DISP32 6
-#define R_SPARC_WDISP30 7
-#define R_SPARC_WDISP22 8
-#define R_SPARC_HI22 9
-#define R_SPARC_22 10
-#define R_SPARC_13 11
-#define R_SPARC_LO10 12
-#define R_SPARC_GOT10 13
-#define R_SPARC_GOT13 14
-#define R_SPARC_GOT22 15
-#define R_SPARC_PC10 16
-#define R_SPARC_PC22 17
-#define R_SPARC_WPLT30 18
-#define R_SPARC_COPY 19
-#define R_SPARC_GLOB_DAT 20
-#define R_SPARC_JMP_SLOT 21
-#define R_SPARC_RELATIVE 22
-#define R_SPARC_UA32 23
-#endif
-
-#ifndef R_68K_NONE
-#define R_68K_NONE 0
-#define R_68K_32 1
-#define R_68K_16 2
-#define R_68K_8 3
-#define R_68K_PC32 4
-#define R_68K_PC16 5
-#define R_68K_PC8 6
-#define R_68K_GOT32 7
-#define R_68K_GOT16 8
-#define R_68K_GOT8 9
-#define R_68K_GOT32O 10
-#define R_68K_GOT16O 11
-#define R_68K_GOT8O 12
-#define R_68K_PLT32 13
-#define R_68K_PLT16 14
-#define R_68K_PLT8 15
-#define R_68K_PLT32O 16
-#define R_68K_PLT16O 17
-#define R_68K_PLT8O 18
-#define R_68K_COPY 19
-#define R_68K_GLOB_DAT 20
-#define R_68K_JMP_SLOT 21
-#define R_68K_RELATIVE 22
-#define R_68K_NUM 23
-#endif
-
-
-/* ARM relocs. */
-#ifndef R_ARM_NONE
-#define R_ARM_NONE 0 /* No reloc */
-#define R_ARM_PC24 1 /* PC relative 26 bit branch */
-#define R_ARM_ABS32 2 /* Direct 32 bit */
-#define R_ARM_REL32 3 /* PC relative 32 bit */
-#define R_ARM_PC13 4
-#define R_ARM_ABS16 5 /* Direct 16 bit */
-#define R_ARM_ABS12 6 /* Direct 12 bit */
-#define R_ARM_THM_ABS5 7
-#define R_ARM_ABS8 8 /* Direct 8 bit */
-#define R_ARM_SBREL32 9
-#define R_ARM_THM_PC22 10
-#define R_ARM_THM_PC8 11
-#define R_ARM_AMP_VCALL9 12
-#define R_ARM_SWI24 13
-#define R_ARM_THM_SWI8 14
-#define R_ARM_XPC25 15
-#define R_ARM_THM_XPC22 16
-#define R_ARM_COPY 20 /* Copy symbol at runtime */
-#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
-#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
-#define R_ARM_RELATIVE 23 /* Adjust by program base */
-#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */
-#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
-#define R_ARM_GOT32 26 /* 32 bit GOT entry */
-#define R_ARM_PLT32 27 /* 32 bit PLT address */
-#define R_ARM_GNU_VTENTRY 100
-#define R_ARM_GNU_VTINHERIT 101
-#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
-#define R_ARM_THM_PC9 103 /* thumb conditional branch */
-#define R_ARM_RXPC25 249
-#define R_ARM_RSBREL32 250
-#define R_ARM_THM_RPC22 251
-#define R_ARM_RREL32 252
-#define R_ARM_RABS22 253
-#define R_ARM_RPC24 254
-#define R_ARM_RBASE 255
-/* Keep this the last entry. */
-#define R_ARM_NUM 256
-#endif
+#ifndef LINUXELF_H
+#define LINUXELF_H
+/* Forward declarations for stuff defined in hash.h */
+struct dyn_elf;
+struct elf_resolve;
-/*
- * These constants define the elements of the auxiliary vector used to
- * pass additional information from the kernel to an ELF application.
- */
-
-#ifndef AT_NULL
-typedef struct
-{
- int a_type;
- union{
- long a_val;
- void *p_ptr;
- void (*a_fcn)();
- } a_un;
-} auxv_t;
-/*
- * Values of a_type... These often appear in the file /usr/include/sys/auxv.h
- * on SVr4 systems.
- */
-#define AT_NULL 0
-#define AT_IGNORE 1
-#define AT_EXECFD 2
-#define AT_PHDR 3
-#define AT_PHENT 4
-#define AT_PHNUM 5
-#define AT_PAGESZ 6
-#define AT_BASE 7
-#define AT_FLAGS 8
-#define AT_ENTRY 9
-#endif
-#ifndef AT_NOTELF
-#define AT_NOTELF 10 /* program is not ELF */
-#define AT_UID 11 /* real uid */
-#define AT_EUID 12 /* effective uid */
-#define AT_GID 13 /* real gid */
-#define AT_EGID 14 /* effective gid */
-#endif
-
-extern int _dl_linux_resolve(void);
-extern struct elf_resolve * _dl_load_shared_library(int secure,
- struct elf_resolve *, char * libname);
+/* Some function prototypes */
extern void * _dl_malloc(int size);
extern int _dl_map_cache(void);
extern int _dl_unmap_cache(void);
-
-extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
- char * libname, int);
int _dl_copy_fixups(struct dyn_elf * tpnt);
-
-extern int linux_run(int argc, char * argv[]);
-
-extern void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, int rel_addr,
- int rel_size, int type);
-
extern int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr,
int rel_size, int type);
+extern void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, int rel_addr,
+ int rel_size, int type);
+extern struct elf_resolve * _dl_load_shared_library(int secure,
+ struct elf_resolve *, char * libname);
+extern struct elf_resolve * _dl_load_elf_shared_library(int secure,
+ char * libname, int);
extern int _dl_parse_copy_information(struct dyn_elf * rpnt, int rel_addr,
int rel_size, int type);
+extern int _dl_linux_resolve(void);
+#define ELF_CLASS ELFCLASS32
-/* This means that we may be forced to manually search for copy fixups
- which were omitted by the linker. We cannot depend upon the DT_TEXTREL
- to tell us whether there are fixups in a text section or not. */
-
#ifndef SVR4_BUGCOMPAT
#define SVR4_BUGCOMPAT 1
#endif
-#ifndef PF_R
-#define PF_R 4
-#define PF_W 2
-#define PF_X 1
+#if ELF_CLASS == ELFCLASS32
+
+#define elfhdr Elf32_Ehdr
+#define elf_phdr Elf32_Phdr
+#define elf_note Elf32_Nhdr
+/*
+ * Datatype of a relocation on this platform
+ */
+#ifdef ELF_USES_RELOCA
+# define ELF_RELOC Elf32_Rela
+#else
+# define ELF_RELOC Elf32_Rel
+#endif
+
+#else
+
+#define elfhdr Elf64_Ehdr
+#define elf_phdr Elf64_Phdr
+#define elf_note Elf64_Nhdr
+/*
+ * Datatype of a relocation on this platform
+ */
+#ifdef ELF_USES_RELOCA
+# define ELF_RELOC Elf64_Rela
+#else
+# define ELF_RELOC Elf64_Rel
+#endif
+
#endif
+
/* Convert between the Linux flags for page protections and the
ones specified in the ELF standard. */
-
#define LXFLAGS(X) ( (((X) & PF_R) ? PROT_READ : 0) | \
(((X) & PF_W) ? PROT_WRITE : 0) | \
(((X) & PF_X) ? PROT_EXEC : 0))
+#endif /* LINUXELF_H */