[lld] 3fb83f6 - [ELF] Replace toString(RelType) with operator<< while using ELFSyncStream

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 16 11:45:52 PST 2024


Author: Fangrui Song
Date: 2024-11-16T11:45:46-08:00
New Revision: 3fb83f65c4f38d7651b46d51b8e431417a69d539

URL: https://github.com/llvm/llvm-project/commit/3fb83f65c4f38d7651b46d51b8e431417a69d539
DIFF: https://github.com/llvm/llvm-project/commit/3fb83f65c4f38d7651b46d51b8e431417a69d539.diff

LOG: [ELF] Replace toString(RelType) with operator<< while using ELFSyncStream

Added: 
    

Modified: 
    lld/ELF/InputSection.cpp
    lld/ELF/Writer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 5c6a6c2a4bf182..89ffa69d858e64 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1033,8 +1033,7 @@ void InputSection::relocateNonAlloc(Ctx &ctx, uint8_t *buf,
         }
         if (overwriteULEB128(bufLoc, val) >= 0x80)
           Err(ctx) << getLocation(offset) << ": ULEB128 value " << Twine(val)
-                   << " exceeds available space; references '"
-                   << lld::toString(sym) << "'";
+                   << " exceeds available space; references '" << &sym << "'";
         continue;
       }
       Err(ctx) << getLocation(offset)
@@ -1238,9 +1237,9 @@ void InputSectionBase::adjustSplitStackFunctionPrologues(Ctx &ctx, uint8_t *buf,
                                                        f->stOther))
         continue;
       if (!getFile<ELFT>()->someNoSplitStack)
-        ErrAlways(ctx)
-            << lld::toString(this) << ": " << f->getName()
-            << " (with -fsplit-stack) calls " << rel.sym->getName()
+        Err(ctx)
+            << this << ": " << f->getName() << " (with -fsplit-stack) calls "
+            << rel.sym->getName()
             << " (without -fsplit-stack), but couldn't adjust its prologue";
     }
   }

diff  --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 16f9a1514b06b2..5ddaa7319224b0 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -2805,7 +2805,7 @@ template <class ELFT> void Writer<ELFT>::openFile() {
 
   if (!bufferOrErr) {
     ErrAlways(ctx) << "failed to open " << ctx.arg.outputFile << ": "
-                   << llvm::toString(bufferOrErr.takeError());
+                   << bufferOrErr.takeError();
     return;
   }
   buffer = std::move(*bufferOrErr);


        


More information about the llvm-commits mailing list