Skip to content

Commit

Permalink
implemented /noimplib /noexp
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaSmith057 committed Oct 22, 2024
1 parent dcffefd commit 9ec7fb6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/linker/lnk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3253,7 +3253,7 @@ l.count += 1; \
B32 build_win32_header = 1;
B32 patch_relocs = 1;
B32 sort_exception_info = 1;
B32 build_imp_lib = 1;
B32 build_imp_lib = config->build_imp_lib;
LNK_ObjList obj_list = {0};
LNK_LibList lib_index[LNK_InputSource_Count] = {0};
String8 image_data = str8_zero();
Expand Down
23 changes: 17 additions & 6 deletions src/linker/lnk_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ read_only struct
{ LNK_CmdSwitch_NotImplemented, "NOASSEMBLY", "", "" },
{ LNK_CmdSwitch_NoDefaultLib, "NODEFAULTLIB", ":LIBNAME", "" },
{ LNK_CmdSwitch_NotImplemented, "NOENTRY", "", "" },
{ LNK_CmdSwitch_NotImplemented, "NOEXP", "", "" },
{ LNK_CmdSwitch_NotImplemented, "NOIMPLIB", "", "" },
{ LNK_CmdSwitch_NoExp, "NOEXP", "", ".exp is not supported." },
{ LNK_CmdSwitch_NoImpLib, "NOIMPLIB", "", "" },
{ LNK_CmdSwitch_NoLogo, "NOLOGO", "", "" },
{ LNK_CmdSwitch_NxCompat, "NXCOMPAT", "[:NO]", "" },
{ LNK_CmdSwitch_Opt, "OPT", "", "" },
Expand Down Expand Up @@ -911,18 +911,21 @@ lnk_config_from_cmd_line(Arena *arena, String8List raw_cmd_line)

#if BUILD_DEBUG
lnk_cmd_line_push_optionf(scratch.arena, &cmd_line, LNK_CmdSwitch_Rad_Log, "debug");
lnk_cmd_line_push_optionf(scratch.arena, &cmd_line, LNK_CmdSwitch_Rad_Log, "io_write");
#else
lnk_cmd_line_push_optionf(scratch.arena, &cmd_line, LNK_CmdSwitch_Rad_SuppressError, "37");
lnk_cmd_line_push_optionf(scratch.arena, &cmd_line, LNK_CmdSwitch_Rad_SuppressError, "%u", LNK_Error_InvalidTypeIndex);
#endif

if (!lnk_cmd_line_has_switch(cmd_line, LNK_CmdSwitch_Rad_MtPath)) {
String8 mt_path = lnk_get_mt_path(scratch.arena);
lnk_cmd_line_push_option_if_not_presentf(scratch.arena, &cmd_line, LNK_CmdSwitch_Rad_MtPath, "%S", mt_path);
}

LNK_Config *config = push_array(arena, LNK_Config, 1);
config->raw_cmd_line = raw_cmd_line;
config->work_dir = os_get_current_path(scratch.arena);
LNK_Config *config = push_array(arena, LNK_Config, 1);
config->raw_cmd_line = raw_cmd_line;
config->work_dir = os_get_current_path(scratch.arena);
config->build_imp_lib = 1;
config->build_exp = 1;

// process command line switches
for (LNK_CmdOption *cmd = cmd_line.first_option; cmd != 0; cmd = cmd->next) {
Expand Down Expand Up @@ -1297,6 +1300,14 @@ lnk_config_from_cmd_line(Arena *arena, String8List raw_cmd_line)
str8_list_concat_in_place(&config->disallow_lib_list, &no_default_lib_list);
} break;

case LNK_CmdSwitch_NoExp: {
config->build_exp = 0;
} break;

case LNK_CmdSwitch_NoImpLib: {
config->build_imp_lib = 0;
} break;

case LNK_CmdSwitch_NoLogo: {
// we don't print logo
} break;
Expand Down
6 changes: 4 additions & 2 deletions src/linker/lnk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ typedef enum
LNK_CmdSwitch_ManifestUac,
LNK_CmdSwitch_Natvis,
LNK_CmdSwitch_NoDefaultLib,
LNK_CmdSwitch_NoExp,
LNK_CmdSwitch_NoImpLib,
LNK_CmdSwitch_NoLogo,
LNK_CmdSwitch_NxCompat,
LNK_CmdSwitch_Opt,
Expand Down Expand Up @@ -96,8 +98,6 @@ typedef enum
LNK_CmdSwitch_Midl,
LNK_CmdSwitch_NoAssembly,
LNK_CmdSwitch_NoEntry,
LNK_CmdSwitch_NoExp,
LNK_CmdSwitch_NoImpLib,
LNK_CmdSwitch_Order,
LNK_CmdSwitch_PdbStripped,
LNK_CmdSwitch_Profile,
Expand Down Expand Up @@ -290,6 +290,8 @@ typedef struct LNK_Config
U64 symbol_table_cap_internal;
U64 symbol_table_cap_weak;
U64 symbol_table_cap_lib;
B32 build_imp_lib;
B32 build_exp;
} LNK_Config;

typedef enum
Expand Down

0 comments on commit 9ec7fb6

Please sign in to comment.