| ... | ... | @@ -855,7 +855,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void { |
| 855 | 855 | } |
| 856 | 856 | // Write the form for the compile unit, which must match the abbrev table above. |
| 857 | 857 | const name_strp = try self.makeDebugString(module.root_pkg.root_src_path); |
| 858 | | const comp_dir_strp = try self.makeDebugString(module.root_pkg.root_src_directory.path.?); |
| 858 | const comp_dir_strp = try self.makeDebugString(module.root_pkg.root_src_directory.path orelse "."); |
| 859 | 859 | const producer_strp = try self.makeDebugString(link.producer_string); |
| 860 | 860 | // Currently only one compilation unit is supported, so the address range is simply |
| 861 | 861 | // identical to the main program header virtual address and memory size. |
| ... | ... | @@ -2858,11 +2858,12 @@ fn dbgLineNeededHeaderBytes(self: Elf) u32 { |
| 2858 | 2858 | const file_name_entry_format_count = 1; |
| 2859 | 2859 | const directory_count = 1; |
| 2860 | 2860 | const file_name_count = 1; |
| 2861 | const root_src_dir_path_len = if (self.base.options.module.?.root_pkg.root_src_directory.path) |p| p.len else 1; // "." |
| 2861 | 2862 | return @intCast(u32, 53 + directory_entry_format_count * 2 + file_name_entry_format_count * 2 + |
| 2862 | 2863 | directory_count * 8 + file_name_count * 8 + |
| 2863 | 2864 | // These are encoded as DW.FORM_string rather than DW.FORM_strp as we would like |
| 2864 | 2865 | // because of a workaround for readelf and gdb failing to understand DWARFv5 correctly. |
| 2865 | | self.base.options.module.?.root_pkg.root_src_directory.path.?.len + |
| 2866 | root_src_dir_path_len + |
| 2866 | 2867 | self.base.options.module.?.root_pkg.root_src_path.len); |
| 2867 | 2868 | } |
| 2868 | 2869 | |