[lld] 6d98f11 - [ELF] Work around extra "warning: $" with MSVC 14.41.34120

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 17 11:08:38 PST 2024


Author: Fangrui Song
Date: 2024-11-17T11:08:32-08:00
New Revision: 6d98f11f3b5498262917802323942c8dfc2a226f

URL: https://github.com/llvm/llvm-project/commit/6d98f11f3b5498262917802323942c8dfc2a226f
DIFF: https://github.com/llvm/llvm-project/commit/6d98f11f3b5498262917802323942c8dfc2a226f.diff

LOG: [ELF] Work around extra "warning: $" with MSVC 14.41.34120

Added: 
    

Modified: 
    lld/ELF/InputSection.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 90d3faea907230..1221f56dfe68a6 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1117,9 +1117,13 @@ void InputSection::relocateNonAlloc(Ctx &ctx, uint8_t *buf,
     // 2017 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82630), but we need to
     // keep this bug-compatible code for a while.
     bool isErr = expr != R_PC && !(emachine == EM_386 && type == R_386_GOTPC);
-    auto diag = isErr ? Err(ctx) : Warn(ctx);
-    diag << getLocation(offset) << ": has non-ABS relocation " << type
-         << " against symbol '" << &sym << "'";
+    {
+      ELFSyncStream diag(ctx, isErr && !ctx.arg.noinhibitExec
+                                  ? DiagLevel::Err
+                                  : DiagLevel::Warn);
+      diag << getLocation(offset) << ": has non-ABS relocation " << type
+           << " against symbol '" << &sym << "'";
+    }
     if (!isErr)
       target.relocateNoSym(
           bufLoc, type,


        


More information about the llvm-commits mailing list