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