authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-28 02:36:16-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-28 14:51:56-05:00
logef24f2dd93729493531c427aaac54444597f6e66
treee78381294ccbf2d54c4f9c144f939e6d70a9039d
parentd45ea4d89d7232fc4bcf56a5e088d7d6b5004ebb
signature Commit is signed but in an unrecognized format.

remove special darwin os version min handling

now it is integrated with zig's target OS range.

15 files changed, 95 insertions(+), 228 deletions(-)

lib/std/target.zig+18-3
......@@ -147,7 +147,6 @@ pub const Target = struct {
147147 .cloudabi,
148148 .dragonfly,
149149 .fuchsia,
150 .ios,
151150 .kfreebsd,
152151 .lv2,
153152 .solaris,
......@@ -162,8 +161,6 @@ pub const Target = struct {
162161 .amdhsa,
163162 .ps4,
164163 .elfiamcu,
165 .tvos,
166 .watchos,
167164 .mesa3d,
168165 .contiki,
169166 .amdpal,
......@@ -187,6 +184,24 @@ pub const Target = struct {
187184 .max = .{ .major = 10, .minor = 15, .patch = 3 },
188185 },
189186 },
187 .ios => return .{
188 .semver = .{
189 .min = .{ .major = 12, .minor = 0 },
190 .max = .{ .major = 13, .minor = 4, .patch = 0 },
191 },
192 },
193 .watchos => return .{
194 .semver = .{
195 .min = .{ .major = 6, .minor = 0 },
196 .max = .{ .major = 6, .minor = 2, .patch = 0 },
197 },
198 },
199 .tvos => return .{
200 .semver = .{
201 .min = .{ .major = 13, .minor = 0 },
202 .max = .{ .major = 13, .minor = 4, .patch = 0 },
203 },
204 },
190205 .netbsd => return .{
191206 .semver = .{
192207 .min = .{ .major = 8, .minor = 0 },
lib/std/zig/cross_target.zig+3-3
......@@ -88,7 +88,6 @@ pub const CrossTarget = struct {
8888 .cloudabi,
8989 .dragonfly,
9090 .fuchsia,
91 .ios,
9291 .kfreebsd,
9392 .lv2,
9493 .solaris,
......@@ -103,8 +102,6 @@ pub const CrossTarget = struct {
103102 .amdhsa,
104103 .ps4,
105104 .elfiamcu,
106 .tvos,
107 .watchos,
108105 .mesa3d,
109106 .contiki,
110107 .amdpal,
......@@ -121,8 +118,11 @@ pub const CrossTarget = struct {
121118
122119 .freebsd,
123120 .macosx,
121 .ios,
124122 .netbsd,
125123 .openbsd,
124 .tvos,
125 .watchos,
126126 => {
127127 self.os_version_min = .{ .semver = os.version_range.semver.min };
128128 self.os_version_max = .{ .semver = os.version_range.semver.max };
src-self-hosted/stage2.zig+26-13
......@@ -892,7 +892,7 @@ const Stage2Target = extern struct {
892892
893893 is_native: bool,
894894
895 glibc_version: ?*Stage2GLibCVersion, // null means default
895 glibc_or_darwin_version: ?*Stage2SemVer,
896896
897897 llvm_cpu_name: ?[*:0]const u8,
898898 llvm_cpu_features: ?[*:0]const u8,
......@@ -1103,16 +1103,29 @@ const Stage2Target = extern struct {
11031103 os_builtin_str_buffer.toSlice()[os_builtin_str_ver_start_index..os_builtin_str_buffer.len()],
11041104 );
11051105
1106 const glibc_version = if (target.isGnuLibC()) blk: {
1107 const stage1_glibc = try std.heap.c_allocator.create(Stage2GLibCVersion);
1108 const stage2_glibc = target.os.version_range.linux.glibc;
1109 stage1_glibc.* = .{
1110 .major = stage2_glibc.major,
1111 .minor = stage2_glibc.minor,
1112 .patch = stage2_glibc.patch,
1113 };
1114 break :blk stage1_glibc;
1115 } else null;
1106 const glibc_or_darwin_version = blk: {
1107 if (target.isGnuLibC()) {
1108 const stage1_glibc = try std.heap.c_allocator.create(Stage2SemVer);
1109 const stage2_glibc = target.os.version_range.linux.glibc;
1110 stage1_glibc.* = .{
1111 .major = stage2_glibc.major,
1112 .minor = stage2_glibc.minor,
1113 .patch = stage2_glibc.patch,
1114 };
1115 break :blk stage1_glibc;
1116 } else if (target.isDarwin()) {
1117 const stage1_semver = try std.heap.c_allocator.create(Stage2SemVer);
1118 const stage2_semver = target.os.version_range.semver.min;
1119 stage1_semver.* = .{
1120 .major = stage2_semver.major,
1121 .minor = stage2_semver.minor,
1122 .patch = stage2_semver.patch,
1123 };
1124 break :blk stage1_semver;
1125 } else {
1126 break :blk null;
1127 }
1128 };
11161129
11171130 self.* = .{
11181131 .arch = @enumToInt(target.cpu.arch) + 1, // skip over ZigLLVM_UnknownArch
......@@ -1125,7 +1138,7 @@ const Stage2Target = extern struct {
11251138 .os_builtin_str = os_builtin_str_buffer.toOwnedSlice().ptr,
11261139 .cache_hash = cache_hash.toOwnedSlice().ptr,
11271140 .is_native = cross_target.isNative(),
1128 .glibc_version = glibc_version,
1141 .glibc_or_darwin_version = glibc_or_darwin_version,
11291142 .dynamic_linker = dynamic_linker,
11301143 };
11311144 }
......@@ -1179,7 +1192,7 @@ fn crossTargetToTarget(cross_target: CrossTarget, dynamic_linker_ptr: *?[*:0]u8)
11791192}
11801193
11811194// ABI warning
1182const Stage2GLibCVersion = extern struct {
1195const Stage2SemVer = extern struct {
11831196 major: u32,
11841197 minor: u32,
11851198 patch: u32,
src/all_types.hpp-2
......@@ -2250,8 +2250,6 @@ struct CodeGen {
22502250 bool test_is_evented;
22512251 CodeModel code_model;
22522252
2253 Buf *mmacosx_version_min;
2254 Buf *mios_version_min;
22552253 Buf *root_out_name;
22562254 Buf *test_filter;
22572255 Buf *test_name_prefix;
src/codegen.cpp+8-51
......@@ -32,31 +32,6 @@ enum ResumeId {
3232 ResumeIdCall,
3333};
3434
35static void init_darwin_native(CodeGen *g) {
36 char *osx_target = getenv("MACOSX_DEPLOYMENT_TARGET");
37 char *ios_target = getenv("IPHONEOS_DEPLOYMENT_TARGET");
38
39 // Allow conflicts among OSX and iOS, but choose the default platform.
40 if (osx_target && ios_target) {
41 if (g->zig_target->arch == ZigLLVM_arm ||
42 g->zig_target->arch == ZigLLVM_aarch64 ||
43 g->zig_target->arch == ZigLLVM_thumb)
44 {
45 osx_target = nullptr;
46 } else {
47 ios_target = nullptr;
48 }
49 }
50
51 if (osx_target) {
52 g->mmacosx_version_min = buf_create_from_str(osx_target);
53 } else if (ios_target) {
54 g->mios_version_min = buf_create_from_str(ios_target);
55 } else if (g->zig_target->os != OsIOS) {
56 g->mmacosx_version_min = buf_create_from_str("10.14");
57 }
58}
59
6035static ZigPackage *new_package(const char *root_src_dir, const char *root_src_path, const char *pkg_path) {
6136 ZigPackage *entry = heap::c_allocator.create<ZigPackage>();
6237 entry->package_table.init(4);
......@@ -160,14 +135,6 @@ void codegen_add_framework(CodeGen *g, const char *framework) {
160135 g->darwin_frameworks.append(buf_create_from_str(framework));
161136}
162137
163void codegen_set_mmacosx_version_min(CodeGen *g, Buf *mmacosx_version_min) {
164 g->mmacosx_version_min = mmacosx_version_min;
165}
166
167void codegen_set_mios_version_min(CodeGen *g, Buf *mios_version_min) {
168 g->mios_version_min = mios_version_min;
169}
170
171138void codegen_set_rdynamic(CodeGen *g, bool rdynamic) {
172139 g->linker_rdynamic = rdynamic;
173140}
......@@ -8655,10 +8622,10 @@ static Error define_builtin_compile_vars(CodeGen *g) {
86558622 if (g->zig_target->cache_hash != nullptr) {
86568623 cache_str(&cache_hash, g->zig_target->cache_hash);
86578624 }
8658 if (g->zig_target->glibc_version != nullptr) {
8659 cache_int(&cache_hash, g->zig_target->glibc_version->major);
8660 cache_int(&cache_hash, g->zig_target->glibc_version->minor);
8661 cache_int(&cache_hash, g->zig_target->glibc_version->patch);
8625 if (g->zig_target->glibc_or_darwin_version != nullptr) {
8626 cache_int(&cache_hash, g->zig_target->glibc_or_darwin_version->major);
8627 cache_int(&cache_hash, g->zig_target->glibc_or_darwin_version->minor);
8628 cache_int(&cache_hash, g->zig_target->glibc_or_darwin_version->patch);
86628629 }
86638630 cache_bool(&cache_hash, g->have_err_ret_tracing);
86648631 cache_bool(&cache_hash, g->libc_link_lib != nullptr);
......@@ -10313,10 +10280,10 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
1031310280 if (g->zig_target->cache_hash != nullptr) {
1031410281 cache_str(ch, g->zig_target->cache_hash);
1031510282 }
10316 if (g->zig_target->glibc_version != nullptr) {
10317 cache_int(ch, g->zig_target->glibc_version->major);
10318 cache_int(ch, g->zig_target->glibc_version->minor);
10319 cache_int(ch, g->zig_target->glibc_version->patch);
10283 if (g->zig_target->glibc_or_darwin_version != nullptr) {
10284 cache_int(ch, g->zig_target->glibc_or_darwin_version->major);
10285 cache_int(ch, g->zig_target->glibc_or_darwin_version->minor);
10286 cache_int(ch, g->zig_target->glibc_or_darwin_version->patch);
1032010287 }
1032110288 cache_int(ch, detect_subsystem(g));
1032210289 cache_bool(ch, g->strip_debug_symbols);
......@@ -10344,8 +10311,6 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
1034410311 cache_bool(ch, g->emit_bin);
1034510312 cache_bool(ch, g->emit_llvm_ir);
1034610313 cache_bool(ch, g->emit_asm);
10347 cache_buf_opt(ch, g->mmacosx_version_min);
10348 cache_buf_opt(ch, g->mios_version_min);
1034910314 cache_usize(ch, g->version_major);
1035010315 cache_usize(ch, g->version_minor);
1035110316 cache_usize(ch, g->version_patch);
......@@ -10662,9 +10627,6 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
1066210627
1066310628 codegen_set_errmsg_color(child_gen, parent_gen->err_color);
1066410629
10665 codegen_set_mmacosx_version_min(child_gen, parent_gen->mmacosx_version_min);
10666 codegen_set_mios_version_min(child_gen, parent_gen->mios_version_min);
10667
1066810630 child_gen->enable_cache = true;
1066910631
1067010632 return child_gen;
......@@ -10772,11 +10734,6 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget
1077210734 g->each_lib_rpath = false;
1077310735 } else {
1077410736 g->each_lib_rpath = true;
10775
10776 if (target_os_is_darwin(g->zig_target->os)) {
10777 init_darwin_native(g);
10778 }
10779
1078010737 }
1078110738
1078210739 if (target_os_requires_libc(g->zig_target->os)) {
src/codegen.hpp-2
......@@ -35,8 +35,6 @@ LinkLib *codegen_add_link_lib(CodeGen *codegen, Buf *lib);
3535void codegen_add_framework(CodeGen *codegen, const char *name);
3636void codegen_add_rpath(CodeGen *codegen, const char *name);
3737void codegen_set_rdynamic(CodeGen *g, bool rdynamic);
38void codegen_set_mmacosx_version_min(CodeGen *g, Buf *mmacosx_version_min);
39void codegen_set_mios_version_min(CodeGen *g, Buf *mios_version_min);
4038void codegen_set_linker_script(CodeGen *g, const char *linker_script);
4139void codegen_set_test_filter(CodeGen *g, Buf *filter);
4240void codegen_set_test_name_prefix(CodeGen *g, Buf *prefix);
src/glibc.cpp+13-13
......@@ -55,7 +55,7 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo
5555 Optional<Slice<uint8_t>> opt_component = SplitIterator_next(&it);
5656 if (!opt_component.is_some) break;
5757 Buf *ver_buf = buf_create_from_slice(opt_component.value);
58 ZigGLibCVersion *this_ver = glibc_abi->all_versions.add_one();
58 Stage2SemVer *this_ver = glibc_abi->all_versions.add_one();
5959 if ((err = target_parse_glibc_version(this_ver, buf_ptr(ver_buf)))) {
6060 if (verbose) {
6161 fprintf(stderr, "Unable to parse glibc version '%s': %s\n", buf_ptr(ver_buf), err_str(err));
......@@ -186,9 +186,9 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con
186186 cache_buf(cache_hash, compiler_id);
187187 cache_int(cache_hash, target->arch);
188188 cache_int(cache_hash, target->abi);
189 cache_int(cache_hash, target->glibc_version->major);
190 cache_int(cache_hash, target->glibc_version->minor);
191 cache_int(cache_hash, target->glibc_version->patch);
189 cache_int(cache_hash, target->glibc_or_darwin_version->major);
190 cache_int(cache_hash, target->glibc_or_darwin_version->minor);
191 cache_int(cache_hash, target->glibc_or_darwin_version->patch);
192192
193193 Buf digest = BUF_INIT;
194194 buf_resize(&digest, 0);
......@@ -224,10 +224,10 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con
224224
225225 uint8_t target_ver_index = 0;
226226 for (;target_ver_index < glibc_abi->all_versions.length; target_ver_index += 1) {
227 const ZigGLibCVersion *this_ver = &glibc_abi->all_versions.at(target_ver_index);
228 if (this_ver->major == target->glibc_version->major &&
229 this_ver->minor == target->glibc_version->minor &&
230 this_ver->patch == target->glibc_version->patch)
227 const Stage2SemVer *this_ver = &glibc_abi->all_versions.at(target_ver_index);
228 if (this_ver->major == target->glibc_or_darwin_version->major &&
229 this_ver->minor == target->glibc_or_darwin_version->minor &&
230 this_ver->patch == target->glibc_or_darwin_version->patch)
231231 {
232232 break;
233233 }
......@@ -235,9 +235,9 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con
235235 if (target_ver_index == glibc_abi->all_versions.length) {
236236 if (verbose) {
237237 fprintf(stderr, "Unrecognized glibc version: %d.%d.%d\n",
238 target->glibc_version->major,
239 target->glibc_version->minor,
240 target->glibc_version->patch);
238 target->glibc_or_darwin_version->major,
239 target->glibc_or_darwin_version->minor,
240 target->glibc_or_darwin_version->patch);
241241 }
242242 return ErrorUnknownABI;
243243 }
......@@ -246,7 +246,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con
246246 Buf *map_contents = buf_alloc();
247247
248248 for (uint8_t ver_i = 0; ver_i < glibc_abi->all_versions.length; ver_i += 1) {
249 const ZigGLibCVersion *ver = &glibc_abi->all_versions.at(ver_i);
249 const Stage2SemVer *ver = &glibc_abi->all_versions.at(ver_i);
250250 if (ver->patch == 0) {
251251 buf_appendf(map_contents, "GLIBC_%d.%d { };\n", ver->major, ver->minor);
252252 } else {
......@@ -294,7 +294,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con
294294 uint8_t ver_index = ver_list->versions[ver_i];
295295
296296 Buf *stub_name;
297 const ZigGLibCVersion *ver = &glibc_abi->all_versions.at(ver_index);
297 const Stage2SemVer *ver = &glibc_abi->all_versions.at(ver_index);
298298 const char *sym_name = buf_ptr(libc_fn->name);
299299 if (ver->patch == 0) {
300300 stub_name = buf_sprintf("%s_%d_%d", sym_name, ver->major, ver->minor);
src/glibc.hpp+1-1
......@@ -32,7 +32,7 @@ struct ZigGLibCAbi {
3232 Buf *abi_txt_path;
3333 Buf *vers_txt_path;
3434 Buf *fns_txt_path;
35 ZigList<ZigGLibCVersion> all_versions;
35 ZigList<Stage2SemVer> all_versions;
3636 ZigList<ZigGLibCFn> all_functions;
3737 // The value is a pointer to all_functions.length items and each item is an index
3838 // into all_functions.
src/link.cpp+17-110
......@@ -2371,99 +2371,6 @@ static void construct_linker_job_coff(LinkJob *lj) {
23712371 }
23722372}
23732373
2374
2375// Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and return the
2376// grouped values as integers. Numbers which are not provided are set to 0.
2377// return true if the entire string was parsed (9.2), or all groups were
2378// parsed (10.3.5extrastuff).
2379static bool darwin_get_release_version(const char *str, int *major, int *minor, int *micro, bool *had_extra) {
2380 *had_extra = false;
2381
2382 *major = 0;
2383 *minor = 0;
2384 *micro = 0;
2385
2386 if (*str == '\0')
2387 return false;
2388
2389 char *end;
2390 *major = (int)strtol(str, &end, 10);
2391 if (*str != '\0' && *end == '\0')
2392 return true;
2393 if (*end != '.')
2394 return false;
2395
2396 str = end + 1;
2397 *minor = (int)strtol(str, &end, 10);
2398 if (*str != '\0' && *end == '\0')
2399 return true;
2400 if (*end != '.')
2401 return false;
2402
2403 str = end + 1;
2404 *micro = (int)strtol(str, &end, 10);
2405 if (*str != '\0' && *end == '\0')
2406 return true;
2407 if (str == end)
2408 return false;
2409 *had_extra = true;
2410 return true;
2411}
2412
2413enum DarwinPlatformKind {
2414 MacOS,
2415 IPhoneOS,
2416 IPhoneOSSimulator,
2417};
2418
2419struct DarwinPlatform {
2420 DarwinPlatformKind kind;
2421 int major;
2422 int minor;
2423 int micro;
2424};
2425
2426static void get_darwin_platform(LinkJob *lj, DarwinPlatform *platform) {
2427 CodeGen *g = lj->codegen;
2428
2429 if (g->mmacosx_version_min) {
2430 platform->kind = MacOS;
2431 } else if (g->mios_version_min) {
2432 platform->kind = IPhoneOS;
2433 } else if (g->zig_target->os == OsMacOSX) {
2434 platform->kind = MacOS;
2435 g->mmacosx_version_min = buf_create_from_str("10.14");
2436 } else {
2437 zig_panic("unable to infer -mmacosx-version-min or -mios-version-min");
2438 }
2439
2440 bool had_extra;
2441 if (platform->kind == MacOS) {
2442 if (!darwin_get_release_version(buf_ptr(g->mmacosx_version_min),
2443 &platform->major, &platform->minor, &platform->micro, &had_extra) ||
2444 had_extra || platform->major != 10 || platform->minor >= 100 || platform->micro >= 100)
2445 {
2446 zig_panic("invalid -mmacosx-version-min");
2447 }
2448 } else if (platform->kind == IPhoneOS) {
2449 if (!darwin_get_release_version(buf_ptr(g->mios_version_min),
2450 &platform->major, &platform->minor, &platform->micro, &had_extra) ||
2451 had_extra || platform->major >= 10 || platform->minor >= 100 || platform->micro >= 100)
2452 {
2453 zig_panic("invalid -mios-version-min");
2454 }
2455 } else {
2456 zig_unreachable();
2457 }
2458
2459 if (platform->kind == IPhoneOS &&
2460 (g->zig_target->arch == ZigLLVM_x86 ||
2461 g->zig_target->arch == ZigLLVM_x86_64))
2462 {
2463 platform->kind = IPhoneOSSimulator;
2464 }
2465}
2466
24672374static void construct_linker_job_macho(LinkJob *lj) {
24682375 CodeGen *g = lj->codegen;
24692376
......@@ -2507,25 +2414,25 @@ static void construct_linker_job_macho(LinkJob *lj) {
25072414 lj->args.append("-arch");
25082415 lj->args.append(get_darwin_arch_string(g->zig_target));
25092416
2510 DarwinPlatform platform;
2511 get_darwin_platform(lj, &platform);
2512 switch (platform.kind) {
2513 case MacOS:
2417 if (g->zig_target->glibc_or_darwin_version != nullptr) {
2418 if (g->zig_target->os == OsMacOSX) {
25142419 lj->args.append("-macosx_version_min");
2515 break;
2516 case IPhoneOS:
2517 lj->args.append("-iphoneos_version_min");
2518 break;
2519 case IPhoneOSSimulator:
2520 lj->args.append("-ios_simulator_version_min");
2521 break;
2522 }
2523 Buf *version_string = buf_sprintf("%d.%d.%d", platform.major, platform.minor, platform.micro);
2524 lj->args.append(buf_ptr(version_string));
2525
2526 lj->args.append("-sdk_version");
2527 lj->args.append(buf_ptr(version_string));
2420 } else if (g->zig_target->os == OsIOS) {
2421 if (g->zig_target->arch == ZigLLVM_x86 || g->zig_target->arch == ZigLLVM_x86_64) {
2422 lj->args.append("-ios_simulator_version_min");
2423 } else {
2424 lj->args.append("-iphoneos_version_min");
2425 }
2426 }
2427 Buf *version_string = buf_sprintf("%d.%d.%d",
2428 g->zig_target->glibc_or_darwin_version->major,
2429 g->zig_target->glibc_or_darwin_version->minor,
2430 g->zig_target->glibc_or_darwin_version->patch);
2431 lj->args.append(buf_ptr(version_string));
25282432
2433 lj->args.append("-sdk_version");
2434 lj->args.append(buf_ptr(version_string));
2435 }
25292436
25302437 if (g->out_type == OutTypeExe) {
25312438 lj->args.append("-pie");
src/main.cpp-20
......@@ -127,8 +127,6 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
127127 " --subsystem [subsystem] (windows) /SUBSYSTEM:<subsystem> to the linker\n"
128128 " -F[dir] (darwin) add search path for frameworks\n"
129129 " -framework [name] (darwin) link against framework\n"
130 " -mios-version-min [ver] (darwin) set iOS deployment target\n"
131 " -mmacosx-version-min [ver] (darwin) set Mac OS X deployment target\n"
132130 " --ver-major [ver] dynamic library semver major version\n"
133131 " --ver-minor [ver] dynamic library semver minor version\n"
134132 " --ver-patch [ver] dynamic library semver patch version\n"
......@@ -414,8 +412,6 @@ static int main0(int argc, char **argv) {
414412 bool have_libc = false;
415413 const char *target_string = nullptr;
416414 bool rdynamic = false;
417 const char *mmacosx_version_min = nullptr;
418 const char *mios_version_min = nullptr;
419415 const char *linker_script = nullptr;
420416 Buf *version_script = nullptr;
421417 ZigList<const char *> rpath_list = {0};
......@@ -844,10 +840,6 @@ static int main0(int argc, char **argv) {
844840 cache_dir = argv[i];
845841 } else if (strcmp(arg, "-target") == 0) {
846842 target_string = argv[i];
847 } else if (strcmp(arg, "-mmacosx-version-min") == 0) {
848 mmacosx_version_min = argv[i];
849 } else if (strcmp(arg, "-mios-version-min") == 0) {
850 mios_version_min = argv[i];
851843 } else if (strcmp(arg, "-framework") == 0) {
852844 frameworks.append(argv[i]);
853845 } else if (strcmp(arg, "--linker-script") == 0) {
......@@ -1240,18 +1232,6 @@ static int main0(int argc, char **argv) {
12401232 }
12411233
12421234 codegen_set_rdynamic(g, rdynamic);
1243 if (mmacosx_version_min && mios_version_min) {
1244 fprintf(stderr, "-mmacosx-version-min and -mios-version-min options not allowed together\n");
1245 return main_exit(root_progress_node, EXIT_FAILURE);
1246 }
1247
1248 if (mmacosx_version_min) {
1249 codegen_set_mmacosx_version_min(g, buf_create_from_str(mmacosx_version_min));
1250 }
1251
1252 if (mios_version_min) {
1253 codegen_set_mios_version_min(g, buf_create_from_str(mios_version_min));
1254 }
12551235
12561236 if (test_filter) {
12571237 codegen_set_test_filter(g, buf_create_from_str(test_filter));
src/stage2.cpp+1-1
......@@ -186,7 +186,7 @@ static void get_native_target(ZigTarget *target) {
186186 target->abi = target_default_abi(target->arch, target->os);
187187 }
188188 if (target_is_glibc(target)) {
189 target->glibc_version = heap::c_allocator.create<ZigGLibCVersion>();
189 target->glibc_or_darwin_version = heap::c_allocator.create<Stage2SemVer>();
190190 target_init_default_glibc_version(target);
191191 }
192192}
src/stage2.h+4-5
......@@ -270,14 +270,12 @@ enum Os {
270270};
271271
272272// ABI warning
273struct ZigGLibCVersion {
274 uint32_t major; // always 2
273struct Stage2SemVer {
274 uint32_t major;
275275 uint32_t minor;
276276 uint32_t patch;
277277};
278278
279struct Stage2TargetData;
280
281279// ABI warning
282280struct ZigTarget {
283281 enum ZigLLVM_ArchType arch;
......@@ -288,7 +286,8 @@ struct ZigTarget {
288286
289287 bool is_native;
290288
291 struct ZigGLibCVersion *glibc_version; // null means default
289 // null means default. this is double-purposed to be darwin min version
290 struct Stage2SemVer *glibc_or_darwin_version;
292291
293292 const char *llvm_cpu_name;
294293 const char *llvm_cpu_features;
src/target.cpp+2-2
......@@ -347,7 +347,7 @@ const char *target_abi_name(ZigLLVM_EnvironmentType abi) {
347347 return ZigLLVMGetEnvironmentTypeName(abi);
348348}
349349
350Error target_parse_glibc_version(ZigGLibCVersion *glibc_ver, const char *text) {
350Error target_parse_glibc_version(Stage2SemVer *glibc_ver, const char *text) {
351351 glibc_ver->major = 2;
352352 glibc_ver->minor = 0;
353353 glibc_ver->patch = 0;
......@@ -371,7 +371,7 @@ Error target_parse_glibc_version(ZigGLibCVersion *glibc_ver, const char *text) {
371371}
372372
373373void target_init_default_glibc_version(ZigTarget *target) {
374 *target->glibc_version = {2, 17, 0};
374 *target->glibc_or_darwin_version = {2, 17, 0};
375375}
376376
377377Error target_parse_arch(ZigLLVM_ArchType *out_arch, const char *arch_ptr, size_t arch_len) {
src/target.hpp+1-1
......@@ -46,7 +46,7 @@ Error target_parse_arch(ZigLLVM_ArchType *arch, const char *arch_ptr, size_t arc
4646Error target_parse_os(Os *os, const char *os_ptr, size_t os_len);
4747Error target_parse_abi(ZigLLVM_EnvironmentType *abi, const char *abi_ptr, size_t abi_len);
4848
49Error target_parse_glibc_version(ZigGLibCVersion *out, const char *text);
49Error target_parse_glibc_version(Stage2SemVer *out, const char *text);
5050void target_init_default_glibc_version(ZigTarget *target);
5151
5252size_t target_arch_count(void);
test/cli.zig+1-1
......@@ -92,7 +92,7 @@ fn testZigInitLib(zig_exe: []const u8, dir_path: []const u8) !void {
9292fn testZigInitExe(zig_exe: []const u8, dir_path: []const u8) !void {
9393 _ = try exec(dir_path, &[_][]const u8{ zig_exe, "init-exe" });
9494 const run_result = try exec(dir_path, &[_][]const u8{ zig_exe, "build", "run" });
95 testing.expect(std.mem.eql(u8, run_result.stderr, "All your base are belong to us.\n"));
95 testing.expect(std.mem.eql(u8, run_result.stderr, "All your codebase are belong to us.\n"));
9696}
9797
9898fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void {