Added ZigLLVMCreateTargetMachine and pass function-sections flag
Also added extra cache line Added the ZigLVVMCreateTargetMachine to self hosted zig code
This commit is contained in:
@@ -7042,7 +7042,7 @@ static void zig_llvm_emit_output(CodeGen *g) {
|
||||
case EmitFileTypeBinary:
|
||||
if (ZigLLVMTargetMachineEmitToFile(g->target_machine, g->module, buf_ptr(output_path),
|
||||
ZigLLVM_EmitBinary, &err_msg, g->build_mode == BuildModeDebug, is_small,
|
||||
g->enable_time_report, g->function_sections))
|
||||
g->enable_time_report))
|
||||
{
|
||||
zig_panic("unable to write object file %s: %s", buf_ptr(output_path), err_msg);
|
||||
}
|
||||
@@ -7058,7 +7058,7 @@ static void zig_llvm_emit_output(CodeGen *g) {
|
||||
case EmitFileTypeAssembly:
|
||||
if (ZigLLVMTargetMachineEmitToFile(g->target_machine, g->module, buf_ptr(output_path),
|
||||
ZigLLVM_EmitAssembly, &err_msg, g->build_mode == BuildModeDebug, is_small,
|
||||
g->enable_time_report, g->function_sections))
|
||||
g->enable_time_report))
|
||||
{
|
||||
zig_panic("unable to write assembly file %s: %s", buf_ptr(output_path), err_msg);
|
||||
}
|
||||
@@ -7068,7 +7068,7 @@ static void zig_llvm_emit_output(CodeGen *g) {
|
||||
case EmitFileTypeLLVMIr:
|
||||
if (ZigLLVMTargetMachineEmitToFile(g->target_machine, g->module, buf_ptr(output_path),
|
||||
ZigLLVM_EmitLLVMIr, &err_msg, g->build_mode == BuildModeDebug, is_small,
|
||||
g->enable_time_report, g->function_sections))
|
||||
g->enable_time_report))
|
||||
{
|
||||
zig_panic("unable to write llvm-ir file %s: %s", buf_ptr(output_path), err_msg);
|
||||
}
|
||||
@@ -8130,8 +8130,9 @@ static void init(CodeGen *g) {
|
||||
target_specific_features = "";
|
||||
}
|
||||
|
||||
g->target_machine = LLVMCreateTargetMachine(target_ref, buf_ptr(&g->triple_str),
|
||||
target_specific_cpu_args, target_specific_features, opt_level, reloc_mode, LLVMCodeModelDefault);
|
||||
g->target_machine = ZigLLVMCreateTargetMachine(target_ref, buf_ptr(&g->triple_str),
|
||||
target_specific_cpu_args, target_specific_features, opt_level, reloc_mode,
|
||||
LLVMCodeModelDefault, g->function_sections);
|
||||
|
||||
g->target_data_ref = LLVMCreateTargetDataLayout(g->target_machine);
|
||||
|
||||
@@ -9448,6 +9449,7 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
|
||||
cache_bool(ch, g->have_dynamic_link);
|
||||
cache_bool(ch, g->have_stack_probing);
|
||||
cache_bool(ch, g->is_dummy_so);
|
||||
cache_bool(ch, g->function_sections);
|
||||
cache_buf_opt(ch, g->mmacosx_version_min);
|
||||
cache_buf_opt(ch, g->mios_version_min);
|
||||
cache_usize(ch, g->version_major);
|
||||
|
||||
Reference in New Issue
Block a user