Added object file format spec
All checks were successful
Validate the build / validate-build (push) Successful in 25s
All checks were successful
Validate the build / validate-build (push) Successful in 25s
This is a WIP.
This commit is contained in:
parent
0d3881f680
commit
3db9fd9b8f
55
doc/object_format.md
Normal file
55
doc/object_format.md
Normal file
@ -0,0 +1,55 @@
|
||||
# Linker file format
|
||||
|
||||
```C
|
||||
|
||||
struct object_file {
|
||||
uint64_t magic; // ".oo-bin"
|
||||
uint64_t version; // 1
|
||||
uint64_t architecture; // AMD64(0)
|
||||
uint64_t offsets_offset;
|
||||
|
||||
struct offsets {
|
||||
uint64_t strings;
|
||||
uint64_t sections;
|
||||
uint64_t symbols;
|
||||
uint64_t relocations;
|
||||
} offsets;
|
||||
|
||||
struct string_table {
|
||||
uint64_t size;
|
||||
uint8_t data[static size];
|
||||
} strings;
|
||||
|
||||
struct section_table {
|
||||
uint32_t count;
|
||||
struct section_entry {
|
||||
uint32_t name;
|
||||
uint64_t offset;
|
||||
uint64_t size_on_disk;
|
||||
uint64_t size_in_memory;
|
||||
uint64_t flags;
|
||||
} sections[static count];
|
||||
} sections;
|
||||
|
||||
struct symbol_table {
|
||||
uint32_t count;
|
||||
struct symbol_entry {
|
||||
uint32_t name;
|
||||
uint8_t kind; // IMPORT(0) | EXPORT(1) | LOCAL(2)
|
||||
uint32_t section;
|
||||
uint64_t offset;
|
||||
} symbols[static count];
|
||||
} symbols;
|
||||
|
||||
struct relocation_table {
|
||||
uint32_t count;
|
||||
struct relocation_entry {
|
||||
uint32_t section;
|
||||
uint64_t offset;
|
||||
uint8_t size;
|
||||
uint32_t symbol;
|
||||
uint8_t kind; // ABSOLUTE(0) | RELATIVE(1)
|
||||
} relocations[static count];
|
||||
} relocations;
|
||||
};
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user