| ... | @@ -492,6 +492,9 @@ Error target_parse_glibc_version(ZigGLibCVersion *glibc_ver, const char *text) { | ... | @@ -492,6 +492,9 @@ Error target_parse_glibc_version(ZigGLibCVersion *glibc_ver, const char *text) { |
| 492 | } | 492 | } |
| 493 | | 493 | |
| 494 | void get_native_target(ZigTarget *target) { | 494 | void get_native_target(ZigTarget *target) { |
| | 495 | // first zero initialize |
| | 496 | *target = {}; |
| | 497 | |
| 495 | ZigLLVM_OSType os_type; | 498 | ZigLLVM_OSType os_type; |
| 496 | ZigLLVM_ObjectFormatType oformat; // ignored; based on arch/os | 499 | ZigLLVM_ObjectFormatType oformat; // ignored; based on arch/os |
| 497 | ZigLLVMGetNativeTarget( | 500 | ZigLLVMGetNativeTarget( |
| ... | @@ -506,7 +509,6 @@ void get_native_target(ZigTarget *target) { | ... | @@ -506,7 +509,6 @@ void get_native_target(ZigTarget *target) { |
| 506 | if (target->abi == ZigLLVM_UnknownEnvironment) { | 509 | if (target->abi == ZigLLVM_UnknownEnvironment) { |
| 507 | target->abi = target_default_abi(target->arch, target->os); | 510 | target->abi = target_default_abi(target->arch, target->os); |
| 508 | } | 511 | } |
| 509 | target->glibc_version = nullptr; | | |
| 510 | if (target_is_glibc(target)) { | 512 | if (target_is_glibc(target)) { |
| 511 | target->glibc_version = allocate<ZigGLibCVersion>(1); | 513 | target->glibc_version = allocate<ZigGLibCVersion>(1); |
| 512 | *target->glibc_version = {2, 17, 0}; | 514 | *target->glibc_version = {2, 17, 0}; |
| ... | @@ -703,6 +705,10 @@ Error target_parse_abi(ZigLLVM_EnvironmentType *out_abi, const char *abi_ptr, si | ... | @@ -703,6 +705,10 @@ Error target_parse_abi(ZigLLVM_EnvironmentType *out_abi, const char *abi_ptr, si |
| 703 | | 705 | |
| 704 | Error target_parse_triple(ZigTarget *target, const char *triple) { | 706 | Error target_parse_triple(ZigTarget *target, const char *triple) { |
| 705 | Error err; | 707 | Error err; |
| | 708 | |
| | 709 | // first initialize all to zero |
| | 710 | *target = {}; |
| | 711 | |
| 706 | SplitIterator it = memSplit(str(triple), str("-")); | 712 | SplitIterator it = memSplit(str(triple), str("-")); |
| 707 | | 713 | |
| 708 | Optional<Slice<uint8_t>> opt_archsub = SplitIterator_next(&it); | 714 | Optional<Slice<uint8_t>> opt_archsub = SplitIterator_next(&it); |
| ... | @@ -732,9 +738,6 @@ Error target_parse_triple(ZigTarget *target, const char *triple) { | ... | @@ -732,9 +738,6 @@ Error target_parse_triple(ZigTarget *target, const char *triple) { |
| 732 | } else { | 738 | } else { |
| 733 | target->abi = target_default_abi(target->arch, target->os); | 739 | target->abi = target_default_abi(target->arch, target->os); |
| 734 | } | 740 | } |
| 735 | | | |
| 736 | target->vendor = ZigLLVM_UnknownVendor; | | |
| 737 | target->is_native = false; | | |
| 738 | return ErrorNone; | 741 | return ErrorNone; |
| 739 | } | 742 | } |
| 740 | | 743 | |