[PATCH] D143769: [lld] [MTE] Add DT_AARCH64_MEMTAG_* dynamic entries, and small cleanup

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 11:15:35 PST 2023


hctim added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:3853
   memcpy(buf + 12, kMemtagAndroidNoteName, sizeof(kMemtagAndroidNoteName));
-  buf += 12 + sizeof(kMemtagAndroidNoteName);
+  buf += 12 + alignTo(sizeof(kMemtagAndroidNoteName), 4);
 
----------------
fmayer wrote:
> should we have a static_assert that this is aligned to 4 instead? this seems like a no op
yeah, it's a no-op.

there's also already a static_assert that the note name == 8 bytes, so adding an aligned-4 assert is probably unnecessary.

the reason why i put this here is because i wanted anyone who comes along and copy-paste implements an ELF note to not bugger up the alignment. for example, this caught me off guard when implementing an MTE globals note in the previous design. course, anyone implementing ELF notes should probably be consulting the manpage which does mention the alignment, but yeah, can be easy to miss.

WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143769



More information about the llvm-commits mailing list