[lld] 5c4a630 - [LLD][ELF] Silence warning when building with latest MSVC
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 19:04:59 PST 2024
Author: Alexandre Ganea
Date: 2024-02-07T22:04:39-05:00
New Revision: 5c4a630ab70f98138d6f95d19712bb114d92323d
URL: https://github.com/llvm/llvm-project/commit/5c4a630ab70f98138d6f95d19712bb114d92323d
DIFF: https://github.com/llvm/llvm-project/commit/5c4a630ab70f98138d6f95d19712bb114d92323d.diff
LOG: [LLD][ELF] Silence warning when building with latest MSVC
This fixes:
```
[193/3517] Building CXX object
tools\lld\ELF\CMakeFiles\lldELF.dir\Arch\LoongArch.cpp.obj
C:\git\llvm-project\lld\ELF\Arch\LoongArch.cpp(683): warning C4334:
'<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit
shift intended?
```
Added:
Modified:
lld/ELF/Arch/LoongArch.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Arch/LoongArch.cpp b/lld/ELF/Arch/LoongArch.cpp
index 05fd38fb753fda..3e9d6e0e742008 100644
--- a/lld/ELF/Arch/LoongArch.cpp
+++ b/lld/ELF/Arch/LoongArch.cpp
@@ -679,8 +679,8 @@ static bool relax(InputSection &sec) {
case R_LARCH_ALIGN: {
const uint64_t addend =
r.sym->isUndefined() ? Log2_64(r.addend) + 1 : r.addend;
- const uint64_t allBytes = (1 << (addend & 0xff)) - 4;
- const uint64_t align = 1 << (addend & 0xff);
+ const uint64_t allBytes = (1ULL << (addend & 0xff)) - 4;
+ const uint64_t align = 1ULL << (addend & 0xff);
const uint64_t maxBytes = addend >> 8;
const uint64_t off = loc & (align - 1);
const uint64_t curBytes = off == 0 ? 0 : align - off;
More information about the llvm-commits
mailing list