From b9886dfcc79fd40c077feab2f81aa3b4d8ebbc6f Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 14 Nov 2024 17:04:45 +0000 Subject: Add `-linker:` to replace `-lld` and `-radlink` --- src/build_settings.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/build_settings.cpp') diff --git a/src/build_settings.cpp b/src/build_settings.cpp index d62d6598c..4177cc2fa 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -344,6 +344,22 @@ struct BuildCacheData { bool copy_already_done; }; + +enum LinkerChoice : i32 { + Linker_Invalid = -1, + Linker_Default = 0, + Linker_lld, + Linker_radlink, + + Linker_COUNT, +}; + +String linker_choices[Linker_COUNT] = { + str_lit("default"), + str_lit("lld"), + str_lit("radlink"), +}; + // This stores the information for the specify architecture of this build struct BuildContext { // Constants @@ -419,13 +435,13 @@ struct BuildContext { bool no_rpath; bool no_entry_point; bool no_thread_local; - bool use_lld; - bool use_radlink; bool cross_compiling; bool different_os; bool keep_object_files; bool disallow_do; + LinkerChoice linker_choice; + StringSet custom_attributes; bool strict_style; @@ -1872,7 +1888,7 @@ gb_internal bool init_build_paths(String init_filename) { return false; } - if (!build_context.use_lld && !build_context.use_radlink && find_result.vs_exe_path.len == 0) { + if (build_context.linker_choice != Linker_Default && find_result.vs_exe_path.len == 0) { gb_printf_err("link.exe not found.\n"); return false; } -- cgit v1.2.3