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
8 changes: 5 additions & 3 deletions lld/COFF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,9 +1215,11 @@ void Writer::createMiscChunks() {
// if we're ultimately not going to write CodeView data to the PDB.
buildId = make<CVDebugRecordChunk>(ctx);
debugRecords.emplace_back(COFF::IMAGE_DEBUG_TYPE_CODEVIEW, buildId);
if (Symbol *buildidSym = ctx.symtab.findUnderscore("__buildid"))
replaceSymbol<DefinedSynthetic>(buildidSym, buildidSym->getName(),
buildId, 4);
ctx.forEachSymtab([&](SymbolTable &symtab) {
if (Symbol *buildidSym = symtab.findUnderscore("__buildid"))
replaceSymbol<DefinedSynthetic>(buildidSym, buildidSym->getName(),
buildId, 4);
});
}

if (config->cetCompat) {
Expand Down
14 changes: 14 additions & 0 deletions lld/test/COFF/arm64x-buildid.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# REQUIRES: aarch64
# RUN: llvm-mc -triple=aarch64-windows -filetype=obj -o %t-arm64.obj %s
# RUN: llvm-mc -triple=arm64ec-windows -filetype=obj -o %t-arm64ec.obj %s

# RUN: lld-link -machine:arm64x -dll -noentry %t-arm64.obj %t-arm64ec.obj -debug -build-id -Brepro -out:%t.dll
# RUN: llvm-readobj --hex-dump=.test %t.dll | FileCheck %s
# CHECK: 0x180003000 3c100000 3c100000

.section .test,"dr"
.rva __buildid

.section .bss,"bw",discard,__buildid
.global __buildid
__buildid: