On 7/17/24 9:26 AM, Georg-Johann Lay wrote:
It looks fine for the trunk. Out of curiosity, does the avr port
implement linker relaxing for this case? That would seem to be
No. avr-ld performs relaxing, but only the two cases of
- JMP/CALL to RJMP/RCALL provided the offset fits.
- [R]CALL+RET to [R]JMP provided there's no label between.
Yea, the first could be comparable to other targets. The second is
probably not all that common since the compiler should be doing that
tail call elimination.
I had a look at ld relaxing some time ago, and I must admit that
I don't understand completely what they are doing. Not much comments
and explanations there, basically a copy+paste from some other target
from decades ago...
Can't speak for the avr implementation, but in general, yes, odds are it
was copied from some other target eons ago with minimal documentation.
The basics are straightforward. The devil is in all the details. It's
been years since I've done any linker relaxing, but I've been immersed
in it in the past. I tried to comment my implementation, both in terms
of the code sequences for the target and the interactions with the BFD
datastructures.
Linker relaxing would be ADD.lo8 + ADC.hi8 => ADD.hi8 which affects
condition code.
In which case it'd only be safe if you knew that CC died before being used.
jeff