[PATCH] D133480: [llvm-dwp] Get the DWO file using relative path instead of absolute path to make it work for distribution build

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 02:49:58 PDT 2022


steven.zhang created this revision.
steven.zhang added reviewers: dblaikie, grimar, alexander-shaposhnikov.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
steven.zhang requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Herald added a project: LLVM.

We are now getting the DWO using absolute path(Comp_dir + dwo_name). It will have problems if the objects are build with distribution system(i.e. distcc or buildfarm). Because they are likely built in other workspace which is NOT valid.

So, we need to change it with relative path as what gcc dwp does.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133480

Files:
  llvm/tools/llvm-dwp/llvm-dwp.cpp


Index: llvm/tools/llvm-dwp/llvm-dwp.cpp
===================================================================
--- llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -66,15 +66,7 @@
         Die.find({dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name}), "");
     if (DWOName.empty())
       continue;
-    std::string DWOCompDir =
-        dwarf::toString(Die.find(dwarf::DW_AT_comp_dir), "");
-    if (!DWOCompDir.empty()) {
-      SmallString<16> DWOPath(std::move(DWOName));
-      sys::fs::make_absolute(DWOCompDir, DWOPath);
-      DWOPaths.emplace_back(DWOPath.data(), DWOPath.size());
-    } else {
-      DWOPaths.push_back(std::move(DWOName));
-    }
+    DWOPaths.push_back(std::move(DWOName));
   }
   return std::move(DWOPaths);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133480.458692.patch
Type: text/x-patch
Size: 763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220908/4ca7d272/attachment.bin>


More information about the llvm-commits mailing list