mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-22 19:54:59 -07:00
pipe obj directives through config path
This commit is contained in:
+17
-2
@@ -2895,7 +2895,7 @@ lnk_init_merge_directive_list(Arena *arena, LNK_ObjList obj_list)
|
||||
// collect merge directives from objs
|
||||
for (LNK_ObjNode *obj_node = obj_list.first; obj_node != 0; obj_node = obj_node->next) {
|
||||
LNK_Obj *obj = &obj_node->data;
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_Directive_Merge].first; dir != 0; dir = dir->next) {
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_CmdSwitch_Merge].first; dir != 0; dir = dir->next) {
|
||||
for (String8Node *value_node = dir->value_list.first; value_node != 0; value_node = value_node->next) {
|
||||
LNK_MergeDirective merge_dir;
|
||||
if (lnk_parse_merge_directive(value_node->string, &merge_dir)) { lnk_merge_directive_list_push(arena, &result, merge_dir);
|
||||
@@ -3569,11 +3569,26 @@ lnk_run(int argc, char **argv)
|
||||
ProfBegin("Collect Directives");
|
||||
for (U64 i = 0; i < obj_node_arr.count; ++i) {
|
||||
LNK_Obj *obj = &obj_node_arr.v[i].data;
|
||||
|
||||
str8_list_concat_in_place(&include_symbol_list, &obj->include_symbol_list);
|
||||
|
||||
lnk_alt_name_list_concat_in_place(&alt_name_list, &obj->alt_name_list);
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_Directive_DisallowLib].first; dir != 0; dir = dir->next) {
|
||||
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_CmdSwitch_DisallowLib].first; dir != 0; dir = dir->next) {
|
||||
str8_list_concat_in_place(&input_disallow_lib_list, &dir->value_list);
|
||||
}
|
||||
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_CmdSwitch_Entry].first; dir != 0; dir = dir->next) {
|
||||
lnk_apply_cmd_option_to_config(scratch.arena, config, dir->id, dir->value_list, obj->path, obj->lib_path);
|
||||
}
|
||||
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_CmdSwitch_SubSystem].first; dir != 0; dir = dir->next) {
|
||||
lnk_apply_cmd_option_to_config(scratch.arena, config, dir->id, dir->value_list, obj->path, obj->lib_path);
|
||||
}
|
||||
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_CmdSwitch_Stack].first; dir != 0; dir = dir->next) {
|
||||
lnk_apply_cmd_option_to_config(scratch.arena, config, dir->id, dir->value_list, obj->path, obj->lib_path);
|
||||
}
|
||||
}
|
||||
ProfEnd();
|
||||
|
||||
|
||||
+867
-842
File diff suppressed because it is too large
Load Diff
+24
-17
@@ -40,6 +40,7 @@ typedef enum
|
||||
LNK_CmdSwitch_ManifestFile,
|
||||
LNK_CmdSwitch_ManifestInput,
|
||||
LNK_CmdSwitch_ManifestUac,
|
||||
LNK_CmdSwitch_Merge,
|
||||
LNK_CmdSwitch_Natvis,
|
||||
LNK_CmdSwitch_NoDefaultLib,
|
||||
LNK_CmdSwitch_NoExp,
|
||||
@@ -73,18 +74,23 @@ typedef enum
|
||||
LNK_CmdSwitch_DependentLoadFlag,
|
||||
LNK_CmdSwitch_Driver,
|
||||
LNK_CmdSwitch_DisallowLib,
|
||||
LNK_CmdSwitch_EditAndContinue,
|
||||
LNK_CmdSwitch_EmitVolatileMetadata,
|
||||
LNK_CmdSwitch_ErrorReport,
|
||||
LNK_CmdSwitch_Export,
|
||||
LNK_CmdSwitch_ExportAdmin,
|
||||
LNK_CmdSwitch_FastGenProfile,
|
||||
LNK_CmdSwitch_FailIfMismatch,
|
||||
LNK_CmdSwitch_Force,
|
||||
LNK_CmdSwitch_Guard,
|
||||
LNK_CmdSwitch_GuardSym,
|
||||
LNK_CmdSwitch_GenProfile,
|
||||
LNK_CmdSwitch_IdlOut,
|
||||
LNK_CmdSwitch_IgnoreIdl,
|
||||
LNK_CmdSwitch_Ilk,
|
||||
LNK_CmdSwitch_IntegrityCheck,
|
||||
LNK_CmdSwitch_InferAsanLibs,
|
||||
LNK_CmdSwitch_InferAsanLibsNo,
|
||||
LNK_CmdSwitch_Kernel,
|
||||
LNK_CmdSwitch_KeyContainer,
|
||||
LNK_CmdSwitch_KeyFile,
|
||||
@@ -94,7 +100,6 @@ typedef enum
|
||||
LNK_CmdSwitch_LtcgOut,
|
||||
LNK_CmdSwitch_Map,
|
||||
LNK_CmdSwitch_MapInfo,
|
||||
LNK_CmdSwitch_Merge,
|
||||
LNK_CmdSwitch_Midl,
|
||||
LNK_CmdSwitch_NoAssembly,
|
||||
LNK_CmdSwitch_NoEntry,
|
||||
@@ -108,6 +113,7 @@ typedef enum
|
||||
LNK_CmdSwitch_Stub,
|
||||
LNK_CmdSwitch_SwapRun,
|
||||
LNK_CmdSwitch_TlbId,
|
||||
LNK_CmdSwitch_ThrowingNew,
|
||||
LNK_CmdSwitch_UserProfile,
|
||||
LNK_CmdSwitch_Verbose,
|
||||
LNK_CmdSwitch_Version,
|
||||
@@ -281,7 +287,6 @@ typedef struct LNK_Config
|
||||
Version subsystem_ver;
|
||||
PE_ImageFileCharacteristics file_characteristics;
|
||||
PE_DllCharacteristics dll_characteristics;
|
||||
String8 user_entry_point_name;
|
||||
String8 entry_point_name;
|
||||
String8List lib_dir_list;
|
||||
PathStyle path_style;
|
||||
@@ -471,9 +476,9 @@ internal B32 lnk_cmd_line_has_switch(LNK_CmdLine cmd_line, LNK_CmdSw
|
||||
////////////////////////////////
|
||||
// Errors
|
||||
|
||||
internal void lnk_error_cmd_switch(LNK_ErrorCode code, LNK_CmdSwitchType cmd_switch, char *fmt, ...);
|
||||
internal void lnk_error_cmd_switch_invalid_param_count(LNK_ErrorCode code, LNK_CmdSwitchType cmd_switch);
|
||||
internal void lnk_error_cmd_switch_invalid_param(LNK_ErrorCode code, LNK_CmdSwitchType cmd_switch, String8 param);
|
||||
internal void lnk_error_cmd_switch(LNK_ErrorCode code, String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, char *fmt, ...);
|
||||
internal void lnk_error_cmd_switch_invalid_param_count(LNK_ErrorCode code, String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch);
|
||||
internal void lnk_error_cmd_switch_invalid_param(LNK_ErrorCode code, String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8 param);
|
||||
|
||||
////////////////////////////////
|
||||
// Getters
|
||||
@@ -488,24 +493,26 @@ internal B32 lnk_do_debug_info(LNK_Config *config);
|
||||
////////////////////////////////
|
||||
// Specialized Parsers
|
||||
|
||||
internal B32 lnk_cmd_switch_parse_version(String8List value_strings, LNK_CmdSwitchType cmd_switch, Version *ver_out);
|
||||
internal B32 lnk_cmd_switch_parse_tuple(String8List value_strings, LNK_CmdSwitchType cmd_switch, Rng1U64 *tuple_out);
|
||||
internal B32 lnk_cmd_switch_parse_u64(String8List value_strings, LNK_CmdSwitchType cmd_switch, U64 *value_out, LNK_ParseU64Flags flags);
|
||||
internal B32 lnk_cmd_switch_parse_u32(String8List value_strings, LNK_CmdSwitchType cmd_switch, U32 *value_out, LNK_ParseU64Flags flags);
|
||||
internal B32 lnk_cmd_switch_parse_flag(String8List value_strings, LNK_CmdSwitchType cmd_switch, LNK_SwitchState *value_out);
|
||||
internal void lnk_cmd_switch_set_flag_inv_16(String8List value_strings, LNK_CmdSwitchType cmd_switch, U16 *flags, U16 bits);
|
||||
internal void lnk_cmd_switch_set_flag_inv_64(String8List value_strings, LNK_CmdSwitchType cmd_switch, U64 *flags, U64 bits);
|
||||
internal void lnk_cmd_switch_set_flag_16(String8List value_strings, LNK_CmdSwitchType cmd_switch, U16 *flags, U16 bits);
|
||||
internal void lnk_cmd_switch_set_flag_32(String8List value_strings, LNK_CmdSwitchType cmd_switch, U32 *flags, U32 bits);
|
||||
internal void lnk_cmd_switch_set_flag_64(String8List value_strings, LNK_CmdSwitchType cmd_switch, U64 *flags, U64 bits);
|
||||
internal B32 lnk_cmd_switch_parse_string(String8List value_strings, LNK_CmdSwitchType cmd_switch, String8 *string_out);
|
||||
internal void lnk_cmd_switch_parse_string_copy(Arena *arena, String8List value_strings, LNK_CmdSwitchType cmd_switch, String8 *string_out);
|
||||
internal B32 lnk_cmd_switch_parse_version(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, Version *ver_out);
|
||||
internal B32 lnk_cmd_switch_parse_tuple(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, Rng1U64 *tuple_out);
|
||||
internal B32 lnk_cmd_switch_parse_u64(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, U64 *value_out, LNK_ParseU64Flags flags);
|
||||
internal B32 lnk_cmd_switch_parse_u32(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, U32 *value_out, LNK_ParseU64Flags flags);
|
||||
internal B32 lnk_cmd_switch_parse_flag(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, LNK_SwitchState *value_out);
|
||||
internal void lnk_cmd_switch_set_flag_inv_16(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, U16 *flags, U16 bits);
|
||||
internal void lnk_cmd_switch_set_flag_inv_64(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, U64 *flags, U64 bits);
|
||||
internal void lnk_cmd_switch_set_flag_16(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, U16 *flags, U16 bits);
|
||||
internal void lnk_cmd_switch_set_flag_32(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, U32 *flags, U32 bits);
|
||||
internal void lnk_cmd_switch_set_flag_64(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, U64 *flags, U64 bits);
|
||||
internal B32 lnk_cmd_switch_parse_string(String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, String8 *string_out);
|
||||
internal void lnk_cmd_switch_parse_string_copy(Arena *arena, String8 obj_path, String8 lib_path, LNK_CmdSwitchType cmd_switch, String8List value_strings, String8 *string_out);
|
||||
|
||||
internal B32 lnk_parse_alt_name_directive(Arena *arena, String8 input, LNK_AltNameList *list_out);
|
||||
internal String8 * lnk_parse_alt_name_directive_list(Arena *arena, String8List list, LNK_AltNameList *list_out);
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
internal void lnk_apply_cmd_option_to_config(Arena *arena, LNK_Config *config, String8 name, String8List value_list, String8 obj_path, String8 lib_path);
|
||||
|
||||
internal LNK_Config * lnk_config_from_raw_cmd_line(Arena *arena, String8List raw_cmd_line);
|
||||
internal LNK_Config * lnk_build_config(Arena *arena, int argc, char **argv);
|
||||
|
||||
|
||||
+50
-44
@@ -23,69 +23,76 @@ lnk_merge_directive_list_push(Arena *arena, LNK_MergeDirectiveList *list, LNK_Me
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
internal B32
|
||||
lnk_is_directive_legal(LNK_CmdSwitchType type)
|
||||
{
|
||||
static B32 init_table = 1;
|
||||
static B8 is_legal[LNK_CmdSwitch_Count];
|
||||
if (init_table) {
|
||||
init_table = 0;
|
||||
is_legal[LNK_CmdSwitch_AlternateName] = 1;
|
||||
is_legal[LNK_CmdSwitch_DefaultLib] = 1;
|
||||
is_legal[LNK_CmdSwitch_DisallowLib] = 1;
|
||||
is_legal[LNK_CmdSwitch_EditAndContinue] = 1;
|
||||
is_legal[LNK_CmdSwitch_Entry] = 1;
|
||||
is_legal[LNK_CmdSwitch_Export] = 1;
|
||||
is_legal[LNK_CmdSwitch_FailIfMismatch] = 1;
|
||||
is_legal[LNK_CmdSwitch_GuardSym] = 1;
|
||||
is_legal[LNK_CmdSwitch_Include] = 1;
|
||||
is_legal[LNK_CmdSwitch_InferAsanLibs] = 1;
|
||||
is_legal[LNK_CmdSwitch_InferAsanLibsNo] = 1;
|
||||
is_legal[LNK_CmdSwitch_ManifestDependency] = 1;
|
||||
is_legal[LNK_CmdSwitch_Merge] = 1;
|
||||
is_legal[LNK_CmdSwitch_NoDefaultLib] = 1;
|
||||
is_legal[LNK_CmdSwitch_Release] = 1;
|
||||
is_legal[LNK_CmdSwitch_Section] = 1;
|
||||
is_legal[LNK_CmdSwitch_Stack] = 1;
|
||||
is_legal[LNK_CmdSwitch_SubSystem] = 1;
|
||||
is_legal[LNK_CmdSwitch_ThrowingNew] = 1;
|
||||
}
|
||||
return is_legal[type];
|
||||
}
|
||||
|
||||
internal void
|
||||
lnk_parse_directives(Arena *arena, LNK_DirectiveInfo *directive_info, String8 buffer, String8 obj_path)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
String8 unparsed_directives = buffer;
|
||||
String8 to_parse;
|
||||
{
|
||||
static const U8 BOM_SIG[] = { 0xEF, 0xBB, 0xBF };
|
||||
B32 is_bom = MemoryMatch(buffer.str, &BOM_SIG[0], sizeof(BOM_SIG));
|
||||
if (is_bom) {
|
||||
unparsed_directives = str8_zero();
|
||||
local_persist const U8 bom_sig[] = { 0xEF, 0xBB, 0xBF };
|
||||
local_persist const U8 ascii_sig[] = { 0x20, 0x20, 0x20 };
|
||||
if (MemoryMatch(buffer.str, &bom_sig[0], sizeof(bom_sig))) {
|
||||
to_parse = str8_zero();
|
||||
lnk_not_implemented("TODO: support for BOM encoding");
|
||||
}
|
||||
static const U8 ASCII_SIG[] = { 0x20, 0x20, 0x20 };
|
||||
B32 is_ascii = MemoryMatch(buffer.str, &ASCII_SIG[0], sizeof(ASCII_SIG));
|
||||
if (is_ascii) {
|
||||
unparsed_directives = str8_skip(buffer, sizeof(ASCII_SIG));
|
||||
} else if (MemoryMatch(buffer.str, &ascii_sig[0], sizeof(ascii_sig))) {
|
||||
to_parse = str8_skip(buffer, sizeof(ascii_sig));
|
||||
} else {
|
||||
to_parse = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
String8List arg_list = lnk_arg_list_parse_windows_rules(scratch.arena, unparsed_directives);
|
||||
String8List arg_list = lnk_arg_list_parse_windows_rules(scratch.arena, to_parse);
|
||||
LNK_CmdLine cmd_line = lnk_cmd_line_parse_windows_rules(scratch.arena, arg_list);
|
||||
|
||||
for (LNK_CmdOption *opt = cmd_line.first_option; opt != 0; opt = opt->next) {
|
||||
static struct {
|
||||
LNK_DirectiveKind kind;
|
||||
String8 name;
|
||||
} directive_table[LNK_Directive_Count] = {
|
||||
{ LNK_Directive_Null, str8_lit_comp("") },
|
||||
{ LNK_Directive_DefaultLib, str8_lit_comp("defaultlib") },
|
||||
{ LNK_Directive_Export, str8_lit_comp("export" ) },
|
||||
{ LNK_Directive_Include, str8_lit_comp("include") },
|
||||
{ LNK_Directive_ManifestDependency, str8_lit_comp("manifestdependency") },
|
||||
{ LNK_Directive_Merge, str8_lit_comp("merge") },
|
||||
{ LNK_Directive_Section, str8_lit_comp("section") },
|
||||
{ LNK_Directive_AlternateName, str8_lit_comp("alternatename") },
|
||||
{ LNK_Directive_GuardSym, str8_lit_comp("guardsym") },
|
||||
{ LNK_Directive_DisallowLib, str8_lit_comp("disallowlib") },
|
||||
{ LNK_Directive_FailIfMismatch, str8_lit_comp("failifmismatch") },
|
||||
{ LNK_Directive_EditAndContinue, str8_lit_comp("editandcontinue") },
|
||||
{ LNK_Directive_ThrowingNew, str8_lit_comp("throwingnew") },
|
||||
};
|
||||
LNK_CmdSwitchType type = lnk_cmd_switch_type_from_string(opt->string);
|
||||
|
||||
LNK_DirectiveKind kind = LNK_Directive_Null;
|
||||
for (U64 i = 0; i < ArrayCount(directive_table); ++i) {
|
||||
if (str8_match(directive_table[i].name, opt->string, StringMatchFlag_CaseInsensitive)) {
|
||||
kind = directive_table[i].kind;
|
||||
if (kind == LNK_Directive_Merge) {
|
||||
String8 v = str8_list_join(scratch.arena, &opt->value_strings, &(StringJoin){ .sep = str8_lit_comp(" ")});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (kind == LNK_Directive_Null) {
|
||||
if (type == LNK_CmdSwitch_Null) {
|
||||
lnk_error(LNK_Warning_UnknownDirective, "%S: unknown directive \"%S\"", obj_path, opt->string);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!lnk_is_directive_legal(type)) {
|
||||
lnk_error(LNK_Warning_IllegalDirective, "%S: illegal directive \"%S\"", obj_path, opt->string);
|
||||
continue;
|
||||
}
|
||||
|
||||
LNK_Directive *directive = push_array_no_zero(arena, LNK_Directive, 1);
|
||||
directive->next = 0;
|
||||
directive->id = push_str8_copy(arena, opt->string);
|
||||
directive->value_list = str8_list_copy(arena, &opt->value_strings);
|
||||
|
||||
LNK_DirectiveList *directive_list = &directive_info->v[kind];
|
||||
|
||||
LNK_DirectiveList *directive_list = &directive_info->v[type];
|
||||
SLLQueuePush(directive_list->first, directive_list->last, directive);
|
||||
++directive_list->count;
|
||||
}
|
||||
@@ -110,7 +117,6 @@ lnk_parse_default_lib_directive(Arena *arena, LNK_DirectiveList *dir_list)
|
||||
} else {
|
||||
lib_path = push_str8_copy(arena, lib_path);
|
||||
}
|
||||
|
||||
|
||||
str8_list_push(arena, &default_libs, lib_path);
|
||||
}
|
||||
|
||||
@@ -51,27 +51,9 @@ typedef struct LNK_MergeDirectiveList
|
||||
LNK_MergeDirectiveNode *last;
|
||||
} LNK_MergeDirectiveList;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LNK_Directive_Null,
|
||||
LNK_Directive_DefaultLib,
|
||||
LNK_Directive_Export,
|
||||
LNK_Directive_Include,
|
||||
LNK_Directive_ManifestDependency,
|
||||
LNK_Directive_Merge,
|
||||
LNK_Directive_Section,
|
||||
LNK_Directive_AlternateName,
|
||||
LNK_Directive_GuardSym,
|
||||
LNK_Directive_DisallowLib,
|
||||
LNK_Directive_FailIfMismatch,
|
||||
LNK_Directive_EditAndContinue,
|
||||
LNK_Directive_ThrowingNew,
|
||||
LNK_Directive_Count
|
||||
} LNK_DirectiveKind;
|
||||
|
||||
typedef struct LNK_DirectiveInfo
|
||||
{
|
||||
LNK_DirectiveList v[LNK_Directive_Count];
|
||||
LNK_DirectiveList v[LNK_CmdSwitch_Count];
|
||||
} LNK_DirectiveInfo;
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -67,6 +67,31 @@ lnk_error(LNK_ErrorCode code, char *fmt, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
internal void
|
||||
lnk_error_with_loc_fv(LNK_ErrorCode code, String8 obj_path, String8 lib_path, char *fmt, va_list args)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 text = push_str8fv(scratch.arena, fmt, args);
|
||||
if (obj_path.size) {
|
||||
if (lib_path.size) {
|
||||
lnk_error(code, "%S(%S): %S", lib_path, obj_path, text);
|
||||
} else {
|
||||
lnk_error(code, "%S: %S", obj_path, text);
|
||||
}
|
||||
} else {
|
||||
lnk_error(code, "%S", text);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal void
|
||||
lnk_error_with_loc(LNK_ErrorCode code, String8 obj_path, String8 lib_path, char *fmt, ...)
|
||||
{
|
||||
va_list args; va_start(args, fmt);
|
||||
lnk_error_with_loc_fv(code, obj_path, lib_path, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
internal void
|
||||
lnk_supplement_error(char *fmt, ...)
|
||||
{
|
||||
|
||||
@@ -74,6 +74,7 @@ typedef enum
|
||||
LNK_Warning_SectionFlagsConflict,
|
||||
LNK_Warning_Subsystem,
|
||||
LNK_Warning_UnknownDirective,
|
||||
LNK_Warning_IllegalDirective,
|
||||
LNK_Warning_UnresolvedComdat,
|
||||
LNK_Warning_UnusedDelayLoadDll,
|
||||
LNK_Warning_LongSectionName,
|
||||
@@ -110,6 +111,7 @@ typedef enum
|
||||
internal void lnk_init_error_handler(void);
|
||||
internal void lnk_errorfv(LNK_ErrorCode code, char *fmt, va_list args);
|
||||
internal void lnk_error(LNK_ErrorCode code, char *fmt, ...);
|
||||
internal void lnk_error_with_loc(LNK_ErrorCode code, String8 obj_path, String8 lib_path, char *fmt, ...);
|
||||
internal void lnk_supplement_error(char *fmt, ...);
|
||||
internal void lnk_supplement_error_list(String8List list);
|
||||
internal void lnk_suppress_error(LNK_ErrorCode code);
|
||||
|
||||
+7
-17
@@ -6,19 +6,9 @@
|
||||
internal void
|
||||
lnk_error_obj(LNK_ErrorCode code, LNK_Obj *obj, char *fmt, ...)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
String8 text = push_str8fv(scratch.arena, fmt, args);
|
||||
|
||||
if (obj->lib_path.size) {
|
||||
lnk_error(code, "%S(%S): %S", obj->lib_path, obj->path, text);
|
||||
} else {
|
||||
lnk_error(code, "%S: %S", obj->path, text);
|
||||
}
|
||||
|
||||
va_list args; va_start(args, fmt);
|
||||
lnk_error_with_loc_fv(code, obj->path, obj->lib_path, fmt, args);
|
||||
va_end(args);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -230,7 +220,7 @@ THREAD_POOL_TASK_FUNC(lnk_default_lib_collector)
|
||||
String8List *result = &task->out_arr[task_id];
|
||||
for (U64 obj_idx = range.min; obj_idx < range.max; obj_idx += 1) {
|
||||
LNK_Obj *obj = &task->in_arr.v[obj_idx].data;
|
||||
String8List list = lnk_parse_default_lib_directive(arena, &obj->directive_info.v[LNK_Directive_DefaultLib]);
|
||||
String8List list = lnk_parse_default_lib_directive(arena, &obj->directive_info.v[LNK_CmdSwitch_DefaultLib]);
|
||||
str8_list_concat_in_place(result, &list);
|
||||
}
|
||||
}
|
||||
@@ -264,7 +254,7 @@ THREAD_POOL_TASK_FUNC(lnk_manifest_dependency_collector)
|
||||
|
||||
for (; obj_ptr < obj_opl; obj_ptr += 1) {
|
||||
LNK_Obj *obj = &obj_ptr->data;
|
||||
LNK_DirectiveList *dirs = &obj->directive_info.v[LNK_Directive_ManifestDependency];
|
||||
LNK_DirectiveList *dirs = &obj->directive_info.v[LNK_CmdSwitch_ManifestDependency];
|
||||
for (LNK_Directive *dir = dirs->first; dir != 0; dir = dir->next) {
|
||||
String8List dep = str8_list_copy(arena, &dir->value_list);
|
||||
str8_list_concat_in_place(list, &dep);
|
||||
@@ -450,7 +440,7 @@ THREAD_POOL_TASK_FUNC(lnk_obj_initer)
|
||||
|
||||
// parse exports
|
||||
LNK_ExportParseList export_parse = {0};
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_Directive_Export].first; dir != 0; dir = dir->next) {
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_CmdSwitch_Export].first; dir != 0; dir = dir->next) {
|
||||
lnk_parse_export_direcive(arena, &obj->export_parse, dir->value_list, obj);
|
||||
}
|
||||
|
||||
@@ -461,12 +451,12 @@ THREAD_POOL_TASK_FUNC(lnk_obj_initer)
|
||||
}
|
||||
|
||||
// push /include symbols
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_Directive_Include].first; dir != 0; dir = dir->next) {
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_CmdSwitch_Include].first; dir != 0; dir = dir->next) {
|
||||
str8_list_concat_in_place(&obj->include_symbol_list, &dir->value_list);
|
||||
}
|
||||
|
||||
// parse /alternatename
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_Directive_AlternateName].first; dir != 0; dir = dir->next) {
|
||||
for (LNK_Directive *dir = obj->directive_info.v[LNK_CmdSwitch_AlternateName].first; dir != 0; dir = dir->next) {
|
||||
String8 *invalid_string = lnk_parse_alt_name_directive_list(arena, dir->value_list, &obj->alt_name_list);
|
||||
if (invalid_string != 0) {
|
||||
lnk_error_obj(LNK_Error_Cmdl, obj, "invalid syntax \"%S\", expected format \"FROM=TO\"", *invalid_string);
|
||||
|
||||
Reference in New Issue
Block a user