Turnstone Operating System
Loading...
Searching...
No Matches
linker.64.c File Reference

Linker implementation for both efi and turnstone executables. More...

#include <linker.h>
#include <cpu.h>
#include <memory.h>
#include <memory/frame.h>
#include <memory/paging.h>
#include <systeminfo.h>
#include <logging.h>
#include <strings.h>
#include <efi.h>
#include <list.h>

Functions

 MODULE ("turnstone.lib.linker")
 
int8_t linker_link_module (linker_context_t *ctx, linker_module_t *module)
 
int8_t linker_efi_image_relocation_entry_cmp (const void *a, const void *b)
 
int8_t linker_efi_image_section_header_cmp (const void *a, const void *b)
 
buffer_tlinker_build_relocation_table_buffer (linker_context_t *ctx)
 
buffer_tlinker_build_metadata_buffer (linker_context_t *ctx)
 
int8_t linker_destroy_context (linker_context_t *ctx)
 
int8_t linker_build_symbols (linker_context_t *ctx, uint64_t module_id, uint64_t section_id, uint8_t section_type, uint64_t section_offset)
 
 _Static_assert (sizeof(linker_vm_plt0_entry_data)==0x80, "plt0 entry size mismatch")
 
 _Static_assert (sizeof(linker_plt_entry_data)==0x40, "plt entry size mismatch")
 
int8_t linker_build_relocations (linker_context_t *ctx, uint64_t section_id, uint8_t section_type, uint64_t section_offset, linker_module_t *module, boolean_t recursive)
 
int8_t linker_build_module (linker_context_t *ctx, uint64_t module_id, boolean_t recursive)
 
int8_t linker_calculate_program_size (linker_context_t *ctx)
 
int8_t linker_bind_linear_addresses (linker_context_t *ctx)
 
int64_t linker_get_section_count_without_relocations (linker_context_t *ctx)
 
int8_t linker_bind_got_entry_values (linker_context_t *ctx)
 
boolean_t linker_is_all_symbols_resolved (linker_context_t *ctx)
 
int8_t linker_link_program (linker_context_t *ctx)
 
buffer_tlinker_build_efi_image_relocations (linker_context_t *ctx)
 
buffer_tlinker_build_efi_image_section_headers_without_relocations (linker_context_t *ctx)
 
buffer_tlinker_build_efi (linker_context_t *ctx)
 
int8_t linker_dump_program_to_array (linker_context_t *ctx, linker_program_dump_type_t dump_type, uint8_t *array)
 
static int8_t linker_build_metadata_buffer_null_terminator (buffer_t *metadata_buffer, uint64_t count)
 

Variables

const char_t *const linker_section_type_names [LINKER_SECTION_TYPE_NR_SECTIONS]
 linker section type names More...
 
const uint8_t linker_vm_plt0_entry_data []
 
const uint8_t linker_plt_entry_data []
 
const uint8_t linker_program_header_trampoline_code []
 

Detailed Description

Linker implementation for both efi and turnstone executables.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Variable Documentation

◆ linker_plt_entry_data

const uint8_t linker_plt_entry_data[]
Initial value:
= {
0x41, 0x57,
0x41, 0x56,
0x49, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4c, 0x8d, 0x35, 0xeb, 0xff, 0xff, 0xff,
0x4d, 0x01, 0xf7,
0x49, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4f, 0x8b, 0x74, 0x3b, 0x08,
0x49, 0x0f, 0xba, 0xe6, 0x00,
0x73, 0x0b,
0x41, 0x5e,
0x4f, 0x8b, 0x1c, 0x3b,
0x41, 0x5f,
0x41, 0xff, 0xe3,
0xe9, 0x00, 0x00, 0x00, 0x00,
0x90,
0x90,
}

◆ linker_program_header_trampoline_code

const uint8_t linker_program_header_trampoline_code[]
Initial value:
= {
0x48, 0x8b, 0x57, 0x48,
0x48, 0x8b, 0x42, 0x40,
0x48, 0x03, 0x42, 0x48,
0x48, 0x83, 0xe8, 0x10,
0x48, 0x89, 0xc4,
0x48, 0x31, 0xed,
0x48, 0x8b, 0x82, 0xf0, 0x00, 0x00, 0x00,
0x48, 0x8b, 0x00,
0x0f, 0x22, 0xd8,
0x48, 0x8b, 0x42, 0x38,
0xff, 0xd0,
}

◆ linker_section_type_names

linker_section_type_names
Initial value:
= {
[LINKER_SECTION_TYPE_RODATARELOC] = ".rodatareloc",
}
@ LINKER_SECTION_TYPE_GOT_RELATIVE_RELOCATION_TABLE
got relative relocation table section
Definition: linker.h:32
@ LINKER_SECTION_TYPE_RODATARELOC
readonly relocation data section
Definition: linker.h:28
@ LINKER_SECTION_TYPE_TEXT
executable (text) section
Definition: linker.h:24
@ LINKER_SECTION_TYPE_RODATA
readonly data section
Definition: linker.h:27
@ LINKER_SECTION_TYPE_GOT
global offset table section
Definition: linker.h:33
@ LINKER_SECTION_TYPE_BSS
bss section
Definition: linker.h:29
@ LINKER_SECTION_TYPE_DATARELOC
read-write relocation data section
Definition: linker.h:26
@ LINKER_SECTION_TYPE_STACK
stack section
Definition: linker.h:34
@ LINKER_SECTION_TYPE_HEAP
heap section
Definition: linker.h:35
@ LINKER_SECTION_TYPE_PLT
procedure linkage table section
Definition: linker.h:30
@ LINKER_SECTION_TYPE_RELOCATION_TABLE
relocation table section
Definition: linker.h:31
@ LINKER_SECTION_TYPE_DATA
read-write data section
Definition: linker.h:25

linker section type names