[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:12:09 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:
This is fine as is - but as a general comment; it's also possible to make the test less prone to breaking on unrelated changes, by entirely omitting the values on the lines we're not interested in - it still matches the line so we can use `-NEXT` to keep things connected, but still matching those lines fuzzily.
Another potential approach is to skip `-NEXT` for the section we're not that interested in, then have e.g. `CHECKNOTMERGED: LineNumberCount:` `CHECKNOTMERGED-NEXT: Characteristics [ (0x40000040)`, so the check for `LineNumberCount:` certainly will match the next such line, and force the full exact match on `Characteristics` to still be the next one (i.e. in the same section).
https://github.com/llvm/llvm-project/pull/159235
More information about the llvm-commits
mailing list