[llvm] [llvm-objcopy] Fix prints wrong path when section output path doesn't exist (PR #125345)

Amr Hesham via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 10:08:54 PST 2025


================
@@ -186,27 +186,32 @@ static std::unique_ptr<Writer> createWriter(const CommonConfig &Config,
 }
 
 static Error dumpSectionToFile(StringRef SecName, StringRef Filename,
-                               Object &Obj) {
+                               StringRef InputFilename, Object &Obj) {
   for (auto &Sec : Obj.sections()) {
     if (Sec.Name == SecName) {
-      if (Sec.Type == SHT_NOBITS)
-        return createStringError(object_error::parse_failed,
-                                 "cannot dump section '%s': it has no contents",
-                                 SecName.str().c_str());
+      if (Sec.Type == SHT_NOBITS) {
+        Error E =
+            createStringError(object_error::parse_failed,
+                              "cannot dump section '%s': it has no contents",
+                              SecName.str().c_str());
+        return createFileError(InputFilename, std::move(E));
----------------
AmrDeveloper wrote:

Thank you updated it

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


More information about the llvm-commits mailing list