authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-29 00:34:53-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-29 00:34:53-07:00
logcfbcb4116017a27a403f8be11a32f25f6c1c8671
tree2f4e7267a066e70adf4f1f17520220e5e42bfce5
parent750b00c642782127736eb378ec9583db2d680bb6

stage2: add CLI option for -fstack-report


3 files changed, 10 insertions(+), 4 deletions(-)

BRANCH_TODO+1-3
...@@ -1,10 +1,8 @@...@@ -1,10 +1,8 @@
1 * audit the CLI options for stage21 * audit the CLI options for stage2
2 * audit the base cache hash2 * audit the base cache hash
3 * On operating systems that support it, do an execve for `zig test` and `zig run` rather than child process.
4 * `-ftime-report`
5 * -fstack-report print stack size diagnostics\n"
6 * try building some software with zig cc to make sure it didn't regress3 * try building some software with zig cc to make sure it didn't regress
74
5 * On operating systems that support it, do an execve for `zig test` and `zig run` rather than child process.
8 * implement proper parsing of clang stderr/stdout and exposing compile errors with the Compilation API6 * implement proper parsing of clang stderr/stdout and exposing compile errors with the Compilation API
9 * implement proper parsing of LLD stderr/stdout and exposing compile errors with the Compilation API7 * implement proper parsing of LLD stderr/stdout and exposing compile errors with the Compilation API
10 * support cross compiling stage2 with `zig build`8 * support cross compiling stage2 with `zig build`
src/Compilation.zig+4-1
...@@ -61,6 +61,7 @@ verbose_cimport: bool,...@@ -61,6 +61,7 @@ verbose_cimport: bool,
61verbose_llvm_cpu_features: bool,61verbose_llvm_cpu_features: bool,
62disable_c_depfile: bool,62disable_c_depfile: bool,
63time_report: bool,63time_report: bool,
64stack_report: bool,
6465
65c_source_files: []const CSourceFile,66c_source_files: []const CSourceFile,
66clang_argv: []const []const u8,67clang_argv: []const []const u8,
...@@ -348,6 +349,7 @@ pub const InitOptions = struct {...@@ -348,6 +349,7 @@ pub const InitOptions = struct {
348 single_threaded: bool = false,349 single_threaded: bool = false,
349 is_native_os: bool,350 is_native_os: bool,
350 time_report: bool = false,351 time_report: bool = false,
352 stack_report: bool = false,
351 link_eh_frame_hdr: bool = false,353 link_eh_frame_hdr: bool = false,
352 linker_script: ?[]const u8 = null,354 linker_script: ?[]const u8 = null,
353 version_script: ?[]const u8 = null,355 version_script: ?[]const u8 = null,
...@@ -821,6 +823,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {...@@ -821,6 +823,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
821 .owned_link_dir = owned_link_dir,823 .owned_link_dir = owned_link_dir,
822 .color = options.color,824 .color = options.color,
823 .time_report = options.time_report,825 .time_report = options.time_report,
826 .stack_report = options.stack_report,
824 .test_filter = options.test_filter,827 .test_filter = options.test_filter,
825 .test_name_prefix = options.test_name_prefix,828 .test_name_prefix = options.test_name_prefix,
826 .test_evented_io = options.test_evented_io,829 .test_evented_io = options.test_evented_io,
...@@ -2670,7 +2673,7 @@ fn updateStage1Module(comp: *Compilation) !void {...@@ -2670,7 +2673,7 @@ fn updateStage1Module(comp: *Compilation) !void {
2670 .function_sections = comp.bin_file.options.function_sections,2673 .function_sections = comp.bin_file.options.function_sections,
2671 .enable_stack_probing = comp.bin_file.options.stack_check,2674 .enable_stack_probing = comp.bin_file.options.stack_check,
2672 .enable_time_report = comp.time_report,2675 .enable_time_report = comp.time_report,
2673 .enable_stack_report = false,2676 .enable_stack_report = comp.stack_report,
2674 .test_is_evented = comp.test_evented_io,2677 .test_is_evented = comp.test_evented_io,
2675 .verbose_tokenize = comp.verbose_tokenize,2678 .verbose_tokenize = comp.verbose_tokenize,
2676 .verbose_ast = comp.verbose_ast,2679 .verbose_ast = comp.verbose_ast,
src/main.zig+5
...@@ -284,6 +284,7 @@ const usage_build_generic =...@@ -284,6 +284,7 @@ const usage_build_generic =
284 \\284 \\
285 \\Debug Options (Zig Compiler Development):285 \\Debug Options (Zig Compiler Development):
286 \\ -ftime-report Print timing diagnostics286 \\ -ftime-report Print timing diagnostics
287 \\ -fstack-report Print stack size diagnostics
287 \\ --verbose-link Display linker invocations288 \\ --verbose-link Display linker invocations
288 \\ --verbose-cc Display C compiler invocations289 \\ --verbose-cc Display C compiler invocations
289 \\ --verbose-tokenize Enable compiler debug output for tokenization290 \\ --verbose-tokenize Enable compiler debug output for tokenization
...@@ -390,6 +391,7 @@ fn buildOutputType(...@@ -390,6 +391,7 @@ fn buildOutputType(
390 var verbose_cimport = false;391 var verbose_cimport = false;
391 var verbose_llvm_cpu_features = false;392 var verbose_llvm_cpu_features = false;
392 var time_report = false;393 var time_report = false;
394 var stack_report = false;
393 var show_builtin = false;395 var show_builtin = false;
394 var emit_bin: Emit = .yes_default_path;396 var emit_bin: Emit = .yes_default_path;
395 var emit_asm: Emit = .no;397 var emit_asm: Emit = .no;
...@@ -728,6 +730,8 @@ fn buildOutputType(...@@ -728,6 +730,8 @@ fn buildOutputType(
728 watch = true;730 watch = true;
729 } else if (mem.eql(u8, arg, "-ftime-report")) {731 } else if (mem.eql(u8, arg, "-ftime-report")) {
730 time_report = true;732 time_report = true;
733 } else if (mem.eql(u8, arg, "-fstack-report")) {
734 stack_report = true;
731 } else if (mem.eql(u8, arg, "-fPIC")) {735 } else if (mem.eql(u8, arg, "-fPIC")) {
732 want_pic = true;736 want_pic = true;
733 } else if (mem.eql(u8, arg, "-fno-PIC")) {737 } else if (mem.eql(u8, arg, "-fno-PIC")) {
...@@ -1568,6 +1572,7 @@ fn buildOutputType(...@@ -1568,6 +1572,7 @@ fn buildOutputType(
1568 .machine_code_model = machine_code_model,1572 .machine_code_model = machine_code_model,
1569 .color = color,1573 .color = color,
1570 .time_report = time_report,1574 .time_report = time_report,
1575 .stack_report = stack_report,
1571 .is_test = arg_mode == .zig_test,1576 .is_test = arg_mode == .zig_test,
1572 .each_lib_rpath = each_lib_rpath,1577 .each_lib_rpath = each_lib_rpath,
1573 .test_evented_io = test_evented_io,1578 .test_evented_io = test_evented_io,