authorgravatar for leecannon@leecannon.xyzLee Cannon <leecannon@leecannon.xyz> 2022-01-23 20:10:39+00:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-25 18:21:58-05:00
logfbe5336f3be7065ab84b797eb629ada9565341c2
treefb67cb075a9b57c972511f13a979e43881a48eb2
parent53c668d3a9dad430749cbc642d7bf8cf45eefba1

add option to force usage of `GeneralPurposeAllocator`


2 files changed, 3 insertions(+), 1 deletions(-)

build.zig+2
......@@ -112,6 +112,7 @@ pub fn build(b: *Builder) !void {
112112 const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source");
113113 const tracy_callstack = b.option(bool, "tracy-callstack", "Include callstack information with Tracy data. Does nothing if -Dtracy is not provided") orelse false;
114114 const tracy_allocation = b.option(bool, "tracy-allocation", "Include allocation information with Tracy data. Does nothing if -Dtracy is not provided") orelse false;
115 const force_gpa = b.option(bool, "force-gpa", "Force the compiler to use GeneralPurposeAllocator") orelse false;
115116 const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse enable_llvm;
116117 const strip = b.option(bool, "strip", "Omit debug information") orelse false;
117118
......@@ -150,6 +151,7 @@ pub fn build(b: *Builder) !void {
150151 exe_options.addOption(bool, "llvm_has_csky", llvm_has_csky);
151152 exe_options.addOption(bool, "llvm_has_ve", llvm_has_ve);
152153 exe_options.addOption(bool, "llvm_has_arc", llvm_has_arc);
154 exe_options.addOption(bool, "force_gpa", force_gpa);
153155
154156 if (enable_llvm) {
155157 const cmake_cfg = if (static_llvm) null else findAndParseConfigH(b, config_h_path_option);
src/main.zig+1-1
......@@ -137,7 +137,7 @@ pub fn main() anyerror!void {
137137
138138 var gpa_need_deinit = false;
139139 const gpa = gpa: {
140 if (!builtin.link_libc) {
140 if (build_options.force_gpa or !builtin.link_libc) {
141141 gpa_need_deinit = true;
142142 break :gpa general_purpose_allocator.allocator();
143143 }