@@ -1139,7 +1139,7 @@ pub const LibExeObjStep = struct {
1139
1139
out_lib_filename : []const u8 ,
1140
1140
out_pdb_filename : []const u8 ,
1141
1141
packages : ArrayList (Pkg ),
1142
- build_options_contents : std.Buffer ,
1142
+ build_options_contents : std .ArrayList ( u8 ) ,
1143
1143
system_linker_hack : bool = false ,
1144
1144
1145
1145
object_src : []const u8 ,
@@ -1274,7 +1274,7 @@ pub const LibExeObjStep = struct {
1274
1274
.lib_paths = ArrayList ([]const u8 ).init (builder .allocator ),
1275
1275
.framework_dirs = ArrayList ([]const u8 ).init (builder .allocator ),
1276
1276
.object_src = undefined ,
1277
- .build_options_contents = std .Buffer . initSize (builder .allocator , 0 ) catch unreachable ,
1277
+ .build_options_contents = std .ArrayList ( u8 ). init (builder .allocator ) ,
1278
1278
.c_std = Builder .CStd .C99 ,
1279
1279
.override_lib_dir = null ,
1280
1280
.main_pkg_path = null ,
@@ -1847,7 +1847,7 @@ pub const LibExeObjStep = struct {
1847
1847
}
1848
1848
}
1849
1849
1850
- if (self .build_options_contents .len () > 0 ) {
1850
+ if (self .build_options_contents .len > 0 ) {
1851
1851
const build_options_file = try fs .path .join (
1852
1852
builder .allocator ,
1853
1853
&[_ ][]const u8 { builder .cache_root , builder .fmt ("{}_build_options.zig" , .{self .name }) },
@@ -1960,22 +1960,23 @@ pub const LibExeObjStep = struct {
1960
1960
try zig_args .append (cross .cpu .model .name );
1961
1961
}
1962
1962
} else {
1963
- var mcpu_buffer = try std .Buffer .init (builder .allocator , "-mcpu=" );
1964
- try mcpu_buffer .append (cross .cpu .model .name );
1963
+ var mcpu_buffer = std .ArrayList (u8 ).init (builder .allocator );
1964
+ errdefer mcpu_buffer .deinit ();
1965
+
1966
+ try mcpu_buffer .outStream ().print ("-mcpu={}" , .{cross .cpu .model .name });
1965
1967
1966
1968
for (all_features ) | feature , i_usize | {
1967
1969
const i = @intCast (std .Target .Cpu .Feature .Set .Index , i_usize );
1968
1970
const in_cpu_set = populated_cpu_features .isEnabled (i );
1969
1971
const in_actual_set = cross .cpu .features .isEnabled (i );
1970
1972
if (in_cpu_set and ! in_actual_set ) {
1971
- try mcpu_buffer .appendByte ('-' );
1972
- try mcpu_buffer .append (feature .name );
1973
+ try mcpu_buffer .outStream ().print ("-{}" , .{feature .name });
1973
1974
} else if (! in_cpu_set and in_actual_set ) {
1974
- try mcpu_buffer .appendByte ('+' );
1975
- try mcpu_buffer .append (feature .name );
1975
+ try mcpu_buffer .outStream ().print ("+{}" , .{feature .name });
1976
1976
}
1977
1977
}
1978
- try zig_args .append (mcpu_buffer .span ());
1978
+
1979
+ try zig_args .append (mcpu_buffer .toOwnedSlice ());
1979
1980
}
1980
1981
1981
1982
if (self .target .dynamic_linker .get ()) | dynamic_linker | {
0 commit comments