diff --git a/App/lib/Phase/BuildPipeline.vp b/App/lib/Phase/BuildPipeline.vp index cfd015d..91c470c 100644 --- a/App/lib/Phase/BuildPipeline.vp +++ b/App/lib/Phase/BuildPipeline.vp @@ -439,15 +439,12 @@ def init_llc_task(task: LlcTask | t.CPtr, ir_path: str, output_dir: str, if task.ModuleSha1 is None: return 1 string.strcpy(task.ModuleSha1, module_name) - # llc 命令 - cmd_len: sizet = len(cc_cmd) + len(cc_flags) \ - + len(obj_path) + len(ir_path) + 64 - task.LlcCmd = stdlib.malloc(cmd_len) - if task.LlcCmd is None: - return 1 - viperlib.snprintf(task.LlcCmd, cmd_len, "%s %s -o %s %s", - cc_cmd, cc_flags, obj_path, ir_path) - # ASan 模式:opt 插桩命令(worker 先跑,失败即置 Result) + # llc 输入选择:ASan 模式必须喂插桩后的 .asan.ll,与串行路径 + # compile_ll_to_obj 的 compile_input 同口径(否则 opt 生成了插桩产物 + # 却被 llc 忽略,App 侧 obj 里 0 处 __asan,内存排查半盲) + compile_input: str = ir_path + # ASan 模式:opt 插桩命令(worker 先跑 opt 再跑 llc,故 LlcCmd 的输入 + # 必须指向 asan_path;失败即置 Result) if _asan_mode != 0: asan_path: str = build_sliced_path(output_dir, module_name, "asan.ll") if asan_path is None: @@ -460,6 +457,15 @@ def init_llc_task(task: LlcTask | t.CPtr, ir_path: str, output_dir: str, "opt -passes=forceattrs,asan -force-attribute=sanitize_address" " -asan-globals=false -o %s %s", asan_path, ir_path) + compile_input = asan_path + # llc 命令(输入 = compile_input:非 ASan 为 .ll,ASan 为 .asan.ll) + cmd_len: sizet = len(cc_cmd) + len(cc_flags) \ + + len(obj_path) + len(compile_input) + 64 + task.LlcCmd = stdlib.malloc(cmd_len) + if task.LlcCmd is None: + return 1 + viperlib.snprintf(task.LlcCmd, cmd_len, "%s %s -o %s %s", + cc_cmd, cc_flags, obj_path, compile_input) return 0