RISC-V/gas: .attribute vs .insn
The `.attribute` directive must precede any instruction, including those emitted by `.insn`; related improvements are suggested.
Jiawei agrees that .attribute directives in RISC-V assembly should be enforced before any instruction, including those generated by .insn. They also suggest improvements like warning about conflicting attribute values and invalid values for unaligned_access, but recommends a separate discussion for relaxing the start_assemble restriction due to potential ABI compatibility issues.
- contributor
Agrees that `.attribute` directives should be enforced before any instruction (including `.insn`), and suggests further improvements for attribute handling.
“Treating .insn as starting assembly looks right to me. If .attribute must be set before any instruction, then instructions emitted through .insn should follow the same rule as normal instructions.”
In Details
This patch and discussion concern the RISC-V assembler (gas) and how it handles .attribute directives, which define properties of the compiled code. The .insn directive allows embedding raw instructions. Attributes like stack alignment affect ABI and optimization. Enforcing .attribute placement ensures consistent code generation.
For Context
This discussion centers on the RISC-V assembler and how it handles special directives called 'attributes'. Attributes tell the assembler about certain properties of the code being assembled, such as the required stack alignment or whether unaligned memory accesses are permitted. The assembler needs to process these attributes before generating any actual machine code to ensure the code is generated correctly for the target system.