[lld] [lld][macho] Strip .__uniq. and .llvm. hashes in -order_file (PR #140670)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Tue May 20 11:06:39 PDT 2025


================
@@ -245,12 +245,18 @@ DenseMap<const InputSection *, int> CallGraphSort::run() {
   return orderMap;
 }
 
+StringRef macho::PriorityBuilder::getRootSymbol(StringRef Name) {
+  auto [P0, S0] = Name.rsplit(".llvm.");
+  auto [P1, S1] = P0.rsplit(".__uniq.");
+  return P1;
+}
+
----------------
ellishg wrote:

Let's reuse the implementation for `BP`. Although I'm not sure where it should live. Maybe `https://github.com/llvm/llvm-project/blob/main/lld/include/lld/Common/LLVM.h`? @MaskRay what do you think?

https://github.com/llvm/llvm-project/blob/cbcfe667bbda2ba2862d873350309e29b4368880/lld/include/lld/Common/BPSectionOrdererBase.inc#L150-L161

https://github.com/llvm/llvm-project/pull/140670


More information about the llvm-commits mailing list