Changeset 17341d4 in mainline for uspace/lib/c/include/elf/elf_load.h
- Timestamp:
- 2016-04-20T17:25:48Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dc0d8b52
- Parents:
- 13dfa3f9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/elf/elf_load.h
r13dfa3f9 r17341d4 1 1 /* 2 * Copyright (c) 2006 Sergey Bondari 3 * Copyright (c) 2008 Jiri Svoboda 2 * Copyright (c) 2016 Jiri Svoboda 4 3 * All rights reserved. 5 4 * … … 32 31 */ 33 32 /** @file 34 * @brief ELF loader structures and public functions.33 * @brief 35 34 */ 36 35 … … 38 37 #define ELF_LOAD_H_ 39 38 40 #include <elf/elf.h> 41 #include <sys/types.h> 42 #include <loader/pcb.h> 39 #include <elf/elf_mod.h> 40 #include <rtld/rtld.h> 43 41 44 /** 45 * ELF error return codes 46 */ 47 #define EE_OK 0 /* No error */ 48 #define EE_INVALID 1 /* Invalid ELF image */ 49 #define EE_MEMORY 2 /* Cannot allocate address space */ 50 #define EE_INCOMPATIBLE 3 /* ELF image is not compatible with current architecture */ 51 #define EE_UNSUPPORTED 4 /* Non-supported ELF (e.g. dynamic ELFs) */ 52 #define EE_LOADER 5 /* The image is actually a program loader. */ 53 #define EE_IRRECOVERABLE 6 54 55 typedef enum { 56 /** Leave all segments in RW access mode. */ 57 ELDF_RW = 1 58 } eld_flags_t; 59 60 /** 61 * Some data extracted from the headers are stored here 62 */ 42 /** Information on loaded ELF program */ 63 43 typedef struct { 64 /** Entry point */ 65 entry_point_t entry; 66 67 /** ELF interpreter name or NULL if statically-linked */ 68 const char *interp; 69 70 /** Pointer to the dynamic section */ 71 void *dynamic; 44 elf_finfo_t finfo; 45 rtld_t *env; 72 46 } elf_info_t; 73 47 74 /** 75 * Holds information about an ELF binary being loaded. 76 */ 77 typedef struct { 78 /** Filedescriptor of the file from which we are loading */ 79 int fd; 80 81 /** Difference between run-time addresses and link-time addresses */ 82 uintptr_t bias; 83 84 /** Flags passed to the ELF loader. */ 85 eld_flags_t flags; 86 87 /** A copy of the ELF file header */ 88 elf_header_t *header; 89 90 /** Store extracted info here */ 91 elf_info_t *info; 92 } elf_ld_t; 93 94 extern const char *elf_error(unsigned int); 95 extern int elf_load_file(const char *, size_t, eld_flags_t, elf_info_t *); 96 extern void elf_create_pcb(elf_info_t *, pcb_t *); 48 extern int elf_load(const char *, elf_info_t *); 49 extern void elf_set_pcb(elf_info_t *, pcb_t *); 97 50 98 51 #endif
Note:
See TracChangeset
for help on using the changeset viewer.