| ... | ... | @@ -1035,9 +1035,6 @@ pub const InitOptions = struct { |
| 1035 | 1035 | /// (Darwin) remove dylibs that are unreachable by the entry point or exported symbols |
| 1036 | 1036 | dead_strip_dylibs: bool = false, |
| 1037 | 1037 | libcxx_abi_version: libcxx.AbiVersion = libcxx.AbiVersion.default, |
| 1038 | | /// (Windows) PDB source path prefix to instruct the linker how to resolve relative |
| 1039 | | /// paths when consolidating CodeView streams into a single PDB file. |
| 1040 | | pdb_source_path: ?[]const u8 = null, |
| 1041 | 1038 | }; |
| 1042 | 1039 | |
| 1043 | 1040 | fn addPackageTableToCacheHash( |
| ... | ... | @@ -1740,27 +1737,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1740 | 1737 | }; |
| 1741 | 1738 | }; |
| 1742 | 1739 | |
| 1743 | | const pdb_source_path: ?[]const u8 = options.pdb_source_path orelse blk: { |
| 1744 | | if (builtin.target.os.tag == .windows) { |
| 1745 | | // PDB requires all file paths to be fully resolved, and it is really the |
| 1746 | | // linker's responsibility to canonicalize any path extracted from the CodeView |
| 1747 | | // in the object file. However, LLD-link has some very questionable defaults, and |
| 1748 | | // in particular, it purposely bakes in path separator of the host system it was |
| 1749 | | // built on rather than the targets, or just throw an error. Thankfully, they have |
| 1750 | | // left a backdoor we can use via -PDBSOURCEPATH. |
| 1751 | | const mod = module orelse break :blk null; |
| 1752 | | var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined; |
| 1753 | | const resolved_path = if (mod.main_pkg.root_src_directory.path) |base_path| p: { |
| 1754 | | if (std.fs.path.isAbsolute(base_path)) break :blk base_path; |
| 1755 | | const resolved_path = std.os.realpath(base_path, &buffer) catch break :blk null; |
| 1756 | | const pos = std.mem.lastIndexOfLinear(u8, resolved_path, base_path) orelse resolved_path.len; |
| 1757 | | break :p resolved_path[0..pos]; |
| 1758 | | } else std.os.realpath(".", &buffer) catch break :blk null; |
| 1759 | | break :blk try arena.dupe(u8, resolved_path); |
| 1760 | | } |
| 1761 | | break :blk null; |
| 1762 | | }; |
| 1763 | | |
| 1764 | 1740 | const implib_emit: ?link.Emit = blk: { |
| 1765 | 1741 | const emit_implib = options.emit_implib orelse break :blk null; |
| 1766 | 1742 | |
| ... | ... | @@ -1906,7 +1882,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1906 | 1882 | .headerpad_max_install_names = options.headerpad_max_install_names, |
| 1907 | 1883 | .dead_strip_dylibs = options.dead_strip_dylibs, |
| 1908 | 1884 | .force_undefined_symbols = .{}, |
| 1909 | | .pdb_source_path = pdb_source_path, |
| 1910 | 1885 | }); |
| 1911 | 1886 | errdefer bin_file.destroy(); |
| 1912 | 1887 | comp.* = .{ |