llvm-capstone/lld
Mitch Phillips ca35a19aca [lld] Synthesize metadata for MTE globals
As per the ABI at
https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst,
this patch interprets the SHT_AARCH64_MEMTAG_GLOBALS_STATIC section,
which contains R_NONE relocations to tagged globals, and emits a
SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC section, with the correct
DT_AARCH64_MEMTAG_GLOBALS and DT_AARCH64_MEMTAG_GLOBALSSZ dynamic
entries. This section describes, in a uleb-encoded stream, global memory
ranges that should be tagged with MTE.

We are also out of bits to spare in the LLD Symbol class. As a result,
I've reused the 'needsTocRestore' bit, which is a PPC64 only feature.
Now, it's also used for 'isTagged' on AArch64.

An entry in SHT_AARCH64_MEMTAG_GLOBALS_STATIC is practically a guarantee
from an objfile that all references to the linked symbol are through the
GOT, and meet correct alignment requirements. As a result, we go through
all symbols and make sure that, for all symbols $SYM, all object files
that reference $SYM also have a SHT_AARCH64_MEMTAG_GLOBALS_STATIC entry
for $SYM. If this isn't the case, we demote the symbol to being
untagged. Symbols that are imported from other DSOs should always be
fine, as they're GOT-referenced (and thus the GOT entry either has the
correct tag or not, depending on whether it's tagged in the defining DSO
or not).

Additionally hand-tested by building {libc, libm, libc++, libm, and libnetd}
on Android with some experimental MTE globals support in the
linker/libc.

Reviewed By: MaskRay, peter.smith

Differential Revision: https://reviews.llvm.org/D152921
2023-07-31 17:07:42 +02:00
..
cmake/modules [cmake] Fix path to LLVMConfig.cmake for multi-config builds 2023-01-13 20:32:59 +01:00
COFF [lld] [NFC] Use llvm::COFF::is64Bit in is64. 2023-07-28 14:20:14 +02:00
Common [llvm] Add missing StringExtras.h includes 2023-06-25 15:42:22 +01:00
docs Clear release notes for 18.x 2023-07-25 13:58:49 +02:00
ELF [lld] Synthesize metadata for MTE globals 2023-07-31 17:07:42 +02:00
include/lld/Common Re-land [LLD] Allow usage of LLD as a library 2023-06-19 07:35:11 -04:00
MachO [Support] Change MapVector's default template parameter to SmallVector<*, 0> 2023-07-24 22:04:03 -07:00
MinGW Re-land [LLD] Allow usage of LLD as a library 2023-06-19 07:35:11 -04:00
test [lld] Synthesize metadata for MTE globals 2023-07-31 17:07:42 +02:00
tools/lld Re-land [LLD] Allow usage of LLD as a library 2023-06-19 07:35:11 -04:00
unittests Re-land [LLD] Allow usage of LLD as a library 2023-06-19 07:35:11 -04:00
utils [NFC][Py Reformat] Reformat python files in the rest of the dirs 2023-05-25 11:17:05 +02:00
wasm [lld][WebAssembly] Fix func reloc for internal GOT with extended-const 2023-07-27 00:46:00 -07:00
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [lld] respect LLVM_EXTERNAL_LIT 2023-07-06 16:35:01 +02:00
CODE_OWNERS.TXT
LICENSE.TXT
README.md

LLVM Linker (lld)

This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.

lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.

Benchmarking

In order to make sure various developers can evaluate patches over the same tests, we create a collection of self contained programs.

It is hosted at https://s3-us-west-2.amazonaws.com/linker-tests/lld-speed-test.tar.xz

The current sha256 is 10eec685463d5a8bbf08d77f4ca96282161d396c65bd97dc99dbde644a31610f.