[PATCH] D130970: [LLD] [MachO] Fix GCC build warnings

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 14:15:58 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG59c6f418fa3c: [LLD] [MachO] Fix GCC build warnings (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130970/new/

https://reviews.llvm.org/D130970

Files:
  lld/MachO/Arch/ARM64.cpp
  lld/MachO/UnwindInfoSection.cpp


Index: lld/MachO/UnwindInfoSection.cpp
===================================================================
--- lld/MachO/UnwindInfoSection.cpp
+++ lld/MachO/UnwindInfoSection.cpp
@@ -401,8 +401,12 @@
   // of the unwind info's unwind address, two functions that have identical
   // unwind info can't be folded if it's using this encoding since both
   // entries need unique addresses.
-  static_assert(UNWIND_X86_64_MODE_MASK == UNWIND_X86_MODE_MASK, "");
-  static_assert(UNWIND_X86_64_MODE_STACK_IND == UNWIND_X86_MODE_STACK_IND, "");
+  static_assert(static_cast<uint32_t>(UNWIND_X86_64_MODE_MASK) ==
+                    static_cast<uint32_t>(UNWIND_X86_MODE_MASK),
+                "");
+  static_assert(static_cast<uint32_t>(UNWIND_X86_64_MODE_STACK_IND) ==
+                    static_cast<uint32_t>(UNWIND_X86_MODE_STACK_IND),
+                "");
   if ((target->cpuType == CPU_TYPE_X86_64 || target->cpuType == CPU_TYPE_X86) &&
       (encoding & UNWIND_X86_64_MODE_MASK) == UNWIND_X86_64_MODE_STACK_IND) {
     // FIXME: Consider passing in the two function addresses and getting
Index: lld/MachO/Arch/ARM64.cpp
===================================================================
--- lld/MachO/Arch/ARM64.cpp
+++ lld/MachO/Arch/ARM64.cpp
@@ -445,7 +445,7 @@
   Optional<PerformedReloc> rel2 = findReloc(hint.offset0 + hint.delta[0]);
   if (!rel1 || !rel2)
     return;
-  if (ldr.offset != (rel1->referentVA & 0xfff))
+  if (ldr.offset != static_cast<int64_t>(rel1->referentVA & 0xfff))
     return;
   ldr.offset = rel1->referentVA - rel2->rel.offset - isec->getVA();
   if (!isLiteralLdrEligible(ldr))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130970.449437.patch
Type: text/x-patch
Size: 1619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220802/706980ee/attachment.bin>


More information about the llvm-commits mailing list