| ... | @@ -613,6 +613,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { | ... | @@ -613,6 +613,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 613 | cache.hash.addBytes(options.target.cpu.model.name); | 613 | cache.hash.addBytes(options.target.cpu.model.name); |
| 614 | cache.hash.add(options.target.cpu.features.ints); | 614 | cache.hash.add(options.target.cpu.features.ints); |
| 615 | cache.hash.add(options.target.os.tag); | 615 | cache.hash.add(options.target.os.tag); |
| | 616 | cache.hash.add(options.target.os.getVersionRange()); |
| 616 | cache.hash.add(options.is_native_os); | 617 | cache.hash.add(options.is_native_os); |
| 617 | cache.hash.add(options.target.abi); | 618 | cache.hash.add(options.target.abi); |
| 618 | cache.hash.add(ofmt); | 619 | cache.hash.add(ofmt); |
| ... | @@ -642,7 +643,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { | ... | @@ -642,7 +643,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 642 | hash.addOptionalBytes(root_pkg.root_src_directory.path); | 643 | hash.addOptionalBytes(root_pkg.root_src_directory.path); |
| 643 | hash.add(valgrind); | 644 | hash.add(valgrind); |
| 644 | hash.add(single_threaded); | 645 | hash.add(single_threaded); |
| 645 | hash.add(options.target.os.getVersionRange()); | | |
| 646 | hash.add(dll_export_fns); | 646 | hash.add(dll_export_fns); |
| 647 | hash.add(options.is_test); | 647 | hash.add(options.is_test); |
| 648 | hash.add(options.is_compiler_rt_or_libc); | 648 | hash.add(options.is_compiler_rt_or_libc); |
| ... | @@ -1619,7 +1619,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_comp_progress_node: * | ... | @@ -1619,7 +1619,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_comp_progress_node: * |
| 1619 | const out_dep_path: ?[]const u8 = if (comp.disable_c_depfile or !ext.clangSupportsDepFile()) | 1619 | const out_dep_path: ?[]const u8 = if (comp.disable_c_depfile or !ext.clangSupportsDepFile()) |
| 1620 | null | 1620 | null |
| 1621 | else | 1621 | else |
| 1622 | try std.fmt.allocPrint(arena, "{}.d", .{out_obj_path}); | 1622 | try std.fmt.allocPrint(arena, "{s}.d", .{out_obj_path}); |
| 1623 | try comp.addCCArgs(arena, &argv, ext, out_dep_path); | 1623 | try comp.addCCArgs(arena, &argv, ext, out_dep_path); |
| 1624 | | 1624 | |
| 1625 | try argv.ensureCapacity(argv.items.len + 3); | 1625 | try argv.ensureCapacity(argv.items.len + 3); |
| ... | @@ -1849,10 +1849,39 @@ pub fn addCCArgs( | ... | @@ -1849,10 +1849,39 @@ pub fn addCCArgs( |
| 1849 | try argv.append(try std.fmt.allocPrint(arena, "-mcmodel={}", .{@tagName(mcmodel)})); | 1849 | try argv.append(try std.fmt.allocPrint(arena, "-mcmodel={}", .{@tagName(mcmodel)})); |
| 1850 | } | 1850 | } |
| 1851 | | 1851 | |
| 1852 | // windows.h has files such as pshpack1.h which do #pragma packing, triggering a clang warning. | 1852 | switch (target.os.tag) { |
| 1853 | // So for this target, we disable this warning. | 1853 | .windows => { |
| 1854 | if (target.os.tag == .windows and target.abi.isGnu()) { | 1854 | // windows.h has files such as pshpack1.h which do #pragma packing, |
| 1855 | try argv.append("-Wno-pragma-pack"); | 1855 | // triggering a clang warning. So for this target, we disable this warning. |
| | 1856 | if (target.abi.isGnu()) { |
| | 1857 | try argv.append("-Wno-pragma-pack"); |
| | 1858 | } |
| | 1859 | }, |
| | 1860 | .macos => { |
| | 1861 | // Pass the proper -m<os>-version-min argument for darwin. |
| | 1862 | const ver = target.os.version_range.semver.min; |
| | 1863 | try argv.append(try std.fmt.allocPrint(arena, "-mmacos-version-min={d}.{d}.{d}", .{ |
| | 1864 | ver.major, ver.minor, ver.patch, |
| | 1865 | })); |
| | 1866 | }, |
| | 1867 | .ios, .tvos, .watchos => switch (target.cpu.arch) { |
| | 1868 | // Pass the proper -m<os>-version-min argument for darwin. |
| | 1869 | .i386, .x86_64 => { |
| | 1870 | const ver = target.os.version_range.semver.min; |
| | 1871 | try argv.append(try std.fmt.allocPrint( |
| | 1872 | arena, |
| | 1873 | "-m{s}-simulator-version-min={d}.{d}.{d}", |
| | 1874 | .{ @tagName(target.os.tag), ver.major, ver.minor, ver.patch }, |
| | 1875 | )); |
| | 1876 | }, |
| | 1877 | else => { |
| | 1878 | const ver = target.os.version_range.semver.min; |
| | 1879 | try argv.append(try std.fmt.allocPrint(arena, "-m{s}-version-min={d}.{d}.{d}", .{ |
| | 1880 | @tagName(target.os.tag), ver.major, ver.minor, ver.patch, |
| | 1881 | })); |
| | 1882 | }, |
| | 1883 | }, |
| | 1884 | else => {}, |
| 1856 | } | 1885 | } |
| 1857 | | 1886 | |
| 1858 | if (!comp.bin_file.options.strip) { | 1887 | if (!comp.bin_file.options.strip) { |