[llvm] [BOLT] Fix setHasSymbolsWithFileName (PR #92625)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 18:39:06 PDT 2024


https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/92625

>From 808b169ced4c201445d45953a8c46d379ae197e4 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Fri, 17 May 2024 16:45:58 -0700
Subject: [PATCH 1/2] [BOLT] Fix setHasSymbolsWithFileName

The function is used to ignore the parameter and set
`HasSymbolsWithFileName` unconditionally.
---
 bolt/include/bolt/Core/BinaryContext.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h
index 75765819ac464..792c09dd7c467 100644
--- a/bolt/include/bolt/Core/BinaryContext.h
+++ b/bolt/include/bolt/Core/BinaryContext.h
@@ -359,7 +359,7 @@ class BinaryContext {
   void setFileBuildID(StringRef ID) { FileBuildID = std::string(ID); }
 
   bool hasSymbolsWithFileName() const { return HasSymbolsWithFileName; }
-  void setHasSymbolsWithFileName(bool Value) { HasSymbolsWithFileName = true; }
+  void setHasSymbolsWithFileName(bool Value) { HasSymbolsWithFileName = Value; }
 
   /// Return true if relocations against symbol with a given name
   /// must be created.

>From 78e5c70d532831c5f41571f88bceb0f7a1f3e077 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Fri, 17 May 2024 18:38:52 -0700
Subject: [PATCH 2/2] Add newline to an error message

---
 bolt/lib/Rewrite/RewriteInstance.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 85b39176754b6..35782e22f2844 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -1500,7 +1500,7 @@ void RewriteInstance::registerFragments() {
   if (!BC->hasSymbolsWithFileName()) {
     BC->errs() << "BOLT-ERROR: input file has split functions but does not "
                   "have FILE symbols. If the binary was stripped, preserve "
-                  "FILE symbols with --keep-file-symbols strip option";
+                  "FILE symbols with --keep-file-symbols strip option\n";
     exit(1);
   }
 



More information about the llvm-commits mailing list