fixed backtraces when linking libc on mingw

master
emekoi 2019-07-27 17:50:44 -05:00
parent 5593c63e12
commit 10b1017702
1 changed files with 9 additions and 1 deletions

View File

@ -120,7 +120,15 @@ pub const Coff = struct {
pub fn getPdbPath(self: *Coff, buffer: []u8) !usize {
try self.loadSections();
const header = (self.getSection(".rdata") orelse return error.MissingCoffSection).header;
const header = blk: {
if (self.getSection(".buildid")) |section| {
break :blk section.header;
} else if (self.getSection(".rdata")) |section| {
break :blk section.header;
} else {
return error.MissingCoffSection;
}
};
// The linker puts a chunk that contains the .pdb path right after the
// debug_directory.