[llvm] Arm ropi rwpi dynreloc consts (PR #207931)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 10:54:34 PDT 2026
efriedma-quic wrote:
The basic problem is, we can't inspect the initializer when determining whether a global is "readonly" or "readwrite", because we don't consistently have access to the initializer. In my example, `extern const int a;` is accessed as if it's readonly, so it must be readonly. If the definition is `int foo(); extern const int a = foo();`, we must produce an error.
There are ways to handle this: we could require that users annotate their globals, something like `[[clang::rwpi_readwrite]] extern const int a;`, and verify those markings on the definition. Or we can somehow delay the decision to link-time (with a relocation or something like that). We can't just directly inspect the initializer in the backend.
https://github.com/llvm/llvm-project/pull/207931
More information about the llvm-commits
mailing list