[lld] [lld][bugfix] The name of soNames and deNeeded should be consistent (PR #72080)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 12 20:23:03 PST 2023


https://github.com/ls-Mou updated https://github.com/llvm/llvm-project/pull/72080

>From 58b1603a1f93796776bbe63e39b182a2bae731ed Mon Sep 17 00:00:00 2001
From: ls-Mou <moulongsheng at huawei.com>
Date: Mon, 13 Nov 2023 11:10:45 +0800
Subject: [PATCH] [lld]The name of soNames and deNeeded should be consistent

The name of soNames and deNeeded should be consistent
---
 lld/ELF/InputFiles.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 8c7f2c8773f2cbc..86c6d8ab2f14229 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -1439,7 +1439,7 @@ template <class ELFT> void SharedFile::parse() {
       uint64_t val = dyn.getVal();
       if (val >= this->stringTable.size())
         fatal(toString(this) + ": invalid DT_NEEDED entry");
-      dtNeeded.push_back(this->stringTable.data() + val);
+      dtNeeded.push_back(path::filename(this->stringTable.data() + val));
     } else if (dyn.d_tag == DT_SONAME) {
       uint64_t val = dyn.getVal();
       if (val >= this->stringTable.size())
@@ -1451,8 +1451,8 @@ template <class ELFT> void SharedFile::parse() {
   // DSOs are uniquified not by filename but by soname.
   DenseMap<CachedHashStringRef, SharedFile *>::iterator it;
   bool wasInserted;
-  std::tie(it, wasInserted) =
-      symtab.soNames.try_emplace(CachedHashStringRef(soName), this);
+  std::tie(it, wasInserted) = symtab.soNames.try_emplace(
+      CachedHashStringRef(path::filename(soName)), this);
 
   // If a DSO appears more than once on the command line with and without
   // --as-needed, --no-as-needed takes precedence over --as-needed because a



More information about the llvm-commits mailing list