Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lld/COFF/PDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,9 +1135,12 @@ static pdb::BulkPublic createPublic(COFFLinkerContext &ctx, Defined *def) {
pub.setFlags(flags);

OutputSection *os = ctx.getOutputSection(def->getChunk());
assert(os && "all publics should be in final image");
pub.Offset = def->getRVA() - os->getRVA();
pub.Segment = os->sectionIndex;
assert((os || !def->getChunk()->getSize()) &&
"all publics should be in final image");
if (os) {
pub.Offset = def->getRVA() - os->getRVA();
pub.Segment = os->sectionIndex;
}
return pub;
}

Expand Down
19 changes: 19 additions & 0 deletions lld/test/COFF/pdb-empty-sec.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// REQUIRES: x86

// RUN: llvm-mc -filetype=obj -triple=x86_64-windows %s -o %t.obj
// RUN: lld-link -dll -noentry -debug %t.obj -out:%t.dll
// RUN: llvm-pdbutil dump -publics %t.pdb | FileCheck %s

// CHECK: Records
// CHECK-NEXT: 0 | S_PUB32 [size = 20] `func`
// CHECK-NEXT: flags = none, addr = 0001:0000
// CHECK-NEXT: 20 | S_PUB32 [size = 20] `sym`
// CHECK-NEXT: flags = none, addr = 0000:0000

.globl sym
.data
sym:
.text
.globl func
func:
ret
Loading