[clang] a3036b3 - Re-Re-land: [CodeView] Add full repro to LF_BUILDINFO record

Alexandre Ganea via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 10:36:45 PDT 2020


Author: Alexandre Ganea
Date: 2020-08-10T13:36:30-04:00
New Revision: a3036b386383f1c1e9d32c2c8dba995087959da3

URL: https://github.com/llvm/llvm-project/commit/a3036b386383f1c1e9d32c2c8dba995087959da3
DIFF: https://github.com/llvm/llvm-project/commit/a3036b386383f1c1e9d32c2c8dba995087959da3.diff

LOG: Re-Re-land: [CodeView] Add full repro to LF_BUILDINFO record

This patch adds the missing information to the LF_BUILDINFO record, which allows for rebuilding a .CPP without any external dependency but the .OBJ itself (other than the compiler).

Some external tools that we are using (Recode, Live++) are extracting the information to reproduce a build without any knowledge of the build system. The LF_BUILDINFO stores a full path to the compiler, the PWD (CWD at program startup), a relative or absolute path to the TU, and the full CC1 command line. The command line needs to be freestanding (not depend on any environment variables). In the same way, MSVC doesn't store the provided command-line, but an expanded version (somehow their equivalent of CC1) which is also freestanding.

For more information see PR36198 and D43002.

Differential Revision: https://reviews.llvm.org/D80833

Added: 
    clang/test/CodeGen/debug-info-codeview-buildinfo.c
    lld/test/COFF/pdb-relative-source-lines2.test

Modified: 
    clang/cmake/caches/BaremetalARM.cmake
    clang/cmake/caches/CrossWinToARMLinux.cmake
    clang/cmake/caches/Fuchsia-stage2.cmake
    clang/test/CMakeLists.txt
    lld/COFF/PDB.cpp
    lld/test/COFF/Inputs/pdb_lines_1_relative.yaml
    lld/test/COFF/Inputs/pdb_lines_2_relative.yaml
    lld/test/COFF/pdb-relative-source-lines.test
    llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    llvm/test/DebugInfo/COFF/build-info.ll
    llvm/test/DebugInfo/COFF/global-type-hashes.ll
    llvm/test/DebugInfo/COFF/types-basic.ll
    llvm/test/DebugInfo/COFF/types-data-members.ll

Removed: 
    


################################################################################
diff  --git a/clang/cmake/caches/BaremetalARM.cmake b/clang/cmake/caches/BaremetalARM.cmake
index 85295d9db392a..e44355cfcbd74 100644
--- a/clang/cmake/caches/BaremetalARM.cmake
+++ b/clang/cmake/caches/BaremetalARM.cmake
@@ -31,6 +31,7 @@ set(LLVM_TOOLCHAIN_TOOLS
   llvm-dwarfdump
   llvm-nm
   llvm-objdump
+  llvm-pdbutil
   llvm-ranlib
   llvm-readobj
   llvm-size

diff  --git a/clang/cmake/caches/CrossWinToARMLinux.cmake b/clang/cmake/caches/CrossWinToARMLinux.cmake
index 9aa0efa8049fb..ccfccce3cb890 100644
--- a/clang/cmake/caches/CrossWinToARMLinux.cmake
+++ b/clang/cmake/caches/CrossWinToARMLinux.cmake
@@ -137,6 +137,7 @@ set(LLVM_TOOLCHAIN_TOOLS
   llvm-lib
   llvm-nm
   llvm-objdump
+  llvm-pdbutil
   llvm-profdata
   llvm-ranlib
   llvm-readobj

diff  --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index e00b64073ca52..7cefeedf1bada 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -242,6 +242,7 @@ set(LLVM_TOOLCHAIN_TOOLS
   llvm-nm
   llvm-objcopy
   llvm-objdump
+  llvm-pdbutil
   llvm-profdata
   llvm-rc
   llvm-ranlib

diff  --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 38bbc5be90d52..b2777fded0ae5 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -126,6 +126,7 @@ if( NOT CLANG_BUILT_STANDALONE )
     llvm-nm
     llvm-objcopy
     llvm-objdump
+    llvm-pdbutil
     llvm-profdata
     llvm-readelf
     llvm-readobj

diff  --git a/clang/test/CodeGen/debug-info-codeview-buildinfo.c b/clang/test/CodeGen/debug-info-codeview-buildinfo.c
new file mode 100644
index 0000000000000..93810e829c6d9
--- /dev/null
+++ b/clang/test/CodeGen/debug-info-codeview-buildinfo.c
@@ -0,0 +1,26 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cl --target=i686-windows-msvc /c /Z7 /Fo%t.obj -- %s
+// RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s
+// RUN: %clang_cl --target=i686-windows-msvc /c /Z7 /Fo%t.obj -fdebug-compilation-dir=. -- %s
+// RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s --check-prefix RELATIVE
+
+int main() { return 42; }
+
+// CHECK:                       Types (.debug$T)
+// CHECK: ============================================================
+// CHECK: 0x[[PWD:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[PWDVAL:.+]]
+// CHECK: 0x[[FILEPATH:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[FILEPATHVAL:.+[\\/]debug-info-codeview-buildinfo.c]]
+// CHECK: 0x[[ZIPDB:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String:
+// CHECK: 0x[[TOOL:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[TOOLVAL:.+[\\/]clang.*]]
+// CHECK: 0x[[CMDLINE:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: "-cc1
+// CHECK: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
+// CHECK:          0x[[PWD]]: `[[PWDVAL]]`
+// CHECK:          0x[[TOOL]]: `[[TOOLVAL]]`
+// CHECK:          0x[[FILEPATH]]: `[[FILEPATHVAL]]`
+// CHECK:          0x[[ZIPDB]]: ``
+// CHECK:          0x[[CMDLINE]]: `"-cc1
+
+// RELATIVE:                       Types (.debug$T)
+// RELATIVE: ============================================================
+// RELATIVE: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
+// RELATIVE:          0x{{.+}}: `.`

diff  --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index 49d04add5be04..5738eae7d6c40 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -250,6 +250,72 @@ static void addTypeInfo(pdb::TpiStreamBuilder &tpiBuilder,
   });
 }
 
+// LF_BUILDINFO records might contain relative paths, and we want to make them
+// absolute. We do this remapping only after the type records were merged,
+// because the full types graph isn't known during merging. In addition, we plan
+// to multi-thread the type merging, and the change below needs to be done
+// atomically, single-threaded.
+
+// A complication could arise when a LF_STRING_ID record already exists with the
+// same content as the new absolutized path. In that case, we simply redirect
+// LF_BUILDINFO's CurrentDirectory index to reference the existing LF_STRING_ID
+// record.
+
+static void remapBuildInfo(TypeCollection &idTable) {
+  SimpleTypeSerializer s;
+  idTable.ForEachRecord([&](TypeIndex ti, const CVType &type) {
+    if (type.kind() != LF_BUILDINFO)
+      return;
+    BuildInfoRecord bi;
+    cantFail(TypeDeserializer::deserializeAs(const_cast<CVType &>(type), bi));
+
+    auto makeAbsoluteRecord =
+        [&](BuildInfoRecord::BuildInfoArg recordType) -> Optional<TypeIndex> {
+      TypeIndex recordTi = bi.getArgs()[recordType];
+      if (recordTi.isNoneType())
+        return None;
+      CVType recordRef = idTable.getType(recordTi);
+
+      StringIdRecord record;
+      cantFail(TypeDeserializer::deserializeAs(recordRef, record));
+
+      SmallString<128> abolutizedPath(record.getString());
+      pdbMakeAbsolute(abolutizedPath);
+
+      if (abolutizedPath == record.getString())
+        return None; // The path is already absolute.
+
+      record.String = abolutizedPath;
+      ArrayRef<uint8_t> recordData = s.serialize(record);
+
+      // Replace the previous LF_STRING_ID record
+      if (!idTable.replaceType(recordTi, CVType(recordData),
+                               /*Stabilize=*/true))
+        return recordTi;
+      return None;
+    };
+
+    Optional<TypeIndex> curDirTI =
+        makeAbsoluteRecord(BuildInfoRecord::CurrentDirectory);
+    Optional<TypeIndex> buildToolTI =
+        makeAbsoluteRecord(BuildInfoRecord::BuildTool);
+
+    if (curDirTI || buildToolTI) {
+      // This new record is already there. We don't want duplicates, so
+      // re-serialize the BuildInfoRecord instead.
+      if (curDirTI)
+        bi.ArgIndices[BuildInfoRecord::CurrentDirectory] = *curDirTI;
+      if (buildToolTI)
+        bi.ArgIndices[BuildInfoRecord::BuildTool] = *buildToolTI;
+
+      ArrayRef<uint8_t> biData = s.serialize(bi);
+      bool r = idTable.replaceType(ti, CVType(biData), /*Stabilize=*/true);
+      assert(r && "Didn't expect two build records pointing to the same OBJ!");
+      (void)r;
+    }
+  });
+}
+
 static bool remapTypeIndex(TypeIndex &ti, ArrayRef<TypeIndex> typeIndexMap) {
   if (ti.isSimple())
     return true;
@@ -988,6 +1054,9 @@ void PDBLinker::addObjectsToPDB() {
   builder.getStringTableBuilder().setStrings(pdbStrTab);
   t1.stop();
 
+  // Remap the contents of the LF_BUILDINFO record.
+  remapBuildInfo(tMerger.getIDTable());
+
   // Construct TPI and IPI stream contents.
   ScopedTimer t2(tpiStreamLayoutTimer);
   addTypeInfo(builder.getTpiBuilder(), tMerger.getTypeTable());

diff  --git a/lld/test/COFF/Inputs/pdb_lines_1_relative.yaml b/lld/test/COFF/Inputs/pdb_lines_1_relative.yaml
index 947de419d6b8b..9a6b192e1d0d2 100644
--- a/lld/test/COFF/Inputs/pdb_lines_1_relative.yaml
+++ b/lld/test/COFF/Inputs/pdb_lines_1_relative.yaml
@@ -19,6 +19,7 @@ sections:
     Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
     Alignment:       4
     SectionData:     ''
+    SizeOfRawData:   0
   - Name:            .xdata
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
     Alignment:       4
@@ -38,7 +39,6 @@ sections:
   - Name:            '.debug$S'
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
     Alignment:       4
-    SectionData:     04000000F10000002F0000002D003C1100000000D0000700000000000000581B000000000000636C616E672076657273696F6E20372E302E30200000F1000000300000002A0047110000000000000000000000001B000000000000000000000002100000000000000000006D61696E0002004F11F20000003000000000000000000000001B00000000000000030000002400000000000000020000000C000000030000001100000004000000F400000030000000010000001001EA6429BCE282CCF3F0E3CD93B216EB410000110000001001061EB73ABB642532857A4F1D9CBAC3230000F30000001C000000002E5C7064625F6C696E65735F312E63002E5C666F6F2E6800000000
     Subsections:
       - !Symbols
         Records:
@@ -46,15 +46,15 @@ sections:
             Compile3Sym:
               Flags:           [  ]
               Machine:         X64
-              FrontendMajor:   7
+              FrontendMajor:   11
               FrontendMinor:   0
               FrontendBuild:   0
               FrontendQFE:     0
-              BackendMajor:    7000
+              BackendMajor:    11000
               BackendMinor:    0
               BackendBuild:    0
               BackendQFE:      0
-              Version:         'clang version 7.0.0 '
+              Version:         'clang version 11.0.0 (https://github.com/llvm/llvm-project.git 77dad72eae974338ddc13d74783c012ccbb8c5ac)'
       - !Symbols
         Records:
           - Kind:            S_GPROC32_ID
@@ -65,8 +65,17 @@ sections:
               FunctionType:    4098
               Flags:           [  ]
               DisplayName:     main
+          - Kind:            S_FRAMEPROC
+            FrameProcSym:
+              TotalFrameBytes: 40
+              PaddingFrameBytes: 0
+              OffsetToPadding: 0
+              BytesOfCalleeSavedRegisters: 0
+              OffsetOfExceptionHandler: 0
+              SectionIdOfExceptionHandler: 0
+              Flags:           [  ]
           - Kind:            S_PROC_ID_END
-            ScopeEndSym:
+            ScopeEndSym:     {}
       - !Lines
         CodeSize:        27
         Flags:           [  ]
@@ -87,15 +96,15 @@ sections:
                 LineStart:       4
                 IsStatement:     false
                 EndDelta:        0
-            Columns:
+            Columns:         []
       - !FileChecksums
         Checksums:
           - FileName:        '.\pdb_lines_1.c'
             Kind:            MD5
-            Checksum:        EA6429BCE282CCF3F0E3CD93B216EB41
+            Checksum:        9A64DD4298487888B1D99F825D520C5E
           - FileName:        '.\foo.h'
             Kind:            MD5
-            Checksum:        061EB73ABB642532857A4F1D9CBAC323
+            Checksum:        A9D05E6DC184DE20A57797E24F8B0E97
       - !StringTable
         Strings:
           - '.\pdb_lines_1.c'
@@ -103,23 +112,27 @@ sections:
           - ''
           - ''
           - ''
+      - !Symbols
+        Records:
+          - Kind:            S_BUILDINFO
+            BuildInfoSym:
+              BuildId:         4105
     Relocations:
-      - VirtualAddress:  100
+      - VirtualAddress:  184
         SymbolName:      main
         Type:            IMAGE_REL_AMD64_SECREL
-      - VirtualAddress:  104
+      - VirtualAddress:  188
         SymbolName:      main
         Type:            IMAGE_REL_AMD64_SECTION
-      - VirtualAddress:  124
+      - VirtualAddress:  240
         SymbolName:      main
         Type:            IMAGE_REL_AMD64_SECREL
-      - VirtualAddress:  128
+      - VirtualAddress:  244
         SymbolName:      main
         Type:            IMAGE_REL_AMD64_SECTION
   - Name:            '.debug$T'
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
     Alignment:       4
-    SectionData:     0400000006000112000000000E0008107400000000000000001000001200011600000000011000006D61696E00F3F2F10E0008100300000000000000001000000E0001160000000003100000666F6F00
     Types:
       - Kind:            LF_ARGLIST
         ArgList:
@@ -148,6 +161,25 @@ sections:
           ParentScope:     0
           FunctionType:    4099
           Name:            foo
+      - Kind:            LF_STRING_ID
+        StringId:
+          Id:              0
+          String:          .
+      - Kind:            LF_STRING_ID
+        StringId:
+          Id:              0
+          String:          pdb_lines_1.c
+      - Kind:            LF_STRING_ID
+        StringId:
+          Id:              0
+          String:          'buildninjaRel\bin\clang-cl.exe'
+      - Kind:            LF_STRING_ID
+        StringId:
+          Id:              0
+          String:          '"-cc1" "-triple" "x86_64-pc-windows-msvc19.26.28806" "-emit-obj" "-mrelax-all" "-mincremental-linker-compatible" "-disable-free" "-main-file-name" "pdb_lines_1.c" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mframe-pointer=none" "-relaxed-aliasing" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-mllvm" "-x86-asm-syntax=intel" "-D_MT" "-flto-visibility-public-std" "--dependent-lib=libcmt" "--dependent-lib=oldnames" "-stack-protector" "2" "-fms-volatile" "-fdiagnostics-format" "msvc" "-gcodeview" "-debug-info-kind=limited" "-resource-dir" "D:\\llvm-project\\buildninjaRel\\lib\\clang\\11.0.0" "-internal-isystem" "D:\\llvm-project\\buildninjaRel\\lib\\clang\\11.0.0\\include" "-internal-isystem" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.26.28801\\ATLMFC\\include" "-internal-isystem" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.26.28801\\include" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\ucrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\shared" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\um" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\winrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\cppwinrt" "-fdebug-compilation-dir" "." "-ferror-limit" "19" "-fmessage-length=146" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility" "-fms-compatibility-version=19.26.28806" "-fdelayed-template-parsing" "-fcolor-diagnostics" "-faddrsig" "-x" "c"'
+      - Kind:            LF_BUILDINFO
+        BuildInfo:
+          ArgIndices:      [ 4101, 4103, 4102, 0, 4104 ]
   - Name:            .pdata
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
     Alignment:       4
@@ -160,8 +192,12 @@ sections:
         SymbolName:      main
         Type:            IMAGE_REL_AMD64_ADDR32NB
       - VirtualAddress:  8
-        SymbolName:      .xdata
+        SymbolTableIndex: 6
         Type:            IMAGE_REL_AMD64_ADDR32NB
+  - Name:            .llvm_addrsig
+    Characteristics: [ IMAGE_SCN_LNK_REMOVE ]
+    Alignment:       1
+    SectionData:     0A1D
   - Name:            .xdata
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ]
     Alignment:       4
@@ -169,7 +205,6 @@ sections:
   - Name:            '.debug$S'
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
     Alignment:       4
-    SectionData:     04000000F10000002F000000290047110000000000000000000000000F00000000000000000000000410000000000000000000666F6F0002004F1100F20000003000000000000000000000000F000000180000000300000024000000000000000200000004000000030000000900000004000000
     Subsections:
       - !Symbols
         Records:
@@ -181,8 +216,17 @@ sections:
               FunctionType:    4100
               Flags:           [  ]
               DisplayName:     foo
+          - Kind:            S_FRAMEPROC
+            FrameProcSym:
+              TotalFrameBytes: 40
+              PaddingFrameBytes: 0
+              OffsetToPadding: 0
+              BytesOfCalleeSavedRegisters: 0
+              OffsetOfExceptionHandler: 0
+              SectionIdOfExceptionHandler: 0
+              Flags:           [  ]
           - Kind:            S_PROC_ID_END
-            ScopeEndSym:
+            ScopeEndSym:     {}
       - !Lines
         CodeSize:        15
         Flags:           [  ]
@@ -203,7 +247,7 @@ sections:
                 LineStart:       4
                 IsStatement:     false
                 EndDelta:        0
-            Columns:
+            Columns:         []
     Relocations:
       - VirtualAddress:  44
         SymbolName:      foo
@@ -211,10 +255,10 @@ sections:
       - VirtualAddress:  48
         SymbolName:      foo
         Type:            IMAGE_REL_AMD64_SECTION
-      - VirtualAddress:  68
+      - VirtualAddress:  100
         SymbolName:      foo
         Type:            IMAGE_REL_AMD64_SECREL
-      - VirtualAddress:  72
+      - VirtualAddress:  104
         SymbolName:      foo
         Type:            IMAGE_REL_AMD64_SECTION
   - Name:            .pdata
@@ -229,7 +273,7 @@ sections:
         SymbolName:      foo
         Type:            IMAGE_REL_AMD64_ADDR32NB
       - VirtualAddress:  8
-        SymbolName:      .xdata
+        SymbolTableIndex: 11
         Type:            IMAGE_REL_AMD64_ADDR32NB
 symbols:
   - Name:            .text
@@ -301,7 +345,7 @@ symbols:
     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
   - Name:            .xdata
     Value:           0
-    SectionNumber:   10
+    SectionNumber:   11
     SimpleType:      IMAGE_SYM_TYPE_NULL
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_STATIC
@@ -331,22 +375,22 @@ symbols:
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_STATIC
     SectionDefinition:
-      Length:          264
+      Length:          396
       NumberOfRelocations: 4
       NumberOfLinenumbers: 0
-      CheckSum:        2204933783
+      CheckSum:        3390249978
       Number:          7
   - Name:            '.debug$S'
     Value:           0
-    SectionNumber:   11
+    SectionNumber:   12
     SimpleType:      IMAGE_SYM_TYPE_NULL
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_STATIC
     SectionDefinition:
-      Length:          116
+      Length:          148
       NumberOfRelocations: 4
       NumberOfLinenumbers: 0
-      CheckSum:        2691661839
+      CheckSum:        1236081121
       Number:          5
       Selection:       IMAGE_COMDAT_SELECT_ASSOCIATIVE
   - Name:            '.debug$T'
@@ -356,10 +400,10 @@ symbols:
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_STATIC
     SectionDefinition:
-      Length:          80
+      Length:          2028
       NumberOfRelocations: 0
       NumberOfLinenumbers: 0
-      CheckSum:        3541780432
+      CheckSum:        2043733667
       Number:          8
   - Name:            .pdata
     Value:           0
@@ -375,7 +419,7 @@ symbols:
       Number:          9
   - Name:            .pdata
     Value:           0
-    SectionNumber:   12
+    SectionNumber:   13
     SimpleType:      IMAGE_SYM_TYPE_NULL
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_STATIC
@@ -386,6 +430,24 @@ symbols:
       CheckSum:        3642757804
       Number:          5
       Selection:       IMAGE_COMDAT_SELECT_ASSOCIATIVE
+  - Name:            .llvm_addrsig
+    Value:           0
+    SectionNumber:   10
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_STATIC
+    SectionDefinition:
+      Length:          2
+      NumberOfRelocations: 0
+      NumberOfLinenumbers: 0
+      CheckSum:        2582217811
+      Number:          10
+  - Name:            '@feat.00'
+    Value:           0
+    SectionNumber:   -1
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_STATIC
   - Name:            main
     Value:           0
     SectionNumber:   1
@@ -398,4 +460,11 @@ symbols:
     SimpleType:      IMAGE_SYM_TYPE_NULL
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
+  - Name:            .file
+    Value:           0
+    SectionNumber:   -2
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_FILE
+    File:            pdb_lines_1.c
 ...

diff  --git a/lld/test/COFF/Inputs/pdb_lines_2_relative.yaml b/lld/test/COFF/Inputs/pdb_lines_2_relative.yaml
index 1b051d82d9a46..71ce5d63f5087 100644
--- a/lld/test/COFF/Inputs/pdb_lines_2_relative.yaml
+++ b/lld/test/COFF/Inputs/pdb_lines_2_relative.yaml
@@ -15,6 +15,7 @@ sections:
     Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
     Alignment:       4
     SectionData:     ''
+    SizeOfRawData:   0
   - Name:            .drectve
     Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
     Alignment:       1
@@ -22,7 +23,6 @@ sections:
   - Name:            '.debug$S'
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
     Alignment:       4
-    SectionData:     04000000F10000002F0000002D003C1100000000D0000700000000000000581B000000000000636C616E672076657273696F6E20372E302E30200000F10000002F0000002900471100000000000000000000000001000000000000000000000002100000000000000000006261720002004F1100F2000000200000000000000000000000010000000000000001000000140000000000000002000000F400000018000000010000001001DF91CB3A2B8D917486574BB50CAC4CC70000F300000014000000002E5C7064625F6C696E65735F322E6300000000
     Subsections:
       - !Symbols
         Records:
@@ -30,15 +30,15 @@ sections:
             Compile3Sym:
               Flags:           [  ]
               Machine:         X64
-              FrontendMajor:   7
+              FrontendMajor:   11
               FrontendMinor:   0
               FrontendBuild:   0
               FrontendQFE:     0
-              BackendMajor:    7000
+              BackendMajor:    11000
               BackendMinor:    0
               BackendBuild:    0
               BackendQFE:      0
-              Version:         'clang version 7.0.0 '
+              Version:         'clang version 11.0.0 (https://github.com/llvm/llvm-project.git 77dad72eae974338ddc13d74783c012ccbb8c5ac)'
       - !Symbols
         Records:
           - Kind:            S_GPROC32_ID
@@ -49,8 +49,17 @@ sections:
               FunctionType:    4098
               Flags:           [  ]
               DisplayName:     bar
+          - Kind:            S_FRAMEPROC
+            FrameProcSym:
+              TotalFrameBytes: 0
+              PaddingFrameBytes: 0
+              OffsetToPadding: 0
+              BytesOfCalleeSavedRegisters: 0
+              OffsetOfExceptionHandler: 0
+              SectionIdOfExceptionHandler: 0
+              Flags:           [  ]
           - Kind:            S_PROC_ID_END
-            ScopeEndSym:
+            ScopeEndSym:     {}
       - !Lines
         CodeSize:        1
         Flags:           [  ]
@@ -63,35 +72,39 @@ sections:
                 LineStart:       2
                 IsStatement:     false
                 EndDelta:        0
-            Columns:
+            Columns:         []
       - !FileChecksums
         Checksums:
           - FileName:        '.\pdb_lines_2.c'
             Kind:            MD5
-            Checksum:        DF91CB3A2B8D917486574BB50CAC4CC7
+            Checksum:        4CC58B73BFD5AB52F87CFB3C604BB288
       - !StringTable
         Strings:
           - '.\pdb_lines_2.c'
           - ''
           - ''
           - ''
+      - !Symbols
+        Records:
+          - Kind:            S_BUILDINFO
+            BuildInfoSym:
+              BuildId:         4103
     Relocations:
-      - VirtualAddress:  100
+      - VirtualAddress:  184
         SymbolName:      bar
         Type:            IMAGE_REL_AMD64_SECREL
-      - VirtualAddress:  104
+      - VirtualAddress:  188
         SymbolName:      bar
         Type:            IMAGE_REL_AMD64_SECTION
-      - VirtualAddress:  124
+      - VirtualAddress:  240
         SymbolName:      bar
         Type:            IMAGE_REL_AMD64_SECREL
-      - VirtualAddress:  128
+      - VirtualAddress:  244
         SymbolName:      bar
         Type:            IMAGE_REL_AMD64_SECTION
   - Name:            '.debug$T'
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
     Alignment:       4
-    SectionData:     0400000006000112000000000E0008100300000000000000001000000E000116000000000110000062617200
     Types:
       - Kind:            LF_ARGLIST
         ArgList:
@@ -108,6 +121,29 @@ sections:
           ParentScope:     0
           FunctionType:    4097
           Name:            bar
+      - Kind:            LF_STRING_ID
+        StringId:
+          Id:              0
+          String:          .
+      - Kind:            LF_STRING_ID
+        StringId:
+          Id:              0
+          String:          pdb_lines_2.c
+      - Kind:            LF_STRING_ID
+        StringId:
+          Id:              0
+          String:          'buildninjaRel\bin\clang-cl.exe'
+      - Kind:            LF_STRING_ID
+        StringId:
+          Id:              0
+          String:          '"-cc1" "-triple" "x86_64-pc-windows-msvc19.26.28806" "-emit-obj" "-mrelax-all" "-mincremental-linker-compatible" "-disable-free" "-main-file-name" "pdb_lines_2.c" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mframe-pointer=none" "-relaxed-aliasing" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-mllvm" "-x86-asm-syntax=intel" "-D_MT" "-flto-visibility-public-std" "--dependent-lib=libcmt" "--dependent-lib=oldnames" "-stack-protector" "2" "-fms-volatile" "-fdiagnostics-format" "msvc" "-gcodeview" "-debug-info-kind=limited" "-resource-dir" "D:\\llvm-project\\buildninjaRel\\lib\\clang\\11.0.0" "-internal-isystem" "D:\\llvm-project\\buildninjaRel\\lib\\clang\\11.0.0\\include" "-internal-isystem" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.26.28801\\ATLMFC\\include" "-internal-isystem" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.26.28801\\include" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\ucrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\shared" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\um" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\winrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\cppwinrt" "-fdebug-compilation-dir" "." "-ferror-limit" "19" "-fmessage-length=146" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility" "-fms-compatibility-version=19.26.28806" "-fdelayed-template-parsing" "-fcolor-diagnostics" "-faddrsig" "-x" "c"'
+      - Kind:            LF_BUILDINFO
+        BuildInfo:
+          ArgIndices:      [ 4099, 4101, 4100, 0, 4102 ]
+  - Name:            .llvm_addrsig
+    Characteristics: [ IMAGE_SCN_LNK_REMOVE ]
+    Alignment:       1
+    SectionData:     ''
 symbols:
   - Name:            .text
     Value:           0
@@ -164,10 +200,10 @@ symbols:
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_STATIC
     SectionDefinition:
-      Length:          216
+      Length:          348
       NumberOfRelocations: 4
       NumberOfLinenumbers: 0
-      CheckSum:        2383431754
+      CheckSum:        2408981505
       Number:          5
   - Name:            '.debug$T'
     Value:           0
@@ -176,15 +212,40 @@ symbols:
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_STATIC
     SectionDefinition:
-      Length:          44
+      Length:          1992
       NumberOfRelocations: 0
       NumberOfLinenumbers: 0
-      CheckSum:        179171995
+      CheckSum:        1158086003
       Number:          6
+  - Name:            .llvm_addrsig
+    Value:           0
+    SectionNumber:   7
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_STATIC
+    SectionDefinition:
+      Length:          0
+      NumberOfRelocations: 0
+      NumberOfLinenumbers: 0
+      CheckSum:        0
+      Number:          7
+  - Name:            '@feat.00'
+    Value:           0
+    SectionNumber:   -1
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_STATIC
   - Name:            bar
     Value:           0
     SectionNumber:   1
     SimpleType:      IMAGE_SYM_TYPE_NULL
     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
+  - Name:            .file
+    Value:           0
+    SectionNumber:   -2
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_FILE
+    File:            pdb_lines_2.c
 ...

diff  --git a/lld/test/COFF/pdb-relative-source-lines.test b/lld/test/COFF/pdb-relative-source-lines.test
index 547056785962a..632aa48cb6cd4 100644
--- a/lld/test/COFF/pdb-relative-source-lines.test
+++ b/lld/test/COFF/pdb-relative-source-lines.test
@@ -15,7 +15,9 @@ int main(void) {
 void bar(void) {
 }
 
-$ clang-cl -Xclang -fdebug-compilation-dir -Xclang . -c -Z7 pdb_lines*.c
+$ clang-cl -fdebug-compilation-dir . -no-canonical-prefixes -c -Z7 pdb_lines*.c
+$ obj2yaml pdb_lines_1.obj > pdb_lines_1_relative.yaml
+$ obj2yaml pdb_lines_2.obj > pdb_lines_2_relative.yaml
 
 /pdbsourcepath: only sets the directory that relative paths are considered
 relative to, so this test needs to pass relative paths to lld-link for:
@@ -33,9 +35,9 @@ RUN: cd %t
 RUN: yaml2obj %S/Inputs/pdb_lines_1_relative.yaml -o %t/pdb_lines_1_relative.obj
 RUN: yaml2obj %S/Inputs/pdb_lines_2_relative.yaml -o %t/pdb_lines_2_relative.obj
 RUN: ./lld-link -debug "-pdbsourcepath:c:\src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
-RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck %s
+RUN: llvm-pdbutil pdb2yaml -ipi-stream -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck %s
 RUN: ./lld-link -debug "-pdbsourcepath:/usr/src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
-RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=POSIX %s
+RUN: llvm-pdbutil pdb2yaml -ipi-stream -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=POSIX %s
 
 CHECK-LABEL:  - Module:          'c:\src\pdb_lines_1_relative.obj'
 CHECK-NEXT:     ObjFile:         'c:\src\pdb_lines_1_relative.obj'
@@ -70,6 +72,20 @@ CHECK-NEXT:         - 'c:\src\out.pdb'
 CHECK-NEXT:         - cmd
 CHECK-NEXT:         - '-debug -pdbsourcepath:c:\src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj'
 
+CHECK-LABEL: IpiStream:
+
+CHECK:    - Kind:            LF_STRING_ID
+CHECK-NEXT:      StringId:
+CHECK-NEXT:        Id:              0
+CHECK-NEXT:        String:          'c:\src'
+CHECK-NEXT:     - Kind:            LF_STRING_ID
+CHECK-NEXT:       StringId:
+CHECK-NEXT:         Id:              0
+CHECK-NEXT:         String:          pdb_lines_1.c
+CHECK-NEXT:     - Kind:            LF_STRING_ID
+CHECK-NEXT:       StringId:
+CHECK-NEXT:         Id:              0
+CHECK-NEXT:         String:          'c:\src\buildninjaRel\bin\clang-cl.exe'
 
 POSIX-LABEL:  - Module:          '/usr/src/pdb_lines_1_relative.obj'
 POSIX-NEXT:     ObjFile:         '/usr/src/pdb_lines_1_relative.obj'
@@ -103,3 +119,17 @@ POSIX-NEXT:         - pdb
 POSIX-NEXT:         - '/usr/src/out.pdb'
 POSIX-NEXT:         - cmd
 POSIX-NEXT:         - '-debug -pdbsourcepath:/usr/src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj'
+
+POSIX-LABEL: IpiStream:
+POSIX:    - Kind:            LF_STRING_ID
+POSIX-NEXT:      StringId:
+POSIX-NEXT:        Id:              0
+POSIX-NEXT:        String:          '/usr/src'
+POSIX-NEXT:     - Kind:            LF_STRING_ID
+POSIX-NEXT:       StringId:
+POSIX-NEXT:         Id:              0
+POSIX-NEXT:         String:          pdb_lines_1.c
+POSIX-NEXT:     - Kind:            LF_STRING_ID
+POSIX-NEXT:       StringId:
+POSIX-NEXT:         Id:              0
+POSIX-NEXT:         String:          '/usr/src/buildninjaRel/bin/clang-cl.exe'

diff  --git a/lld/test/COFF/pdb-relative-source-lines2.test b/lld/test/COFF/pdb-relative-source-lines2.test
new file mode 100644
index 0000000000000..955f7bc1e453a
--- /dev/null
+++ b/lld/test/COFF/pdb-relative-source-lines2.test
@@ -0,0 +1,66 @@
+REQUIRES: system-windows
+
+Test the linker line tables on roughly the following example:
+
+==> foo.h <==
+void bar(void);
+inline void foo(void) {
+  bar();
+}
+==> pdb_lines_1.c <==
+#include "foo.h"
+int main(void) {
+  foo();
+  return 42;
+}
+==> pdb_lines_2.c <==
+void bar(void) {
+}
+
+$ clang-cl -fdebug-compilation-dir . -no-canonical-prefixes -c -Z7 pdb_lines*.c
+$ obj2yaml pdb_lines_1.obj > pdb_lines_1_relative.yaml
+$ obj2yaml pdb_lines_2.obj > pdb_lines_2_relative.yaml
+
+/pdbsourcepath: only sets the directory that relative paths are considered
+relative to, so this test needs to pass relative paths to lld-link for:
+1. The input obj files
+2. The /pdb: switch
+3. The lld-link invocation itself
+To achieve this, put all inputs of the lld-link invocation (including lld-link
+itself) in a temp directory that's cwd and then make sure to only use relative
+arguments when calling ./lld-link below.
+RUN: rm -rf %t
+RUN: mkdir %t
+RUN: cp lld-link %t/lld-link
+RUN: cd %t
+
+Test the convoluted case at the end of remapBuildInfo() in lld/COFF/PDB.cpp
+The only drawback right now is that this edge case will create LF_BUILDINFO
+records with front references in the IPI stream. However the Visual Studio
+debugger takes the .PDB thusly created without any problems.
+Tested on VS2015, 2017 and 2019.
+
+RUN: yaml2obj %S/Inputs/pdb_lines_1_relative.yaml -o %t/pdb_lines_1_relative.obj
+RUN: sed -e "s|String:          \.|String:          "c:\\\src"|" < %S/Inputs/pdb_lines_2_relative.yaml > %t/pdb_lines_2_relative.yaml
+RUN: yaml2obj pdb_lines_2_relative.yaml -o %t/pdb_lines_2_relative.obj
+RUN: ./lld-link -debug "-pdbsourcepath:c:\src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
+RUN: llvm-pdbutil pdb2yaml -ipi-stream -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=EXISTING %s
+
+EXISTING-LABEL: IpiStream:
+
+EXISTING:     - Kind:            LF_STRING_ID
+EXISTING-NEXT:      StringId:
+EXISTING-NEXT:        Id:              0
+EXISTING-NEXT:        String:          .
+EXISTING-NEXT:    - Kind:            LF_STRING_ID
+EXISTING-NEXT:      StringId:
+EXISTING-NEXT:        Id:              0
+EXISTING-NEXT:        String:          pdb_lines_1.c
+EXISTING:    - Kind:            LF_STRING_ID
+EXISTING-NEXT:      StringId:
+EXISTING-NEXT:        Id:              0
+EXISTING-LABEL:        String:          'c:\src'
+EXISTING-NEXT:     - Kind:            LF_STRING_ID
+EXISTING-NEXT:       StringId:
+EXISTING-NEXT:         Id:              0
+EXISTING-NEXT:         String:          pdb_lines_2.c

diff  --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index b388e43447835..df294409cc233 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -68,6 +68,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/Program.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
@@ -817,6 +818,31 @@ static TypeIndex getStringIdTypeIdx(GlobalTypeTableBuilder &TypeTable,
   return TypeTable.writeLeafType(SIR);
 }
 
+static std::string flattenCommandLine(ArrayRef<const char *> Args,
+                                      StringRef MainFilename) {
+  std::string FlatCmdLine;
+  raw_string_ostream OS(FlatCmdLine);
+  StringRef LastArg;
+  for (StringRef Arg : Args) {
+    if (Arg.empty())
+      continue;
+    // The command-line shall not contain the file to compile.
+    if (Arg == MainFilename && LastArg != "-main-file-name")
+      continue;
+    // Also remove the output file.
+    if (Arg == "-o" || LastArg == "-o") {
+      LastArg = Arg;
+      continue;
+    }
+    if (!LastArg.empty())
+      OS << " ";
+    llvm::sys::printArg(OS, Arg, /*Quote=*/true);
+    LastArg = Arg;
+  }
+  OS.flush();
+  return FlatCmdLine;
+}
+
 void CodeViewDebug::emitBuildInfo() {
   // First, make LF_BUILDINFO. It's a sequence of strings with various bits of
   // build info. The known prefix is:
@@ -837,8 +863,16 @@ void CodeViewDebug::emitBuildInfo() {
       getStringIdTypeIdx(TypeTable, MainSourceFile->getDirectory());
   BuildInfoArgs[BuildInfoRecord::SourceFile] =
       getStringIdTypeIdx(TypeTable, MainSourceFile->getFilename());
-  // FIXME: Path to compiler and command line. PDB is intentionally blank unless
-  // we implement /Zi type servers.
+  // FIXME: PDB is intentionally blank unless we implement /Zi type servers.
+  BuildInfoArgs[BuildInfoRecord::TypeServerPDB] =
+      getStringIdTypeIdx(TypeTable, "");
+  if (Asm->TM.Options.MCOptions.Argv0 != nullptr) {
+    BuildInfoArgs[BuildInfoRecord::BuildTool] =
+        getStringIdTypeIdx(TypeTable, Asm->TM.Options.MCOptions.Argv0);
+    BuildInfoArgs[BuildInfoRecord::CommandLine] = getStringIdTypeIdx(
+        TypeTable, flattenCommandLine(Asm->TM.Options.MCOptions.CommandLineArgs,
+                                      MainSourceFile->getFilename()));
+  }
   BuildInfoRecord BIR(BuildInfoArgs);
   TypeIndex BuildInfoIndex = TypeTable.writeLeafType(BIR);
 

diff  --git a/llvm/test/DebugInfo/COFF/build-info.ll b/llvm/test/DebugInfo/COFF/build-info.ll
index 94f006c3b0935..983aa22214bce 100644
--- a/llvm/test/DebugInfo/COFF/build-info.ll
+++ b/llvm/test/DebugInfo/COFF/build-info.ll
@@ -5,7 +5,7 @@
 ; CHECK-NEXT:          0x{{.*}}: `D:\src\scopes\clang`
 ; CHECK-NEXT:          <no type>: ``
 ; CHECK-NEXT:          0x{{.*}}: `D:\src\scopes\foo.cpp`
-; CHECK-NEXT:          <no type>: ``
+; CHECK-NEXT:          0x{{.*}}: ``
 ; CHECK-NEXT:          <no type>: ``
 
 ; CHECK: {{.*}} | S_BUILDINFO [size = 8] BuildId = `[[INFO_IDX]]`

diff  --git a/llvm/test/DebugInfo/COFF/global-type-hashes.ll b/llvm/test/DebugInfo/COFF/global-type-hashes.ll
index 70f9df156a5be..3c6c27301b20a 100644
--- a/llvm/test/DebugInfo/COFF/global-type-hashes.ll
+++ b/llvm/test/DebugInfo/COFF/global-type-hashes.ll
@@ -295,7 +295,8 @@ attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-ma
 ; YAML:         - 4470750F2E319329
 ; YAML:         - 0FB556FD1FAB66D7
 ; YAML:         - 5970EFB4874D0F3F
-; YAML:         - EDB1D74C120CF44A
+; YAML:         - D8EF11198C33843F
+; YAML:         - D81F744D7366282B
 ; ...
 
 

diff  --git a/llvm/test/DebugInfo/COFF/types-basic.ll b/llvm/test/DebugInfo/COFF/types-basic.ll
index 81e0c25d17cdb..6455452d125ae 100644
--- a/llvm/test/DebugInfo/COFF/types-basic.ll
+++ b/llvm/test/DebugInfo/COFF/types-basic.ll
@@ -511,14 +511,22 @@
 ; ASM: .asciz	"t.cpp"                 # StringData
 ; ASM: .byte	242
 ; ASM: .byte	241
-; ASM: # BuildInfo (0x1015)
+; ASM: # StringId (0x1015)
+; ASM: .short	0xa                     # Record length
+; ASM: .short	0x1605                  # Record kind: LF_STRING_ID
+; ASM: .long	0x0                     # Id
+; ASM: .byte    0                       # StringData
+; ASM: .byte	243
+; ASM: .byte	242
+; ASM: .byte	241
+; ASM: # BuildInfo (0x1016)
 ; ASM: .short	0x1a                    # Record length
 ; ASM: .short	0x1603                  # Record kind: LF_BUILDINFO
 ; ASM: .short	0x5                     # NumArgs
 ; ASM: .long	0x1013                  # Argument: D:\src\llvm\build
 ; ASM: .long	0x0                     # Argument
 ; ASM: .long	0x1014                  # Argument: t.cpp
-; ASM: .long	0x0                     # Argument
+; ASM: .long	0x1015                  # Argument
 ; ASM: .long	0x0                     # Argument
 ; ASM: .byte	242
 ; ASM: .byte	241

diff  --git a/llvm/test/DebugInfo/COFF/types-data-members.ll b/llvm/test/DebugInfo/COFF/types-data-members.ll
index 87fde74b989c4..1e699efdf8ed3 100644
--- a/llvm/test/DebugInfo/COFF/types-data-members.ll
+++ b/llvm/test/DebugInfo/COFF/types-data-members.ll
@@ -727,14 +727,22 @@
 ; ASM: .asciz	"t.cpp"                 # StringData
 ; ASM: .byte	242
 ; ASM: .byte	241
-; ASM: # BuildInfo (0x1022)
+; ASM: # StringId (0x1022)
+; ASM: .short	0xa                     # Record length
+; ASM: .short	0x1605                  # Record kind: LF_STRING_ID
+; ASM: .long	0x0                     # Id
+; ASM: .byte    0                       # StringData
+; ASM: .byte	243
+; ASM: .byte	242
+; ASM: .byte	241
+; ASM: # BuildInfo (0x1023)
 ; ASM: .short	0x1a                    # Record length
 ; ASM: .short	0x1603                  # Record kind: LF_BUILDINFO
 ; ASM: .short	0x5                     # NumArgs
 ; ASM: .long	0x1020                  # Argument: D:\src\llvm\build
 ; ASM: .long	0x0                     # Argument
 ; ASM: .long	0x1021                  # Argument: t.cpp
-; ASM: .long	0x0                     # Argument
+; ASM: .long	0x1022                  # Argument
 ; ASM: .long	0x0                     # Argument
 ; ASM: .byte	242
 ; ASM: .byte	241


        


More information about the cfe-commits mailing list