[llvm] [AArch64, ELF] Omit initial $d of non-text sections (PR #99580)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 16:45:51 PDT 2024


MaskRay wrote:

I've updated the last paragraph of https://github.com/ARM-software/abi-aa/issues/274
to reflect my analysis of GNU assembler's behavior.

```asm
.section .foo1
.word 0         // no $d

.section .foo2
.balign 4       // $d
.word 0
```

While its alignment processing isn't perfect (while ours doesn't consider alignments at all), it does permit $d omission in `.debug_*` sections, which lack alignment directives.

I've created #99718 with an opt-in option to enable the alternative behavior that most users will probably happy use. I said:

> A linker script combining non-text sections and text sections. The lack of mapping symbols in the non-text sections could make them treated as code, unless the linker inserts extra mapping symbols.

Although this mix-and-match scenario is unlikely to affect any users except those doing OMAGIC style things, if we have even slight reservations, perhaps this PR could be adjusted to use `EMS_Data` for non-SHF_ALLOC sections as an extra safety measure.


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


More information about the llvm-commits mailing list