Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "Re-land [CodeView] Add full repro to LF_BUILDINFO record"
This reverts commit add59ec and 41d2813.
  • Loading branch information
aganea committed Jul 10, 2020
1 parent 7859242 commit b71499a
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 431 deletions.
1 change: 0 additions & 1 deletion clang/cmake/caches/BaremetalARM.cmake
Expand Up @@ -31,7 +31,6 @@ set(LLVM_TOOLCHAIN_TOOLS
llvm-dwarfdump
llvm-nm
llvm-objdump
llvm-pdbutil
llvm-ranlib
llvm-readobj
llvm-size
Expand Down
1 change: 0 additions & 1 deletion clang/cmake/caches/CrossWinToARMLinux.cmake
Expand Up @@ -137,7 +137,6 @@ set(LLVM_TOOLCHAIN_TOOLS
llvm-lib
llvm-nm
llvm-objdump
llvm-pdbutil
llvm-profdata
llvm-ranlib
llvm-readobj
Expand Down
1 change: 0 additions & 1 deletion clang/cmake/caches/Fuchsia-stage2.cmake
Expand Up @@ -240,7 +240,6 @@ set(LLVM_TOOLCHAIN_TOOLS
llvm-nm
llvm-objcopy
llvm-objdump
llvm-pdbutil
llvm-profdata
llvm-ranlib
llvm-readelf
Expand Down
1 change: 0 additions & 1 deletion clang/test/CMakeLists.txt
Expand Up @@ -126,7 +126,6 @@ if( NOT CLANG_BUILT_STANDALONE )
llvm-nm
llvm-objcopy
llvm-objdump
llvm-pdbutil
llvm-profdata
llvm-readelf
llvm-readobj
Expand Down
25 changes: 0 additions & 25 deletions clang/test/CodeGen/debug-info-codeview-buildinfo.c

This file was deleted.

69 changes: 0 additions & 69 deletions lld/COFF/PDB.cpp
Expand Up @@ -250,72 +250,6 @@ 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;
Expand Down Expand Up @@ -1054,9 +988,6 @@ 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());
Expand Down

0 comments on commit b71499a

Please sign in to comment.