================
@@ -313,6 +314,18 @@ bool CFI_Parser<A>::findFDE(A &addressSpace, pint_t pc, 
pint_t ehSectionStart,
   }
   return false;
 }
+namespace {
+// This helper function handles setting the manually signed personality on
+// CIE_Info without attempt to authenticate and/or re-sign
+template <typename CIE_Info, typename T>
+[[maybe_unused]] void set_cie_info_personality(CIE_Info *info,
+                                               T signed_personality) {
+  static_assert(sizeof(info->personality) == sizeof(signed_personality),
+                "Signed personality is the wrong size");
+  memmove((void *)&info->personality, (void *)&signed_personality,
----------------
kovdan01 wrote:

Nit: I guess we can just use `memcpy` since `memmove` has additional overhead 
of handling overlapping memory regions. Here, `signed_personality` is a local 
variable, so we can guarantee that there is no overlapping.

Also, it's probably worth explicitly including `<string.h>` (well, `<cstring>` 
should be better for C++ headers, but we already have includes for C-style 
headers, so let's stick with existing conventions)

https://github.com/llvm/llvm-project/pull/143230
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to