[RFC] RISCV: Align using RVC insns

Patrick O'Neill patrick@rivosinc.com
Mon Mar 28 16:08:10 GMT 2022
On 3/28/22 00:54, Jan Beulich wrote:
> On 26.03.2022 00:15, Patrick O'Neill wrote:
>> Currently, .align and .balign directives only use nops to achieve
>> alignment. On RVC targets, the linker can selectively compress
>> instructions to achieve alignment without introducing nops.
>>
>> This increases the code size of unlinked binaries since instruction
>> compression is deferred to the linker. Linked binaries with align
>> directives may be smaller/run faster due to less nops.
>>
>> Binaries without align directives should be unaffected by this change.
>>
>> This change requires adding a reloc for compressable instructions. The
>> addend of that reloc stores the compressed instruction's opcode.
>>
>> Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
> May I ask where the specification for this lives? I've just pulled down
> the latest version of the psABI, but that doesn't even mention the new
> relocation type you use here. Going over
> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues also didn't
> turn up anything obvious.
>
> Jan
>
Hi Jan,

Sorry if I wasn't clear, this relocation currently doesn't exist in the
spec and is only used/mentioned in this RFC.
This RFC aims gauge if this would be worth adding and to gather people's
thoughts about this approach. I'm not super familiar with the process of
adding a relocation to the spec, so if there are better places to
discuss this, please let me know!

Patrick


More information about the Binutils mailing list