axle OS
x86_32 UNIX-like hobby OS
src
kernel
elf.h
1
#ifndef KERNEL_ELF_H
2
#define KERNEL_ELF_H
3
4
#include "multiboot.h"
5
6
#define ELF32_ST_BIND(i) ((i)>>4)
7
#define ELF32_ST_TYPE(i) ((i)&0xf)
8
#define ELF32_ST_INFO(b, t) (((b)<<4)+((t)&0xf))
9
10
typedef
struct
{
11
uint32_t name;
12
uint32_t type;
13
uint32_t flags;
14
uint32_t addr;
15
uint32_t offset;
16
uint32_t
size
;
17
uint32_t link;
18
uint32_t info;
19
uint32_t addralign;
20
uint32_t entsize;
21
}
__attribute__
((packed)) elf_section_header_t;
22
23
typedef
struct
{
24
uint32_t name;
25
uint32_t value;
26
uint32_t
size
;
27
uint8_t info;
28
uint8_t other;
29
uint16_t shndx;
30
}
__attribute__
((packed)) elf_symbol_t;
31
32
typedef
struct
{
33
elf_symbol_t *symtab;
34
uint32_t symtabsz;
35
const
char
*strtab;
36
uint32_t strtabsz;
37
}
elf_t
;
38
39
//takes a multiboot struct and returns an elf struct containing relavent info
40
void
elf_from_multiboot(
multiboot
* mb,
elf_t
* elf);
41
//elf_t elf_from_multiboot(multiboot* mb);
42
43
//looks up symbol at addr
44
const
char
* elf_sym_lookup(
elf_t
* elf, uint32_t addr);
45
46
#endif
elf_t
Definition:
elf.h:32
multiboot_info
Definition:
multiboot.h:15
__attribute__
Definition:
elf.h:10
size
Definition:
size.h:4
Generated by
1.8.14