[llvm] [AArch64, ELF] Allow implicit $d/$x at section beginning (PR #99718)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 9 10:11:05 PDT 2024
MaskRay wrote:
Thank you for your feedback. You suggest a scheme where the trailing $x mapping symbol is omitted to prevent potential contradictory mapping symbols at the same address.
```
.section .text.1,"ax"
nop
// emit $d
.long 42
// do not emit $x
```
This requires a smart linker that inserts extra mapping symbols.
While I understand the benefits of this approach, it's not suitable for all users.
Those who can tolerate potential mapping symbol conflicts or have tooling to handle them (even if not well defined) might prefer an ending mapping symbol.
I believe it's very difficult for Clang to emit trailing data in a text section.
However, hand-written assembly might do so, and in the absence of a smart linker, large regions of .text could be misidentified as data.
While I'm unfamiliar with Morello, omitting a starting label (often the function name) is possible in hand-written assembly. This disqualifies approaches that rely on start label st_vaue.
Additionally, I'm less comfortable with ABIs that use st_value&1 for state information (like Thumb and MicroMips).
This can lead to ambiguity when defining label differences (A-B vs. A-B+C) in assembly code. https://reviews.llvm.org/D157655
---
**Is it feasible to have a cl::opt (not -Wa,--foo) to have the ending mapping symbol behavior?**
I understand the preference for a limited number of schemes, but I anticipate that we may end up with three distinct options as users have different needs:
the current approach (there are already differences with gas; LLVM AArch32 does this https://reviews.llvm.org/D30724), the proposed patch, and a variation of the patch without the ending mapping symbol.
https://github.com/llvm/llvm-project/pull/99718
More information about the llvm-commits
mailing list