[lld] [LLD][COFF] Add /nodbgdirmerge to control debug directory section (PR #159235)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 02:56:32 PDT 2025


================
@@ -0,0 +1,33 @@
+RUN: yaml2obj %p/Inputs/pdb1.yaml -o %t1.obj
+RUN: yaml2obj %p/Inputs/pdb2.yaml -o %t2.obj
+RUN: rm -f %t.dll %t.pdb
+
+## Check that it emits the debug directory in .cvinfo section when
+## /nodbgdirmerge is specified
+RUN: lld-link /debug /pdb:%t.pdb /pdbaltpath:test.pdb /dll /out:%t.dll \
+RUN:   /entry:main /nodefaultlib /nodbgdirmerge %t1.obj %t2.obj
+RUN: llvm-readobj --sections %t.dll | FileCheck -check-prefix=CHECKNOTMERGED %s
+
+CHECKNOTMERGED:   Section {
+CHECKNOTMERGED:     Number: 3
+CHECKNOTMERGED-NEXT:     Name: .cvinfo
+CHECKNOTMERGED-NEXT:     VirtualSize: 0x3D
+CHECKNOTMERGED-NEXT:     VirtualAddress: 0x3000
+CHECKNOTMERGED-NEXT:     RawDataSize: 512
+CHECKNOTMERGED-NEXT:     PointerToRawData: 0x800
+CHECKNOTMERGED-NEXT:     PointerToRelocations: 0
+CHECKNOTMERGED-NEXT:     PointerToLineNumbers: 0
+CHECKNOTMERGED-NEXT:     RelocationCount: 0
+CHECKNOTMERGED-NEXT:     LineNumberCount: 0
----------------
mstorsjo wrote:

Yes, that would probably also suffice. I guess technically we maybe also could want to check the contents of the section (not only that the section exists but also contains roughly the expected contents), but you're right that the rest of these checks here are kinda redundant.

https://github.com/llvm/llvm-project/pull/159235


More information about the llvm-commits mailing list