Hook up Tilde to the linker code

This commit is contained in:
gingerBill
2023-07-24 12:01:23 +01:00
parent bd81c6f5b4
commit b09cdc0f25
5 changed files with 55 additions and 44 deletions

View File

@@ -11,6 +11,39 @@ struct LinkerData {
gb_internal i32 system_exec_command_line_app(char const *name, char const *fmt, ...);
gb_internal void linker_data_init(LinkerData *ld, CheckerInfo *info, String const &init_fullpath) {
gbAllocator ha = heap_allocator();
array_init(&ld->output_object_paths, ha);
array_init(&ld->output_temp_paths, ha);
array_init(&ld->foreign_libraries, ha, 0, 1024);
ptr_set_init(&ld->foreign_libraries_set, 1024);
if (build_context.out_filepath.len == 0) {
ld->output_name = remove_directory_from_path(init_fullpath);
ld->output_name = remove_extension_from_path(ld->output_name);
ld->output_name = string_trim_whitespace(ld->output_name);
if (ld->output_name.len == 0) {
ld->output_name = info->init_scope->pkg->name;
}
ld->output_base = ld->output_name;
} else {
ld->output_name = build_context.out_filepath;
ld->output_name = string_trim_whitespace(ld->output_name);
if (ld->output_name.len == 0) {
ld->output_name = info->init_scope->pkg->name;
}
isize pos = string_extension_position(ld->output_name);
if (pos < 0) {
ld->output_base = ld->output_name;
} else {
ld->output_base = substring(ld->output_name, 0, pos);
}
}
ld->output_base = path_to_full_path(ha, ld->output_base);
}
gb_internal i32 linker_stage(LinkerData *gen) {
i32 result = 0;
Timings *timings = &global_timings;