12 #include "elfconfig.h"
14 #if KERNEL_ELFCLASS == ELFCLASS32
16 #define Elf_Ehdr Elf32_Ehdr
17 #define Elf_Shdr Elf32_Shdr
18 #define Elf_Sym Elf32_Sym
19 #define Elf_Addr Elf32_Addr
20 #define Elf_Section Elf32_Section
21 #define ELF_ST_BIND ELF32_ST_BIND
22 #define ELF_ST_TYPE ELF32_ST_TYPE
24 #define Elf_Rela Elf32_Rela
25 #define ELF_R_SYM ELF32_R_SYM
26 #define ELF_R_TYPE ELF32_R_TYPE
29 #define Elf_Ehdr Elf64_Ehdr
30 #define Elf_Shdr Elf64_Shdr
31 #define Elf_Sym Elf64_Sym
32 #define Elf_Addr Elf64_Addr
33 #define Elf_Section Elf64_Section
34 #define ELF_ST_BIND ELF64_ST_BIND
35 #define ELF_ST_TYPE ELF64_ST_TYPE
37 #define Elf_Rela Elf64_Rela
38 #define ELF_R_SYM ELF64_R_SYM
39 #define ELF_R_TYPE ELF64_R_TYPE
42 #if KERNEL_ELFDATA != HOST_ELFDATA
44 static inline void __endian(const void *src, void *dest, unsigned int size)
47 for (i = 0; i < size; i++)
48 ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1];
53 #define TO_NATIVE(x) \
56 __endian(&(x), &(__x), sizeof(__x)); \
60 #else /* endianness matches */
62 #define TO_NATIVE(x) (x)
66 #define NOFAIL(ptr) do_nofail((ptr), #ptr)
67 void *do_nofail(void *ptr, const char *expr);
75 void __attribute__((format(printf, 2, 3)))
76 buf_printf(struct buffer *buf, const char *fmt, ...);
79 buf_write(struct buffer *buf, const char *s, int len);
89 struct buffer dev_table_buf;
97 Elf_Sym *symtab_start;
101 unsigned int modinfo_len;
105 void handle_moddevtable(struct module *mod, struct elf_info *info,
106 Elf_Sym *sym, const char *symname);
107 void add_moddevtable(struct buffer *buf, struct module *mod);
110 void maybe_frob_rcs_version(const char *modfilename,
113 unsigned long modinfo_offset);
114 void get_src_version(const char *modname, char sum[], unsigned sumlen);
117 void *grab_file(const char *filename, unsigned long *size);
118 char* get_next_line(unsigned long *pos, void *file, unsigned long size);
119 void release_file(void *file, unsigned long size);
121 void fatal(const char *fmt, ...);
122 void warn(const char *fmt, ...);