Commit cfbcb41160
Changed files (3)
src/Compilation.zig
@@ -61,6 +61,7 @@ verbose_cimport: bool,
verbose_llvm_cpu_features: bool,
disable_c_depfile: bool,
time_report: bool,
+stack_report: bool,
c_source_files: []const CSourceFile,
clang_argv: []const []const u8,
@@ -348,6 +349,7 @@ pub const InitOptions = struct {
single_threaded: bool = false,
is_native_os: bool,
time_report: bool = false,
+ stack_report: bool = false,
link_eh_frame_hdr: bool = false,
linker_script: ?[]const u8 = null,
version_script: ?[]const u8 = null,
@@ -821,6 +823,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
.owned_link_dir = owned_link_dir,
.color = options.color,
.time_report = options.time_report,
+ .stack_report = options.stack_report,
.test_filter = options.test_filter,
.test_name_prefix = options.test_name_prefix,
.test_evented_io = options.test_evented_io,
@@ -2670,7 +2673,7 @@ fn updateStage1Module(comp: *Compilation) !void {
.function_sections = comp.bin_file.options.function_sections,
.enable_stack_probing = comp.bin_file.options.stack_check,
.enable_time_report = comp.time_report,
- .enable_stack_report = false,
+ .enable_stack_report = comp.stack_report,
.test_is_evented = comp.test_evented_io,
.verbose_tokenize = comp.verbose_tokenize,
.verbose_ast = comp.verbose_ast,
src/main.zig
@@ -284,6 +284,7 @@ const usage_build_generic =
\\
\\Debug Options (Zig Compiler Development):
\\ -ftime-report Print timing diagnostics
+ \\ -fstack-report Print stack size diagnostics
\\ --verbose-link Display linker invocations
\\ --verbose-cc Display C compiler invocations
\\ --verbose-tokenize Enable compiler debug output for tokenization
@@ -390,6 +391,7 @@ fn buildOutputType(
var verbose_cimport = false;
var verbose_llvm_cpu_features = false;
var time_report = false;
+ var stack_report = false;
var show_builtin = false;
var emit_bin: Emit = .yes_default_path;
var emit_asm: Emit = .no;
@@ -728,6 +730,8 @@ fn buildOutputType(
watch = true;
} else if (mem.eql(u8, arg, "-ftime-report")) {
time_report = true;
+ } else if (mem.eql(u8, arg, "-fstack-report")) {
+ stack_report = true;
} else if (mem.eql(u8, arg, "-fPIC")) {
want_pic = true;
} else if (mem.eql(u8, arg, "-fno-PIC")) {
@@ -1568,6 +1572,7 @@ fn buildOutputType(
.machine_code_model = machine_code_model,
.color = color,
.time_report = time_report,
+ .stack_report = stack_report,
.is_test = arg_mode == .zig_test,
.each_lib_rpath = each_lib_rpath,
.test_evented_io = test_evented_io,
BRANCH_TODO
@@ -1,10 +1,8 @@
* audit the CLI options for stage2
* audit the base cache hash
- * On operating systems that support it, do an execve for `zig test` and `zig run` rather than child process.
- * `-ftime-report`
- * -fstack-report print stack size diagnostics\n"
* try building some software with zig cc to make sure it didn't regress
+ * On operating systems that support it, do an execve for `zig test` and `zig run` rather than child process.
* implement proper parsing of clang stderr/stdout and exposing compile errors with the Compilation API
* implement proper parsing of LLD stderr/stdout and exposing compile errors with the Compilation API
* support cross compiling stage2 with `zig build`