[lld] [LLD][COFF] Add basic ARM64X dynamic relocations support (PR #118035)

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 08:00:40 PST 2024


================
@@ -2660,6 +2693,18 @@ void Writer::checkLoadConfigGuardData(const T *loadConfig) {
     if (loadConfig->field != s->getVA())                                       \
       warn(#field " not set correctly in '_load_config_used'");
 
+  if (ctx.dynamicRelocs) {
+    IF_CONTAINS(DynamicValueRelocTableSection) {
+      loadConfig->DynamicValueRelocTableSection = relocSec->sectionIndex;
----------------
cjacek wrote:

Yes, that's a correct observation. Using the existing helpers felt appropriate here.

For ARM64X, we will also need to modify the `CHPEMetadataPointer` field (although that's earlier than dynamic relocs in the load config, so we may use the existing check and warning). Unlike the ARM64EC load config, the native ARM64 load config doesn’t reference it in the CRT. This allows the same load config to work for the native target. On ARM64X, CHPE metadata exists only in EC code, so it wouldn’t be possible to reference it from the native load config anyway. Instead, the linker reads it from the EC load config and sets it in the native variant.

We should technically have such check for the existing `dependentLoadFlags` too. I’ll use that to split off that part.

https://github.com/llvm/llvm-project/pull/118035


More information about the llvm-commits mailing list