[llvm] 4db6c71 - [ORC] Switch from strncpy to memcpy to silence more GCC warnings.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 14 10:52:03 PDT 2023
Author: Lang Hames
Date: 2023-07-14T10:51:13-07:00
New Revision: 4db6c717c4dc768dba2dd4fd25ace1ad9029a32a
URL: https://github.com/llvm/llvm-project/commit/4db6c717c4dc768dba2dd4fd25ace1ad9029a32a
DIFF: https://github.com/llvm/llvm-project/commit/4db6c717c4dc768dba2dd4fd25ace1ad9029a32a.diff
LOG: [ORC] Switch from strncpy to memcpy to silence more GCC warnings.
GCC warns when strncpy doesn't copy the null terminator. See discussion at
https://reviews.llvm.org/rG9d701c8a8d65.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
index 4567b8b8cea112..a3a766d602c1ae 100644
--- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
@@ -1370,7 +1370,7 @@ Error MachOPlatform::MachOPlatformPlugin::populateObjCRuntimeObject(
DataSections.push_back({});
auto &SD = DataSections.back();
memset(&SD.Sec, 0, sizeof(SD.Sec));
- strncpy(SD.Sec.sectname, "__objc_imageinfo", 16);
+ memcpy(SD.Sec.sectname, "__objc_imageinfo", 16);
strcpy(SD.Sec.segname, "__DATA");
SD.Sec.size = 8;
SD.AddFixups = [&](size_t RecordOffset) {
More information about the llvm-commits
mailing list