forked from OSchip/llvm-project
[coff] remove_dots from /PDBPATH but not /PDBALTPATH.
This more closely matches the behavior of link.exe, and also simplifies the code slightly. llvm-svn: 336882
This commit is contained in:
parent
fdf13ef342
commit
e2ce2a5c86
|
@ -1384,7 +1384,12 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
|
|||
// /pdbaltpath flag was passed.
|
||||
if (Config->PDBAltPath.empty()) {
|
||||
Config->PDBAltPath = Config->PDBPath;
|
||||
|
||||
// It's important to make the path absolute and remove dots. This path
|
||||
// will eventually be written into the PE header, and certain Microsoft
|
||||
// tools won't work correctly if these assumptions are not held.
|
||||
sys::fs::make_absolute(Config->PDBAltPath);
|
||||
sys::path::remove_dots(Config->PDBAltPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ private:
|
|||
class CVDebugRecordChunk : public Chunk {
|
||||
public:
|
||||
size_t getSize() const override {
|
||||
return sizeof(codeview::DebugInfo) + Path.size() + 1;
|
||||
return sizeof(codeview::DebugInfo) + Config->PDBAltPath.size() + 1;
|
||||
}
|
||||
|
||||
void writeTo(uint8_t *B) const override {
|
||||
|
@ -132,12 +132,11 @@ public:
|
|||
|
||||
// variable sized field (PDB Path)
|
||||
char *P = reinterpret_cast<char *>(B + OutputSectionOff + sizeof(*BuildId));
|
||||
if (!Path.empty())
|
||||
memcpy(P, Path.data(), Path.size());
|
||||
P[Path.size()] = '\0';
|
||||
if (!Config->PDBAltPath.empty())
|
||||
memcpy(P, Config->PDBAltPath.data(), Config->PDBAltPath.size());
|
||||
P[Config->PDBAltPath.size()] = '\0';
|
||||
}
|
||||
|
||||
SmallString<128> Path;
|
||||
mutable codeview::DebugInfo *BuildId = nullptr;
|
||||
};
|
||||
|
||||
|
@ -510,8 +509,6 @@ void Writer::createMiscChunks() {
|
|||
// if we're ultimately not going to write CodeView data to the PDB.
|
||||
auto *CVChunk = make<CVDebugRecordChunk>();
|
||||
BuildId = CVChunk;
|
||||
CVChunk->Path = Config->PDBAltPath;
|
||||
llvm::sys::path::remove_dots(CVChunk->Path);
|
||||
DebugRecords.push_back(CVChunk);
|
||||
|
||||
RdataSec->addChunk(DebugDirectory);
|
||||
|
|
Loading…
Reference in New Issue