[llvm] [RISCV] Improvements to .note.gnu.property section. (PR #151436)

Ming-Yi Lai via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 23:58:09 PDT 2025


mylai-mtk wrote:

Given the ambiguity of the spec, I would suggest:

+ Remove the alignment of the section. It's not on the spec, but it looks like since the spec requires some alignment on the `desc` field and "the section alignment (in ELF, sh_addralign) is the maximum value of all alignment directives in the section", the resulting section would have that alignment anyway, so explicitly stating that on the section is not only not conformant to the spec but also redundant and unnecessary.
+ Since the section is not explicitly aligned, we need at least 1 alignment directive to implicitly align the section.
  + For RV64, this can be the one that acts as `pr_padding`.
  + For RV32, there's no current candidate as all things are already aligned if the section is aligned. This means we have to either align the section explicitly or find something to align. In this case, I think emitting an alignment directive at the beginning of the `desc` field is better, since that alignment is on the spec.

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


More information about the llvm-commits mailing list