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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 13:48:11 PDT 2022


MaskRay added a comment.

In D119384#3380403 <https://reviews.llvm.org/D119384#3380403>, @eugenis wrote:

> The concept of memtag is not android specific, but the current implementation is. It might grow support for other OS targets in the future.

(I will be out of town from Wednesday til next Monday and will have little time replying.)

If you are not in hurry, the ideal way forward as I see is to create a proposal on https://github.com/ARM-software/abi-aa and get it approved.
(Tag @peter.smith as an ABI approver. Tag @zatrazz who has some experience with MTE on glibc side.)
Then Android probably doesn't need to invent its own mechanism.

I think existing ld.so implementations only inspect GNU properties.
So we probably need something similar to `GNU_PROPERTY_AARCH64_FEATURE_1_BTI`.

---

If you need something soon for experiments, the Android ABI may need to diverge from the generic AArch64 ABI.
(Something similar to `--pack-dyn-relocs=android+relr`.)
I think Android needs to use `--android-memtag-*` instead of the generic option names `--memtag-*`.

> I think it would be convenient to reserve the right to change the option semantics at least until we hear about another target implementation?

Agreed.

There is also a way not adding linker options.
You may just synthesize an object file according to sync/async and stack/heap:

  .section ".note.gnu.property", "a", %note
  .p2align 3
  ...

and let clang Driver link it into the output.
This may be a bit inconvenient as it needs object files for all combinations, but don't need to let linker commit to an unstable interface.


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