mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-04 12:58:41 +00:00
instead of searching for manifest tool manually punt the job to CreateProcess
This commit is contained in:
@@ -324,7 +324,6 @@ lnk_merge_manifest_files(String8 mt_path, String8 out_name, String8List manifest
|
|||||||
// launch mt.exe with our command line
|
// launch mt.exe with our command line
|
||||||
OS_ProcessLaunchParams launch_opts = {0};
|
OS_ProcessLaunchParams launch_opts = {0};
|
||||||
launch_opts.cmd_line = cmd_line;
|
launch_opts.cmd_line = cmd_line;
|
||||||
launch_opts.path = str8_chop_last_slash(mt_path);
|
|
||||||
launch_opts.inherit_env = 1;
|
launch_opts.inherit_env = 1;
|
||||||
launch_opts.consoleless = 1;
|
launch_opts.consoleless = 1;
|
||||||
OS_Handle mt_handle = os_process_launch(&launch_opts);
|
OS_Handle mt_handle = os_process_launch(&launch_opts);
|
||||||
|
|||||||
+2
-25
@@ -136,7 +136,7 @@ read_only struct
|
|||||||
{ LNK_CmdSwitch_Rad_LargePages, "RAD_LARGE_PAGES", "[:NO]", "Disabled by default on Windows." },
|
{ LNK_CmdSwitch_Rad_LargePages, "RAD_LARGE_PAGES", "[:NO]", "Disabled by default on Windows." },
|
||||||
{ LNK_CmdSwitch_Rad_LinkVer, "RAD_LINK_VER", ":##,##", "" },
|
{ LNK_CmdSwitch_Rad_LinkVer, "RAD_LINK_VER", ":##,##", "" },
|
||||||
{ LNK_CmdSwitch_Rad_Log, "RAD_LOG", ":{ALL,INPUT_OBJ,INPUT_LIB,IO,LINK_STATS,TIMERS}", "" },
|
{ LNK_CmdSwitch_Rad_Log, "RAD_LOG", ":{ALL,INPUT_OBJ,INPUT_LIB,IO,LINK_STATS,TIMERS}", "" },
|
||||||
{ LNK_CmdSwitch_Rad_MtPath, "RAD_MT_PATH", ":EXEPATH", "Path to manifest tool." },
|
{ LNK_CmdSwitch_Rad_MtPath, "RAD_MT_PATH", ":EXEPATH", "Exe path to manifest tool, default: " LNK_MANIFEST_MERGE_TOOL_NAME },
|
||||||
{ LNK_CmdSwitch_Rad_OsVer, "RAD_OS_VER", ":##,##", "" },
|
{ LNK_CmdSwitch_Rad_OsVer, "RAD_OS_VER", ":##,##", "" },
|
||||||
{ LNK_CmdSwitch_Rad_PageSize, "RAD_PAGE_SIZE", ":#", "Must be power of two." },
|
{ LNK_CmdSwitch_Rad_PageSize, "RAD_PAGE_SIZE", ":#", "Must be power of two." },
|
||||||
{ LNK_CmdSwitch_Rad_PathStyle, "RAD_PATH_STYLE", ":{WindowsAbsolute|UnixAbsolute}", "" },
|
{ LNK_CmdSwitch_Rad_PathStyle, "RAD_PATH_STYLE", ":{WindowsAbsolute|UnixAbsolute}", "" },
|
||||||
@@ -491,28 +491,6 @@ lnk_get_min_subsystem_version(PE_WindowsSubsystem subsystem, COFF_MachineType ma
|
|||||||
return ver;
|
return ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
|
||||||
lnk_get_mt_path(Arena *arena)
|
|
||||||
{
|
|
||||||
#if OS_WINDOWS
|
|
||||||
#undef OS_WINDOWS
|
|
||||||
#pragma comment(lib, "shlwapi.lib")
|
|
||||||
#include <shlwapi.h>
|
|
||||||
local_persist wchar_t raw_mt_path[MAX_PATH*2] = L"mt.exe";
|
|
||||||
PathFindOnPathW(&raw_mt_path[0], 0);
|
|
||||||
|
|
||||||
String16 mt_path_16 = str16_cstring_capped(&raw_mt_path[0], raw_mt_path + sizeof(raw_mt_path));
|
|
||||||
String8 mt_path = str8_from_16(arena, mt_path_16);
|
|
||||||
|
|
||||||
mt_path = path_convert_slashes(arena, mt_path, PathStyle_WindowsAbsolute);
|
|
||||||
#undef OS_WINDOWS
|
|
||||||
#define OS_WINDOWS 1
|
|
||||||
#else
|
|
||||||
String8 mt_path = str8_lit("llvm-mt.exe");
|
|
||||||
#endif
|
|
||||||
return mt_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal B32
|
internal B32
|
||||||
lnk_do_debug_info(LNK_Config *config)
|
lnk_do_debug_info(LNK_Config *config)
|
||||||
{
|
{
|
||||||
@@ -936,8 +914,7 @@ lnk_config_from_cmd_line(Arena *arena, String8List raw_cmd_line)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!lnk_cmd_line_has_switch(cmd_line, LNK_CmdSwitch_Rad_MtPath)) {
|
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", LNK_MANIFEST_MERGE_TOOL_NAME);
|
||||||
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);
|
LNK_Config *config = push_array(arena, LNK_Config, 1);
|
||||||
|
|||||||
@@ -235,6 +235,14 @@ typedef enum
|
|||||||
LNK_TypeNameHashMode_Full,
|
LNK_TypeNameHashMode_Full,
|
||||||
} LNK_TypeNameHashMode;
|
} LNK_TypeNameHashMode;
|
||||||
|
|
||||||
|
#if OS_WINDOWS
|
||||||
|
# define LNK_MANIFEST_MERGE_TOOL_NAME "mt.exe"
|
||||||
|
#elif OS_LINUX || OS_MAC
|
||||||
|
# define LNK_MANIFEST_MERGE_TOOL_NAME "llvm-mt"
|
||||||
|
#else
|
||||||
|
# error
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct LNK_Config
|
typedef struct LNK_Config
|
||||||
{
|
{
|
||||||
LNK_ConfigFlags flags;
|
LNK_ConfigFlags flags;
|
||||||
@@ -473,7 +481,6 @@ internal void lnk_error_cmd_switch_invalid_param(LNK_ErrorCode code, LNK_CmdSwit
|
|||||||
internal U64 lnk_get_base_addr(LNK_Config *config);
|
internal U64 lnk_get_base_addr(LNK_Config *config);
|
||||||
internal Version lnk_get_default_subsystem_version(PE_WindowsSubsystem subsystem, COFF_MachineType machine);
|
internal Version lnk_get_default_subsystem_version(PE_WindowsSubsystem subsystem, COFF_MachineType machine);
|
||||||
internal Version lnk_get_min_subsystem_version(PE_WindowsSubsystem subsystem, COFF_MachineType machine);
|
internal Version lnk_get_min_subsystem_version(PE_WindowsSubsystem subsystem, COFF_MachineType machine);
|
||||||
internal String8 lnk_get_mt_path(Arena *arena);
|
|
||||||
|
|
||||||
internal B32 lnk_do_debug_info(LNK_Config *config);
|
internal B32 lnk_do_debug_info(LNK_Config *config);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user