Compare commits
	
		
			1 Commits
		
	
	
		
			0d3881f680
			...
			object_for
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 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; | ||||
| }; | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user