Skip to content

Commit a21d0a8

Browse files
committed
support dwo relative path in BOLT
1 parent 21532f0 commit a21d0a8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "llvm/MC/MCSymbol.h"
3434
#include "llvm/Support/CommandLine.h"
3535
#include "llvm/Support/Error.h"
36+
#include "llvm/Support/FileSystem.h"
3637
#include "llvm/Support/Regex.h"
3738
#include <algorithm>
3839
#include <functional>
@@ -1636,7 +1637,9 @@ void BinaryContext::preprocessDWODebugInfo() {
16361637
if (!opts::CompDirOverride.empty()) {
16371638
sys::path::append(AbsolutePath, opts::CompDirOverride);
16381639
sys::path::append(AbsolutePath, DWOName);
1639-
}
1640+
} else if (!sys::fs::exists(DwarfUnit->getCompilationDir()) &&
1641+
sys::fs::exists(DWOName))
1642+
AbsolutePath = DWOName;
16401643
DWARFUnit *DWOCU =
16411644
DwarfUnit->getNonSkeletonUnitDIE(false, AbsolutePath).getDwarfUnit();
16421645
if (!DWOCU->isDWOUnit()) {

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,8 @@ void DWARFRewriter::writeDWOFiles(
18511851
CompDir = opts::DwarfOutputPath.c_str();
18521852
else if (!opts::CompDirOverride.empty())
18531853
CompDir = opts::CompDirOverride;
1854+
else if (!sys::fs::exists(CompDir))
1855+
CompDir = ".";
18541856

18551857
SmallString<16> AbsolutePath;
18561858
sys::path::append(AbsolutePath, CompDir);

0 commit comments

Comments
 (0)