@@ -30,7 +30,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
30
30
switch (crt_file ) {
31
31
.crti_o = > {
32
32
var args = std .ArrayList ([]const u8 ).init (arena );
33
- try add_cc_args (comp , arena , & args , false );
33
+ try addCcArgs (comp , arena , & args , false );
34
34
try args .appendSlice (&[_ ][]const u8 {
35
35
"-Qunused-arguments" ,
36
36
});
@@ -43,7 +43,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
43
43
},
44
44
.crtn_o = > {
45
45
var args = std .ArrayList ([]const u8 ).init (arena );
46
- try add_cc_args (comp , arena , & args , false );
46
+ try addCcArgs (comp , arena , & args , false );
47
47
try args .appendSlice (&[_ ][]const u8 {
48
48
"-Qunused-arguments" ,
49
49
});
@@ -56,7 +56,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
56
56
},
57
57
.crt1_o = > {
58
58
var args = std .ArrayList ([]const u8 ).init (arena );
59
- try add_cc_args (comp , arena , & args , false );
59
+ try addCcArgs (comp , arena , & args , false );
60
60
try args .appendSlice (&[_ ][]const u8 {
61
61
"-fno-stack-protector" ,
62
62
"-DCRT" ,
@@ -72,7 +72,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
72
72
},
73
73
.rcrt1_o = > {
74
74
var args = std .ArrayList ([]const u8 ).init (arena );
75
- try add_cc_args (comp , arena , & args , false );
75
+ try addCcArgs (comp , arena , & args , false );
76
76
try args .appendSlice (&[_ ][]const u8 {
77
77
"-fPIC" ,
78
78
"-fno-stack-protector" ,
@@ -89,7 +89,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
89
89
},
90
90
.scrt1_o = > {
91
91
var args = std .ArrayList ([]const u8 ).init (arena );
92
- try add_cc_args (comp , arena , & args , false );
92
+ try addCcArgs (comp , arena , & args , false );
93
93
try args .appendSlice (&[_ ][]const u8 {
94
94
"-fPIC" ,
95
95
"-fno-stack-protector" ,
@@ -147,7 +147,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
147
147
148
148
var is_arch_specific = false ;
149
149
// Architecture-specific implementations are under a <arch>/ folder.
150
- if (is_musl_arch_name (dirbasename )) {
150
+ if (isMuslArchName (dirbasename )) {
151
151
if (! mem .eql (u8 , dirbasename , arch_name ))
152
152
continue ; // Not the architecture we're compiling for.
153
153
is_arch_specific = true ;
@@ -177,7 +177,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
177
177
}
178
178
179
179
var args = std .ArrayList ([]const u8 ).init (arena );
180
- try add_cc_args (comp , arena , & args , ext == .o3 );
180
+ try addCcArgs (comp , arena , & args , ext == .o3 );
181
181
try args .appendSlice (&[_ ][]const u8 {
182
182
"-Qunused-arguments" ,
183
183
"-w" , // disable all warnings
@@ -251,7 +251,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
251
251
pub fn archMuslName (arch : std.Target.Cpu.Arch ) [:0 ]const u8 {
252
252
switch (arch ) {
253
253
.aarch64 , .aarch64_be = > return "aarch64" ,
254
- .arm , .armeb = > return "arm" ,
254
+ .arm , .armeb , .thumb , .thumbeb = > return "arm" ,
255
255
.i386 = > return "i386" ,
256
256
.mips , .mipsel = > return "mips" ,
257
257
.mips64el , .mips64 = > return "mips64" ,
@@ -267,24 +267,17 @@ pub fn archMuslName(arch: std.Target.Cpu.Arch) [:0]const u8 {
267
267
268
268
// Return true if musl has arch-specific crti/crtn sources.
269
269
// See lib/libc/musl/crt/ARCH/crt?.s .
270
- pub fn libc_needs_crti_crtn (target : std.Target ) bool {
270
+ pub fn needsCrtiCrtn (target : std.Target ) bool {
271
271
// zig fmt: off
272
272
return switch (target .cpu .arch ) {
273
- .aarch64 , .aarch64_be ,
274
- .arm , .armeb ,
275
- .i386 ,
276
- .mips , .mipsel ,
277
- .mips64el , .mips64 ,
278
- .powerpc ,
279
- .powerpc64 , .powerpc64le ,
280
- .s390x ,
281
- .x86_64 = > true ,
282
- else = > false ,
273
+ .riscv64 ,
274
+ .wasm32 , .wasm64 = > return false ,
275
+ else = > true ,
283
276
};
284
277
// zig fmt: on
285
278
}
286
279
287
- fn is_musl_arch_name (name : []const u8 ) bool {
280
+ fn isMuslArchName (name : []const u8 ) bool {
288
281
const musl_arch_names = [_ ][]const u8 {
289
282
"aarch64" ,
290
283
"arm" ,
@@ -350,7 +343,7 @@ fn addSrcFile(arena: *Allocator, source_table: *std.StringArrayHashMap(Ext), fil
350
343
source_table .putAssumeCapacityNoClobber (key , ext );
351
344
}
352
345
353
- fn add_cc_args (
346
+ fn addCcArgs (
354
347
comp : * Compilation ,
355
348
arena : * Allocator ,
356
349
args : * std .ArrayList ([]const u8 ),
0 commit comments