aboutsummaryrefslogtreecommitdiff
path: root/src/link/Dwarf.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-10-19 22:41:59 +0200
committerJakub Konka <kubkon@jakubkonka.com>2023-10-19 22:41:59 +0200
commitf4f5e9edd69d3ca8f4d523ca6949487721a4e166 (patch)
tree0d0f4986b568c53d4b07bbf8e5a954ae7014d20a /src/link/Dwarf.zig
parenteb76ef58f80dffcba426b4668e9d658f10c00cb7 (diff)
downloadzig-f4f5e9edd69d3ca8f4d523ca6949487721a4e166.tar.gz
zig-f4f5e9edd69d3ca8f4d523ca6949487721a4e166.zip
dwarf: bring back realpath resolution of include dirs
Diffstat (limited to 'src/link/Dwarf.zig')
-rw-r--r--src/link/Dwarf.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig
index 76662f5bd7..b78243de74 100644
--- a/src/link/Dwarf.zig
+++ b/src/link/Dwarf.zig
@@ -2587,12 +2587,17 @@ fn genIncludeDirsAndFileNames(self: *Dwarf, arena: Allocator) !struct {
for (self.di_files.keys()) |dif| {
const full_path = try dif.mod.root.joinString(arena, dif.sub_file_path);
- // TODO re-investigate if realpath is needed here
const dir_path = std.fs.path.dirname(full_path) orelse ".";
const sub_file_path = std.fs.path.basename(full_path);
+ // TODO re-investigate if realpath is needed here
+ var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
+ const resolved = if (!std.fs.path.isAbsolute(dir_path))
+ std.os.realpath(dir_path, &buffer) catch dir_path
+ else
+ dir_path;
const dir_index: u28 = blk: {
- const dirs_gop = dirs.getOrPutAssumeCapacity(dir_path);
+ const dirs_gop = dirs.getOrPutAssumeCapacity(try arena.dupe(u8, resolved));
break :blk @as(u28, @intCast(dirs_gop.index + 1));
};