[PATCH] RISC-V: Avoid relocation for a function symbol self-referenced with -mno-relax
Xiao Zeng
zengxiao@eswincomputing.com
Tue Jan 7 05:40:32 GMT 2025
2025-01-07 12:02 Nelson Chu <nelson@rivosinc.com> wrote:
>
>On Tue, Jan 7, 2025 at 11:03 AM Xiao Zeng <zengxiao@eswincomputing.com>
>wrote:
>
>> 2025-01-07 10:46 Nelson Chu <nelson@rivosinc.com> wrote:
>> >The original idea was to only optimize local symbols, since global/weak
>> >symbols may be preemptive in the link time, so we cannot resolve them in
>> >the assembler time.
>> Your point is correct, but considering this special case: When relaxation
>> is
>> disabled, the assembler no longer needs to generate relocation information
>> for references to this symbol within its body. Regardless of whether it's a
>> global symbol, the relocation can be completed during the assembly phase,
>> without needing to defer it to the linking (ld) phase.
>>
>> It is optimized specifically for this special scenario.
>>
>
>Even the symbol seems referenced within its body in assembler, if it is
>preemptive, then it may be changed in the linker...
Obviously, I didn't consider this point. If possible, could you kindly ask
Nelson to provide an example? I would greatly appreciate it.
>
>Nelson
Thanks
Xiao Zeng
More information about the Binutils
mailing list