@@ -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 ,
@@ -1850,12 +1850,12 @@ pub const LibExeObjStep = struct {
1850
1850
}
1851
1851
}
1852
1852
1853
- if (self .build_options_contents .len () > 0 ) {
1853
+ if (self .build_options_contents .len > 0 ) {
1854
1854
const build_options_file = try fs .path .join (
1855
1855
builder .allocator ,
1856
1856
&[_ ][]const u8 { builder .cache_root , builder .fmt ("{}_build_options.zig" , .{self .name }) },
1857
1857
);
1858
- try std .io .writeFile (build_options_file , self .build_options_contents .toSliceConst ());
1858
+ try std .io .writeFile (build_options_file , self .build_options_contents .span ());
1859
1859
try zig_args .append ("--pkg-begin" );
1860
1860
try zig_args .append ("build_options" );
1861
1861
try zig_args .append (builder .pathFromRoot (build_options_file ));
@@ -1963,22 +1963,22 @@ pub const LibExeObjStep = struct {
1963
1963
try zig_args .append (cross .cpu .model .name );
1964
1964
}
1965
1965
} else {
1966
- var mcpu_buffer = try std .Buffer .init (builder .allocator , "-mcpu=" );
1967
- try mcpu_buffer .append (cross .cpu .model .name );
1966
+ var mcpu_buffer = std .ArrayList (u8 ).init (builder .allocator );
1967
+ errdefer mcpu_buffer .deinit ();
1968
+
1969
+ try mcpu_buffer .outStream ().print ("-mcpu={}" , .{cross .cpu .model .name });
1968
1970
1969
1971
for (all_features ) | feature , i_usize | {
1970
1972
const i = @intCast (std .Target .Cpu .Feature .Set .Index , i_usize );
1971
1973
const in_cpu_set = populated_cpu_features .isEnabled (i );
1972
1974
const in_actual_set = cross .cpu .features .isEnabled (i );
1973
1975
if (in_cpu_set and ! in_actual_set ) {
1974
- try mcpu_buffer .appendByte ('-' );
1975
- try mcpu_buffer .append (feature .name );
1976
+ try mcpu_buffer .outStream ().print ("-{}" , .{feature .name });
1976
1977
} else if (! in_cpu_set and in_actual_set ) {
1977
- try mcpu_buffer .appendByte ('+' );
1978
- try mcpu_buffer .append (feature .name );
1978
+ try mcpu_buffer .outStream ().print ("+{}" , .{feature .name });
1979
1979
}
1980
1980
}
1981
- try zig_args .append (mcpu_buffer .toSliceConst ());
1981
+ try zig_args .append (mcpu_buffer .toOwnedSlice ());
1982
1982
}
1983
1983
1984
1984
if (self .target .dynamic_linker .get ()) | dynamic_linker | {
0 commit comments