Skip to content

Commit cd7713b

Browse files
committed
make --target-os freestanding work
1 parent 0cf0739 commit cd7713b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/target.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,22 @@ static int get_arch_pointer_bit_width(ZigLLVM_ArchType arch) {
433433
int get_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
434434
switch (target->os) {
435435
case ZigLLVM_UnknownOS:
436-
zig_unreachable();
436+
switch (id) {
437+
case CIntTypeShort:
438+
case CIntTypeUShort:
439+
return 16;
440+
case CIntTypeInt:
441+
case CIntTypeUInt:
442+
return 32;
443+
case CIntTypeLong:
444+
case CIntTypeULong:
445+
return get_arch_pointer_bit_width(target->arch.arch);
446+
case CIntTypeLongLong:
447+
case CIntTypeULongLong:
448+
return 64;
449+
case CIntTypeCount:
450+
zig_unreachable();
451+
}
437452
case ZigLLVM_Linux:
438453
case ZigLLVM_Darwin:
439454
switch (id) {

0 commit comments

Comments
 (0)