[lld] Fix warning in lld/Macho while building lld for wasm (PR #120889)
Anutosh Bhat via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 22 04:28:29 PST 2024
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/120889
>From b616a99b2452a21aa541226230f823b176a9ead6 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Sun, 22 Dec 2024 17:08:02 +0530
Subject: [PATCH 1/2] Fix warning in lld/Macho while building lld for wasm
---
lld/MachO/SyntheticSections.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 28fb8047cacd9a..0806448f921aad 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -2084,7 +2084,7 @@ void ObjCMethListSection::writeTo(uint8_t *bufStart) const {
uint32_t writtenSize = writeRelativeMethodList(isec, buf);
buf += writtenSize;
}
- assert(buf - bufStart == sectionSize &&
+ assert(buf - bufStart == long(sectionSize) &&
"Written size does not match expected section size");
}
>From 2d5a5d9c6c9b8e7ebd6fdcb789e347dc2169de50 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Sun, 22 Dec 2024 17:58:06 +0530
Subject: [PATCH 2/2] apply suggestion
---
lld/MachO/SyntheticSections.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 0806448f921aad..417b7cf93efa7d 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -2079,12 +2079,12 @@ void ObjCMethListSection::finalize() {
void ObjCMethListSection::writeTo(uint8_t *bufStart) const {
uint8_t *buf = bufStart;
for (const ConcatInputSection *isec : inputs) {
- assert(buf - bufStart == long(isec->outSecOff) &&
+ assert(buf - bufStart == std::ptrdiff_t(isec->outSecOff) &&
"Writing at unexpected offset");
uint32_t writtenSize = writeRelativeMethodList(isec, buf);
buf += writtenSize;
}
- assert(buf - bufStart == long(sectionSize) &&
+ assert(buf - bufStart == std::ptrdiff_t(sectionSize) &&
"Written size does not match expected section size");
}
More information about the llvm-commits
mailing list