diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-11-29 15:28:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-29 15:28:54 -0500 |
| commit | a47aa9dd9d7f950427aacc360f1302e636234bc2 (patch) | |
| tree | a3e4a4fcab9e49f6adb8a5cfdc719f51b5ea4fd4 /lib/std/Target.zig | |
| parent | c3821fe4ca8d98d07454fddf2bf25bfc8d7817f2 (diff) | |
| parent | 78b8ce5095abf6516dc414b8cf487acedbd0ce99 (diff) | |
| download | zig-a47aa9dd9d7f950427aacc360f1302e636234bc2.tar.gz zig-a47aa9dd9d7f950427aacc360f1302e636234bc2.zip | |
Merge pull request #22095 from alexrp/test-llvm-emit
Change `llvm_targets` tests to actually emit objects, and fix bugs found as a result
Diffstat (limited to 'lib/std/Target.zig')
| -rw-r--r-- | lib/std/Target.zig | 77 |
1 files changed, 60 insertions, 17 deletions
diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 8e9bfd273c..c5a800097d 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -2884,19 +2884,29 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { }, }, + .elfiamcu, + .fuchsia, + .hermit, + + .aix, + .haiku, + .hurd, .linux, + .plan9, + .rtems, + .serenity, + .zos, + .freebsd, - .netbsd, .dragonfly, + .netbsd, .openbsd, + + .illumos, + .solaris, + .wasi, .emscripten, - .plan9, - .solaris, - .illumos, - .haiku, - .fuchsia, - .serenity, => switch (target.cpu.arch) { .msp430 => switch (c_type) { .char => return 8, @@ -2941,7 +2951,10 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { .longdouble => switch (target.cpu.arch) { .x86 => switch (target.abi) { .android => return 64, - else => return 80, + else => switch (target.os.tag) { + .elfiamcu => return 64, + else => return 80, + }, }, .powerpc, @@ -2955,7 +2968,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { .muslx32, => return 64, else => switch (target.os.tag) { - .freebsd, .netbsd, .openbsd => return 64, + .aix, .freebsd, .netbsd, .openbsd => return 64, else => return 128, }, }, @@ -2971,7 +2984,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { .muslx32, => return 64, else => switch (target.os.tag) { - .freebsd, .openbsd => return 64, + .aix, .freebsd, .openbsd => return 64, else => return 128, }, }, @@ -3049,10 +3062,17 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { .gnux32, .muslx32 => return 32, else => return 64, }, - else => return 64, + else => switch (target.abi) { + .ilp32 => return 32, + else => return 64, + }, }, .longlong, .ulonglong, .double => return 64, .longdouble => switch (target.cpu.arch) { + .aarch64 => switch (target.os.tag) { + .bridgeos => return 128, + else => return 64, + }, .x86 => switch (target.abi) { .android => return 64, else => return 80, @@ -3104,13 +3124,7 @@ pub fn cTypeBitSize(target: Target, c_type: CType) u16 { }, .ps3, - .zos, - .rtems, - .aix, - .elfiamcu, .contiki, - .hermit, - .hurd, .opengl, => @panic("TODO specify the C integer and float type sizes for this OS"), } @@ -3121,6 +3135,10 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 { switch (target.cpu.arch) { .avr => return 1, .x86 => switch (target.os.tag) { + .elfiamcu => switch (c_type) { + .longlong, .ulonglong, .double => return 4, + else => {}, + }, .windows, .uefi => switch (c_type) { .longlong, .ulonglong, .double => return 8, .longdouble => switch (target.abi) { @@ -3131,6 +3149,20 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 { }, else => {}, }, + .powerpc, .powerpcle, .powerpc64, .powerpc64le => switch (target.os.tag) { + .aix => switch (c_type) { + .double, .longdouble => return 4, + else => {}, + }, + else => {}, + }, + .wasm32, .wasm64 => switch (target.os.tag) { + .emscripten => switch (c_type) { + .longdouble => return 8, + else => {}, + }, + else => {}, + }, else => {}, } @@ -3244,6 +3276,10 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { }, .avr => return 1, .x86 => switch (target.os.tag) { + .elfiamcu => switch (c_type) { + .longlong, .ulonglong, .double, .longdouble => return 4, + else => {}, + }, .windows, .uefi => switch (c_type) { .longdouble => switch (target.abi) { .gnu, .gnuilp32, .ilp32, .cygnus => return 4, @@ -3256,6 +3292,13 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 { else => {}, }, }, + .wasm32, .wasm64 => switch (target.os.tag) { + .emscripten => switch (c_type) { + .longdouble => return 8, + else => {}, + }, + else => {}, + }, else => {}, } |
