reuse import table flags, and parameterize data directory count

This commit is contained in:
Nikita Smith
2025-04-28 13:57:22 -07:00
committed by Ryan Fleury
parent c56cfefe09
commit 01c905dbbd
2 changed files with 7 additions and 6 deletions
+5 -4
View File
@@ -1074,9 +1074,9 @@ lnk_apply_cmd_option_to_config(Arena *arena, LNK_Config *config, String8 cmd_nam
} else {
String8 value = value_strings.first->string;
if (str8_match_lit("unload", value, StringMatchFlag_CaseInsensitive)) {
config->flags |= LNK_ConfigFlag_DelayUnload;
config->flags |= LNK_ImportTableFlag_EmitUiat;
} else if (str8_match_lit("nobind", value, StringMatchFlag_CaseInsensitive)) {
config->flags &= ~LNK_ConfigFlag_DelayBind;
config->flags &= ~LNK_ImportTableFlag_EmitBiat;
} else {
lnk_error_cmd_switch(LNK_Error_Cmdl, obj_path, lib_path, cmd_switch, "unknown parameter \"%S\"", value);
}
@@ -1558,7 +1558,7 @@ lnk_apply_cmd_option_to_config(Arena *arena, LNK_Config *config, String8 cmd_nam
} break;
case LNK_CmdSwitch_Rad_DelayBind: {
lnk_cmd_switch_set_flag_64(obj_path, lib_path, cmd_switch, value_strings, &config->flags, LNK_ConfigFlag_DelayBind);
lnk_cmd_switch_set_flag_64(obj_path, lib_path, cmd_switch, value_strings, &config->flags, LNK_ImportTableFlag_EmitBiat);
} break;
case LNK_CmdSwitch_Rad_DoMerge: {
@@ -1918,6 +1918,7 @@ lnk_config_from_cmd_line(Arena *arena, String8List raw_cmd_line)
config->stack_commit = KB(1);
config->pdb_hash_type_names = LNK_TypeNameHashMode_None;
config->pdb_hash_type_name_length = 8;
config->data_dir_count = PE_DataDirectoryIndex_COUNT;
// process command line switches
for (LNK_CmdOption *cmd = cmd_line.first_option; cmd != 0; cmd = cmd->next) {
@@ -1973,7 +1974,7 @@ lnk_config_from_cmd_line(Arena *arena, String8List raw_cmd_line)
// don't emit bind table with /ALLOWBIND:NO
if (config->dll_characteristics & PE_DllCharacteristic_NO_BIND) {
config->flags &= ~LNK_ConfigFlag_DelayBind;
config->flags &= ~LNK_ImportTableFlag_EmitBiat;
}
// set flags for /OPT
+2 -2
View File
@@ -198,8 +198,6 @@ enum
LNK_ConfigFlag_Fixed = (1 << 0),
LNK_ConfigFlag_Merge = (1 << 1),
LNK_ConfigFlag_EnvLib = (1 << 2),
LNK_ConfigFlag_DelayUnload = (1 << 3),
LNK_ConfigFlag_DelayBind = (1 << 4),
LNK_ConfigFlag_CheckUnusedDelayLoadDll = (1 << 5),
LNK_ConfigFlag_NoTsAware = (1 << 6),
LNK_ConfigFlag_WriteImageChecksum = (1 << 8),
@@ -306,6 +304,7 @@ typedef struct LNK_Config
LNK_SwitchState opt_icf;
LNK_SwitchState opt_lbr;
U64 opt_iter_count;
LNK_ImportTableFlags import_table_flags;
LNK_GuardFlags guard_flags;
LNK_DebugInfoGuidType guid_type;
Guid guid;
@@ -374,6 +373,7 @@ typedef struct LNK_Config
U64 symbol_table_cap_internal;
U64 symbol_table_cap_weak;
U64 symbol_table_cap_lib;
U64 data_dir_count;
B32 build_imp_lib;
B32 build_exp;
LNK_SwitchState write_temp_files;