| ... | ... | @@ -932,6 +932,7 @@ pub const Abi = enum { |
| 932 | 932 | .wiiu => .eabihf, |
| 933 | 933 | .gba => .eabi, |
| 934 | 934 | .psx => .eabi, |
| 935 | .ps3 => .ilp32, |
| 935 | 936 | .psp => .eabihf, |
| 936 | 937 | .vita => .eabihf, |
| 937 | 938 | .emscripten => .musl, |
| ... | ... | @@ -951,7 +952,6 @@ pub const Abi = enum { |
| 951 | 952 | .visionos, |
| 952 | 953 | .watchos, |
| 953 | 954 | .@"switch", |
| 954 | | .ps3, |
| 955 | 955 | .ps4, |
| 956 | 956 | .ps5, |
| 957 | 957 | .amdhsa, |
| ... | ... | @@ -2135,6 +2135,7 @@ pub const Cpu = struct { |
| 2135 | 2135 | .powerpc64 => switch (os.tag) { |
| 2136 | 2136 | .linux, .freebsd => &powerpc.cpu.pwr8, |
| 2137 | 2137 | .openbsd => &powerpc.cpu.pwr9, |
| 2138 | .ps3 => &powerpc.cpu.cell, |
| 2138 | 2139 | else => generic(arch), |
| 2139 | 2140 | }, |
| 2140 | 2141 | .powerpc64le => &powerpc.cpu.ppc64le, |
| ... | ... | @@ -2468,6 +2469,9 @@ pub const DynamicLinker = struct { |
| 2468 | 2469 | .tvos, |
| 2469 | 2470 | .visionos, |
| 2470 | 2471 | .watchos, |
| 2472 | |
| 2473 | .ps4, |
| 2474 | .ps5, |
| 2471 | 2475 | => .arch_os, |
| 2472 | 2476 | |
| 2473 | 2477 | .hurd, |
| ... | ... | @@ -2488,6 +2492,11 @@ pub const DynamicLinker = struct { |
| 2488 | 2492 | .@"switch", |
| 2489 | 2493 | .gba, |
| 2490 | 2494 | |
| 2495 | .psx, |
| 2496 | .ps3, |
| 2497 | .psp, |
| 2498 | .vita, |
| 2499 | |
| 2491 | 2500 | .emscripten, |
| 2492 | 2501 | .wasi, |
| 2493 | 2502 | |
| ... | ... | @@ -2500,13 +2509,6 @@ pub const DynamicLinker = struct { |
| 2500 | 2509 | .opengl, |
| 2501 | 2510 | .vulkan, |
| 2502 | 2511 | |
| 2503 | | .psx, |
| 2504 | | .ps3, |
| 2505 | | .ps4, |
| 2506 | | .ps5, |
| 2507 | | .psp, |
| 2508 | | .vita, |
| 2509 | | |
| 2510 | 2512 | .tios, |
| 2511 | 2513 | .ashetos, |
| 2512 | 2514 | => .none, |
| ... | ... | @@ -2909,8 +2911,10 @@ pub const DynamicLinker = struct { |
| 2909 | 2911 | else => none, |
| 2910 | 2912 | }, |
| 2911 | 2913 | |
| 2912 | | // Operating systems in this list have been verified as not having a standard |
| 2913 | | // dynamic linker path. |
| 2914 | .ps4, |
| 2915 | .ps5, |
| 2916 | => if (cpu.arch == .x86_64) init("/libexec/ld-elf.so.1") else none, |
| 2917 | |
| 2914 | 2918 | .freestanding, |
| 2915 | 2919 | .other, |
| 2916 | 2920 | |
| ... | ... | @@ -2926,6 +2930,7 @@ pub const DynamicLinker = struct { |
| 2926 | 2930 | .gba, |
| 2927 | 2931 | |
| 2928 | 2932 | .psx, |
| 2933 | .ps3, |
| 2929 | 2934 | .psp, |
| 2930 | 2935 | .vita, |
| 2931 | 2936 | |
| ... | ... | @@ -2944,13 +2949,6 @@ pub const DynamicLinker = struct { |
| 2944 | 2949 | .tios, |
| 2945 | 2950 | .ashetos, |
| 2946 | 2951 | => none, |
| 2947 | | |
| 2948 | | // TODO go over each item in this list and either move it to the above list, or |
| 2949 | | // implement the standard dynamic linker path code for it. |
| 2950 | | .ps3, |
| 2951 | | .ps4, |
| 2952 | | .ps5, |
| 2953 | | => none, |
| 2954 | 2952 | } catch unreachable; |
| 2955 | 2953 | } |
| 2956 | 2954 | }; |
| ... | ... | @@ -3137,38 +3135,39 @@ pub fn stackGrowth(target: *const Target) StackGrowth { |
| 3137 | 3135 | /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char |
| 3138 | 3136 | /// Returns `null` if no C ABI is defined for this target. |
| 3139 | 3137 | pub fn cCharSignedness(target: *const Target) ?std.builtin.Signedness { |
| 3140 | | switch (target.os.tag) { |
| 3141 | | .opengl => return null, |
| 3142 | | else => {}, |
| 3143 | | } |
| 3144 | | if (target.os.tag.isDarwin() or target.os.tag == .windows or target.os.tag == .uefi) return .signed; |
| 3145 | | return switch (target.cpu.arch) { |
| 3146 | | .aarch64, |
| 3147 | | .aarch64_be, |
| 3148 | | .arm, |
| 3149 | | .armeb, |
| 3150 | | .arc, |
| 3151 | | .arceb, |
| 3152 | | .csky, |
| 3153 | | .ez80, |
| 3154 | | .hexagon, |
| 3155 | | .msp430, |
| 3156 | | .powerpc, |
| 3157 | | .powerpcle, |
| 3158 | | .powerpc64, |
| 3159 | | .powerpc64le, |
| 3160 | | .s390x, |
| 3161 | | .riscv32, |
| 3162 | | .riscv32be, |
| 3163 | | .riscv64, |
| 3164 | | .riscv64be, |
| 3165 | | .thumb, |
| 3166 | | .thumbeb, |
| 3167 | | .xcore, |
| 3168 | | .xtensa, |
| 3169 | | .xtensaeb, |
| 3170 | | => .unsigned, |
| 3171 | | else => .signed, |
| 3138 | return switch (target.os.tag) { |
| 3139 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => .signed, |
| 3140 | .windows, .uefi => .signed, |
| 3141 | .ps3, .vita => .signed, |
| 3142 | .opengl => null, |
| 3143 | else => switch (target.cpu.arch) { |
| 3144 | .aarch64, |
| 3145 | .aarch64_be, |
| 3146 | .arm, |
| 3147 | .armeb, |
| 3148 | .arc, |
| 3149 | .arceb, |
| 3150 | .csky, |
| 3151 | .ez80, |
| 3152 | .hexagon, |
| 3153 | .msp430, |
| 3154 | .powerpc, |
| 3155 | .powerpcle, |
| 3156 | .powerpc64, |
| 3157 | .powerpc64le, |
| 3158 | .s390x, |
| 3159 | .riscv32, |
| 3160 | .riscv32be, |
| 3161 | .riscv64, |
| 3162 | .riscv64be, |
| 3163 | .thumb, |
| 3164 | .thumbeb, |
| 3165 | .xcore, |
| 3166 | .xtensa, |
| 3167 | .xtensaeb, |
| 3168 | => .unsigned, |
| 3169 | else => .signed, |
| 3170 | }, |
| 3172 | 3171 | }; |
| 3173 | 3172 | } |
| 3174 | 3173 | |
| ... | ... | @@ -3204,6 +3203,7 @@ pub fn cTypeByteSize(t: *const Target, c_type: CType) ?u16 { |
| 3204 | 3203 | => @divExact(cTypeBitSize(t, c_type) orelse return null, 8), |
| 3205 | 3204 | |
| 3206 | 3205 | .longdouble => switch (cTypeBitSize(t, c_type) orelse return null) { |
| 3206 | 32 => 4, |
| 3207 | 3207 | 64 => 8, |
| 3208 | 3208 | 80 => @intCast(std.mem.alignForward(usize, 10, cTypeAlignment(t, c_type).?)), |
| 3209 | 3209 | 128 => 16, |
| ... | ... | @@ -3240,30 +3240,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3240 | 3240 | .long, .ulong, .float => 32, |
| 3241 | 3241 | .double, .longdouble, .longlong, .ulonglong => 64, |
| 3242 | 3242 | }, |
| 3243 | | .mips64, |
| 3244 | | .mips64el, |
| 3245 | | => switch (c_type) { |
| 3246 | | .char => 8, |
| 3247 | | .short, .ushort => 16, |
| 3248 | | .int, .uint, .float => 32, |
| 3249 | | .long, .ulong => switch (target.abi) { |
| 3250 | | .abin32 => 32, |
| 3251 | | else => 64, |
| 3252 | | }, |
| 3253 | | .longlong, .ulonglong, .double => 64, |
| 3254 | | .longdouble => 128, |
| 3255 | | }, |
| 3256 | | .x86_64 => switch (c_type) { |
| 3257 | | .char => 8, |
| 3258 | | .short, .ushort => 16, |
| 3259 | | .int, .uint, .float => 32, |
| 3260 | | .long, .ulong => switch (target.abi) { |
| 3261 | | .x32 => 32, |
| 3262 | | else => 64, |
| 3263 | | }, |
| 3264 | | .longlong, .ulonglong, .double => 64, |
| 3265 | | .longdouble => 80, |
| 3266 | | }, |
| 3267 | 3243 | else => switch (c_type) { |
| 3268 | 3244 | .char => 8, |
| 3269 | 3245 | .short, .ushort => 16, |
| ... | ... | @@ -3271,7 +3247,11 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3271 | 3247 | .long, .ulong => target.ptrBitWidth(), |
| 3272 | 3248 | .longlong, .ulonglong, .double => 64, |
| 3273 | 3249 | .longdouble => switch (target.cpu.arch) { |
| 3274 | | .x86 => 80, |
| 3250 | else => 64, |
| 3251 | |
| 3252 | .x86, |
| 3253 | .x86_64, |
| 3254 | => 80, |
| 3275 | 3255 | |
| 3276 | 3256 | .alpha, |
| 3277 | 3257 | .riscv32, |
| ... | ... | @@ -3280,11 +3260,14 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3280 | 3260 | .riscv64be, |
| 3281 | 3261 | .aarch64, |
| 3282 | 3262 | .aarch64_be, |
| 3263 | .mips64, |
| 3264 | .mips64el, |
| 3283 | 3265 | .powerpc, |
| 3284 | 3266 | .powerpcle, |
| 3285 | 3267 | .powerpc64, |
| 3286 | 3268 | .powerpc64le, |
| 3287 | 3269 | .s390x, |
| 3270 | .sparc, |
| 3288 | 3271 | .sparc64, |
| 3289 | 3272 | .wasm32, |
| 3290 | 3273 | .wasm64, |
| ... | ... | @@ -3292,13 +3275,12 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3292 | 3275 | .loongarch64, |
| 3293 | 3276 | .ve, |
| 3294 | 3277 | => 128, |
| 3295 | | |
| 3296 | | else => 64, |
| 3297 | 3278 | }, |
| 3298 | 3279 | }, |
| 3299 | 3280 | }, |
| 3300 | 3281 | |
| 3301 | 3282 | .fuchsia, |
| 3283 | .managarm, |
| 3302 | 3284 | |
| 3303 | 3285 | .haiku, |
| 3304 | 3286 | .hurd, |
| ... | ... | @@ -3386,6 +3368,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3386 | 3368 | .s390x, |
| 3387 | 3369 | .mips64, |
| 3388 | 3370 | .mips64el, |
| 3371 | .sparc, |
| 3389 | 3372 | .sparc64, |
| 3390 | 3373 | .wasm32, |
| 3391 | 3374 | .wasm64, |
| ... | ... | @@ -3457,52 +3440,20 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3457 | 3440 | }, |
| 3458 | 3441 | }, |
| 3459 | 3442 | |
| 3460 | | .nvcl, .cuda => switch (c_type) { |
| 3461 | | .char => 8, |
| 3462 | | .short, .ushort => 16, |
| 3463 | | .int, .uint, .float => 32, |
| 3464 | | .long, .ulong => switch (target.cpu.arch) { |
| 3465 | | .nvptx => 32, |
| 3466 | | .nvptx64 => 64, |
| 3467 | | else => 64, |
| 3468 | | }, |
| 3469 | | .longlong, .ulonglong, .double => 64, |
| 3470 | | .longdouble => 64, |
| 3471 | | }, |
| 3472 | | |
| 3473 | | .amdhsa, .amdpal, .mesa3d => switch (c_type) { |
| 3443 | .cuda, .amdhsa, .amdpal, .mesa3d, .nvcl, .opencl, .vulkan => switch (c_type) { |
| 3474 | 3444 | .char => 8, |
| 3475 | 3445 | .short, .ushort => 16, |
| 3476 | 3446 | .int, .uint, .float => 32, |
| 3477 | | .long, .ulong, .longlong, .ulonglong, .double => 64, |
| 3478 | | .longdouble => 128, |
| 3479 | | }, |
| 3480 | | |
| 3481 | | .opencl, .vulkan => switch (c_type) { |
| 3482 | | .char => 8, |
| 3483 | | .short, .ushort => 16, |
| 3484 | | .int, .uint, .float => 32, |
| 3485 | | .long, .ulong, .double => 64, |
| 3486 | | .longlong, .ulonglong => 128, |
| 3487 | | // Note: The OpenCL specification does not guarantee a particular size for long double, |
| 3488 | | // but clang uses 128 bits. |
| 3489 | | .longdouble => 128, |
| 3490 | | }, |
| 3491 | | |
| 3492 | | .@"3ds" => switch (c_type) { |
| 3493 | | .char => 8, |
| 3494 | | .short, .ushort => 16, |
| 3495 | | .int, .uint, .float, .long, .ulong => 32, |
| 3447 | .long, .ulong => target.ptrBitWidth(), |
| 3496 | 3448 | .longlong, .ulonglong, .double, .longdouble => 64, |
| 3497 | 3449 | }, |
| 3498 | 3450 | |
| 3499 | | .wiiu => switch (c_type) { |
| 3451 | .gba, .@"3ds", .wiiu => switch (c_type) { |
| 3500 | 3452 | .char => 8, |
| 3501 | 3453 | .short, .ushort => 16, |
| 3502 | 3454 | .int, .uint, .float, .long, .ulong => 32, |
| 3503 | 3455 | .longlong, .ulonglong, .double, .longdouble => 64, |
| 3504 | 3456 | }, |
| 3505 | | |
| 3506 | 3457 | .@"switch" => switch (c_type) { |
| 3507 | 3458 | .char => 8, |
| 3508 | 3459 | .short, .ushort => 16, |
| ... | ... | @@ -3511,14 +3462,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3511 | 3462 | .longdouble => 128, |
| 3512 | 3463 | }, |
| 3513 | 3464 | |
| 3514 | | .gba => switch (c_type) { |
| 3515 | | .char => return 8, |
| 3516 | | .short, .ushort => return 16, |
| 3517 | | .int, .uint, .long, .ulong, .float => return 32, |
| 3518 | | .longlong, .ulonglong, .double, .longdouble => return 64, |
| 3519 | | }, |
| 3520 | | |
| 3521 | | .psx => switch (c_type) { |
| 3465 | .psx, .ps3, .psp, .vita => switch (c_type) { |
| 3522 | 3466 | .char => 8, |
| 3523 | 3467 | .short, .ushort => 16, |
| 3524 | 3468 | .int, .uint, .long, .ulong, .float => 32, |
| ... | ... | @@ -3528,17 +3472,10 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3528 | 3472 | .char => 8, |
| 3529 | 3473 | .short, .ushort => 16, |
| 3530 | 3474 | .int, .uint, .float => 32, |
| 3531 | | .long, .ulong => 64, |
| 3532 | | .longlong, .ulonglong, .double => 64, |
| 3475 | .long, .ulong, .longlong, .ulonglong, .double => 64, |
| 3533 | 3476 | .longdouble => 80, |
| 3534 | 3477 | }, |
| 3535 | | .psp, .vita => switch (c_type) { |
| 3536 | | .char => 8, |
| 3537 | | .short, .ushort => 16, |
| 3538 | | .int, .uint, .float => 32, |
| 3539 | | .long, .ulong => 64, |
| 3540 | | .longlong, .ulonglong, .double, .longdouble => 64, |
| 3541 | | }, |
| 3478 | |
| 3542 | 3479 | .tios => switch (c_type) { |
| 3543 | 3480 | .char => 8, |
| 3544 | 3481 | .short, .ushort => 16, |
| ... | ... | @@ -3548,10 +3485,6 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) ?u16 { |
| 3548 | 3485 | }, |
| 3549 | 3486 | |
| 3550 | 3487 | .opengl => null, |
| 3551 | | |
| 3552 | | .ps3, |
| 3553 | | .managarm, |
| 3554 | | => @panic("specify the C integer and float type sizes for this OS"), |
| 3555 | 3488 | }; |
| 3556 | 3489 | } |
| 3557 | 3490 | |
| ... | ... | @@ -3608,8 +3541,6 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) ?u16 { |
| 3608 | 3541 | .sheb, |
| 3609 | 3542 | .x86, |
| 3610 | 3543 | .xcore, |
| 3611 | | .xtensa, |
| 3612 | | .xtensaeb, |
| 3613 | 3544 | => 4, |
| 3614 | 3545 | |
| 3615 | 3546 | .amdgcn, |
| ... | ... | @@ -3630,6 +3561,8 @@ pub fn cTypeAlignment(target: *const Target, c_type: CType) ?u16 { |
| 3630 | 3561 | .sparc, |
| 3631 | 3562 | .thumb, |
| 3632 | 3563 | .thumbeb, |
| 3564 | .xtensa, |
| 3565 | .xtensaeb, |
| 3633 | 3566 | => 8, |
| 3634 | 3567 | |
| 3635 | 3568 | .aarch64, |