MCPcopy Create free account
hub / github.com/dobin/SuperMega / compile_dev

Function compile_dev

phases/compiler.py:74–105  ·  view source on GitHub ↗
(
    c_in: FilePath, 
    asm_out: FilePath,
    short_call_patching: bool = False,
)

Source from the content-addressed store, hash-verified

72
73# NOTE: Mostly copy-pasted from compiler.py::compile()
74def compile_dev(
75 c_in: FilePath,
76 asm_out: FilePath,
77 short_call_patching: bool = False,
78):
79 logger.info("-( Carrier: Compile C to ASM: {} -> {} ".format(c_in, asm_out))
80
81 # Compile C To Assembly (text)
82 run_process_checkret([
83 config.get("path_cl"),
84 "/c",
85 "/FA",
86 "/GS-",
87 "/favor:AMD64",
88 "/Fa{}/".format(os.path.dirname(c_in)),
89 c_in,
90 ])
91 if not os.path.isfile(asm_out):
92 raise Exception("Error: Compiling failed")
93
94 asm_text: str = file_readall_text(asm_out)
95 observer.add_text_file("carrier_asm_orig", asm_text)
96
97 logger.info(" ASM masm_shc: {} ".format(asm_out))
98 settings = Settings()
99 injectable = Injectable("test.exe") # ???
100 asm_text_lines: List[str] = parse_asm_text_file(injectable, asm_text, settings)
101 asm_text = masm_shc(asm_text_lines)
102 observer.add_text_file("carrier_asm_cleanup", asm_text)
103
104 with open(asm_out, "w") as f:
105 f.write(asm_text)
106
107
108def compile(

Callers

nothing calls this directly

Calls 9

SettingsClass · 0.90
InjectableClass · 0.90
parse_asm_text_fileFunction · 0.90
masm_shcFunction · 0.90
run_process_checkretFunction · 0.85
file_readall_textFunction · 0.85
formatMethod · 0.80
getMethod · 0.80
add_text_fileMethod · 0.80

Tested by

no test coverage detected