Commit 579301c2af
Changed files (3)
src/main.cpp
@@ -979,8 +979,7 @@ int main(int argc, char **argv) {
return print_error_usage(arg0);
}
} else {
- // Default cross-compiling glibc version
- *target.glibc_version = {2, 17, 0};
+ target_init_default_glibc_version(&target);
}
} else if (target_glibc != nullptr) {
fprintf(stderr, "'%s' is not a glibc-compatible target", target_string);
src/target.cpp
@@ -524,7 +524,7 @@ void get_native_target(ZigTarget *target) {
}
if (target_is_glibc(target)) {
target->glibc_version = allocate<ZigGLibCVersion>(1);
- *target->glibc_version = {2, 17, 0};
+ target_init_default_glibc_version(target);
#ifdef ZIG_OS_LINUX
Error err;
if ((err = glibc_detect_native_version(target->glibc_version))) {
@@ -534,6 +534,10 @@ void get_native_target(ZigTarget *target) {
}
}
+void target_init_default_glibc_version(ZigTarget *target) {
+ *target->glibc_version = {2, 17, 0};
+}
+
Error target_parse_archsub(ZigLLVM_ArchType *out_arch, ZigLLVM_SubArchType *out_sub,
const char *archsub_ptr, size_t archsub_len)
{
src/target.hpp
@@ -114,6 +114,7 @@ Error target_parse_os(Os *os, const char *os_ptr, size_t os_len);
Error target_parse_abi(ZigLLVM_EnvironmentType *abi, const char *abi_ptr, size_t abi_len);
Error target_parse_glibc_version(ZigGLibCVersion *out, const char *text);
+void target_init_default_glibc_version(ZigTarget *target);
size_t target_arch_count(void);
ZigLLVM_ArchType target_arch_enum(size_t index);