[lld] 59085e9 - Fix more lld warnings introduced in #111434 [-Wnontrivial-memaccess]
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 00:19:50 PDT 2024
Author: NAKAMURA Takumi
Date: 2024-10-29T16:18:27+09:00
New Revision: 59085e9c3f522b59e512f1651058a9f98c739088
URL: https://github.com/llvm/llvm-project/commit/59085e9c3f522b59e512f1651058a9f98c739088
DIFF: https://github.com/llvm/llvm-project/commit/59085e9c3f522b59e512f1651058a9f98c739088.diff
LOG: Fix more lld warnings introduced in #111434 [-Wnontrivial-memaccess]
Added:
Modified:
lld/ELF/Arch/ARM.cpp
lld/ELF/SymbolTable.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp
index be3f80337aae71..271e2e27a26949 100644
--- a/lld/ELF/Arch/ARM.cpp
+++ b/lld/ELF/Arch/ARM.cpp
@@ -1207,7 +1207,7 @@ template <class ELFT> void ObjFile<ELFT>::importCmseSymbols() {
Defined *sym = reinterpret_cast<Defined *>(make<SymbolUnion>());
// Initialize symbol fields.
- memset(sym, 0, sizeof(Symbol));
+ memset(static_cast<void *>(sym), 0, sizeof(Symbol));
sym->setName(CHECK(eSyms[i].getName(stringTable), this));
sym->value = eSym.st_value;
sym->size = eSym.st_size;
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index 674b1ef983f843..8878acdc43e87f 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -56,7 +56,7 @@ void SymbolTable::wrap(Symbol *sym, Symbol *real, Symbol *wrap) {
// alias for sym, but that could degrade the user experience of some tools
// that can print out only one symbol for each location: sym is a preferred
// name than real, but they might print out real instead.
- memcpy(real, sym, sizeof(SymbolUnion));
+ memcpy(static_cast<void *>(real), sym, sizeof(SymbolUnion));
real->isUsedInRegularObj = false;
}
@@ -87,7 +87,7 @@ Symbol *SymbolTable::insert(StringRef name) {
symVector.push_back(sym);
// *sym was not initialized by a constructor. Initialize all Symbol fields.
- memset(sym, 0, sizeof(Symbol));
+ memset(static_cast<void *>(sym), 0, sizeof(Symbol));
sym->setName(name);
sym->partition = 1;
sym->versionId = VER_NDX_GLOBAL;
More information about the llvm-commits
mailing list