[PATCH] D93045: [ELF] AArch64: Handle DT_AARCH64_VARIANT_PCS
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 10 11:32:02 PST 2020
MaskRay added a subscriber: nsz.
MaskRay added a comment.
> st_other marked with STO_AARCH64_VARIANT_PCS indicates a may follow a variant
a -> it
> if there are R_<CLS>_JUMP_SLOT relocations that reference that symbols.
Question: The ABI does use the `<CLS>` notation. Does it mean it can be AARCH32 in the future?
> It fixes https://bugs.llvm.org/show_bug.cgi?id=48368.
I think "fixes" is used for bug fixes. This is a new feature.
binutils `elfNN_aarch64_merge_symbol_attribute` has an untested diagnostic `_bfd_error_handler (_("unknown attribute for symbol `%s': 0x%02x"), h->root.root.string, isym_sto);` (@nsz)
Is it useful to LLD?
================
Comment at: lld/ELF/SyntheticSections.cpp:1440
+ case EM_AARCH64:
+ if (in.relaPlt->aarch64VariantPcs)
+ addInt(DT_AARCH64_VARIANT_PCS, 0);
----------------
Instead of introducing a member aarch64VariantPcs, would iterating in.relaPlt->relocs here make the AArch64 specific code more isolated?
================
Comment at: lld/ELF/SyntheticSections.h:509
int32_t dynamicTag, sizeDynamicTag;
+ bool aarch64VariantPcs;
std::vector<DynamicReloc> relocs;
----------------
Prefer member initializer `= false;`
================
Comment at: lld/test/ELF/aarch64-variant_pcs.s:12
+# PCSSYM: Symbol table '.dynsym'
+# PCSSYM: {{0+}} 0 NOTYPE GLOBAL DEFAULT UND func_global_undef
+# PCSSYM: {{0+}} 0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] UND pcs_func_global_undef
----------------
`{{0+}}` is not useful.
(Even if you want to check this is not a canonical PLT entry (which is probably out of scope of this test), `{{0+}}` can match trailing zeros in a non-zero address `12340`)
================
Comment at: lld/test/ELF/aarch64-variant_pcs.s:13
+# PCSSYM: {{0+}} 0 NOTYPE GLOBAL DEFAULT UND func_global_undef
+# PCSSYM: {{0+}} 0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] UND pcs_func_global_undef
+# PCSSYM: 0 NOTYPE GLOBAL DEFAULT 7 func_global_def
----------------
Use `-NEXT`. The FileCheck diagnostic will be more friendly if a newline is added or a line is removed.
================
Comment at: lld/test/ELF/aarch64-variant_pcs.s:14
+# PCSSYM: {{0+}} 0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] UND pcs_func_global_undef
+# PCSSYM: 0 NOTYPE GLOBAL DEFAULT 7 func_global_def
+# PCSSYM: 0 IFUNC GLOBAL DEFAULT 7 ifunc_global_def
----------------
Replace `7` with `[[#]]` to prevent updatess when section indexes change.
================
Comment at: lld/test/ELF/aarch64-variant_pcs.s:34
+
+.global pcs_func_global_def
+.global pcs_func_global_undef
----------------
Optional: `.global a, b, c` can mark several symbols
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93045/new/
https://reviews.llvm.org/D93045
More information about the llvm-commits
mailing list