diff options
| author | gingerBill <bill@gingerbill.org> | 2023-07-24 12:01:23 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-07-24 12:01:23 +0100 |
| commit | b09cdc0f256bca71ffcb5960c75127e8aaa55b87 (patch) | |
| tree | d578e7ac78aebbc572e2c97cbe1174425295e1d8 /src/linker.cpp | |
| parent | bd81c6f5b4bbcdb0c65cda5bedf1f3c5e0c0371e (diff) | |
Hook up Tilde to the linker code
Diffstat (limited to 'src/linker.cpp')
| -rw-r--r-- | src/linker.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/linker.cpp b/src/linker.cpp index dc6e072d1..c0fbf596f 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -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; |