The relocation's addend encodes the number of bytes with NOP
instructions, which is less than the required alignment. For
example, with compressed instructions, an alignment to 4 bytes
requires only one compressed NOP instruction of two bytes that
the linker can either leave in or remove. This actually means
that R_RISCV_ALIGN can never be ignored.
Details
Details
- Reviewers
lhames StephenFan
Diff Detail
Diff Detail
Event Timeline
Comment Actions
The required alignment is defined as NextPowerOf2(Addend) (as you changed it to) and I believe it should be ok to ignore the relocation if this value is <=2 (not sure if this will actually happen in practice).
However, please not that I just submitted a patch to implement linker relaxation which also handles alignment properly: D149526
Comment Actions
I don't think this can ever happen because the smallest compressed instruction is two bytes.
However, please not that I just submitted a patch to implement linker relaxation which also handles alignment properly: D149526
Thanks for letting me know, I wasn't aware. I left some comments ;-)