[PATCH] D119384: [MTE] [lld] Add --memtag-* options to synthetise ELF notes.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 13:56:35 PDT 2022


eugenis added a comment.

>> - Do you need per-object marking that a linker will aggregate? For example do you enable when at least one object needs MTE, or do you need all objects to be compatible with MTE? A per object marking that can be overridden at link time will give you a chance to diagnose objects that may not have the MTE support. It can help to have an assembler option to fabricate the note if objects are used.
>
> The ELF note is coupled with the executable, not the DSOs, and thus the executable decides what MTE options are enabled. In future, there will be a per-DSO progbits section for MTE global descriptors, but these progbits sections will be ignored if the main executable doesn't include the MTE ELF note. And, of course, MTE stack is enabled on a per-CU level.

The reason we do not use per-object feature bits is that, even though stack tagging requires a compiler flag for code instrumentation, the note is global to a process (not even a DSO). Setting PROT_MTE on stack pages can increase memory traffic (by shipping tags back and forth). I can see some common object file or a static library (crtbegin, libatomic, libunwind, etc) in the NDK built with stack tagging instrumentation, but we would not want that to impose PROT_MTE on any binary that links it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119384



More information about the llvm-commits mailing list