[lld] 0b939de - [LLD][MachO] Fix warning when building with latest MSVC

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 1 11:59:06 PDT 2025


Author: Alexandre Ganea
Date: 2025-11-01T14:58:56-04:00
New Revision: 0b939de1e0927650466704676dddcac603a42950

URL: https://github.com/llvm/llvm-project/commit/0b939de1e0927650466704676dddcac603a42950
DIFF: https://github.com/llvm/llvm-project/commit/0b939de1e0927650466704676dddcac603a42950.diff

LOG: [LLD][MachO] Fix warning when building with latest MSVC

This fixes:
```
[3902/4335] Building CXX object tools\lld\MachO\CMakeFiles\lldMachO.dir\Arch\X86_64.cpp.obj
C:\git\llvm-project\lld\MachO\Arch\X86_64.cpp(107): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
```

Added: 
    

Modified: 
    lld/MachO/Arch/X86_64.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Arch/X86_64.cpp b/lld/MachO/Arch/X86_64.cpp
index a7c4b452f990b..111c4d9846d28 100644
--- a/lld/MachO/Arch/X86_64.cpp
+++ b/lld/MachO/Arch/X86_64.cpp
@@ -104,7 +104,7 @@ int64_t X86_64::getEmbeddedAddend(MemoryBufferRef mb, uint64_t offset,
 void X86_64::relocateOne(uint8_t *loc, const Reloc &r, uint64_t value,
                          uint64_t relocVA) const {
   if (r.pcrel) {
-    uint64_t pc = relocVA + (1 << r.length) + pcrelOffset(r.type);
+    uint64_t pc = relocVA + (1ull << r.length) + pcrelOffset(r.type);
     value -= pc;
   }
 


        


More information about the llvm-commits mailing list