Issue 180712
Summary `-fsanitize=memtag-globals` for self relocating executables
Labels new issue
Assignees
Reporter EliaGeretto
    Currently, the `-fsanitize=memtag-globals` option in `clang` is supported only on AArch64 Android:

https://github.com/llvm/llvm-project/blob/302ff8fd005620731b82dd2a6342a9613363a9aa/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp#L790-L793

This prevents its use in AArch64 self-relocating executables (`aarch64-none-elf`) which, being responsible for their own relocations, should not be prevented from using this functionality.

A similar assumption is also present in `lld`, which prevents fully static executables from using memtag globals under the assumption that a dynamic loader is needed:

https://github.com/llvm/llvm-project/blob/302ff8fd005620731b82dd2a6342a9613363a9aa/lld/ELF/SyntheticSections.cpp#L4513-L4514

A self-relocating executable is commonly compiled as a static executable and performs its own relocations, so this assumption is incorrect in this specific case.

I propose to modify these checks to improve the support for self-relocating executables.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to