[PATCH] bpf: Added linker support for R_BPF_64_NODYLD32.

Cupertino Miranda cupertino.miranda@oracle.com
Mon Jan 8 10:16:22 GMT 2024


Hi Jose,

Thanks for your review.
I realized I missed to update the macro for the relocation where the
properties like size, overflow check, (etc.) are defined.
I have added the comment near the relocation macro definition.

Sending the patch for review once again.

Regards,
Cupertino

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bpf-Added-linker-support-for-R_BPF_64_NODYLD32.patch
Type: text/x-diff
Size: 2138 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20240108/6f8c77a1/attachment.bin>
-------------- next part --------------


Jose E. Marchesi writes:

> Hi Cuper.
>
>> Hi everyone,
>>
>> This patch is in context of Nick Cliftons request in thread:
>>   https://sourceware.org/pipermail/binutils/2023-October/130194.html
>> due to bug reported in:
>>   https://bugzilla.redhat.com/show_bug.cgi?id=2245296
>>
>> For the time being the linker is not used in BPF infrastructure.
>> Considering that and without a proper way to validate the code, the
>> following patch is what I think is missing in order to add linker
>> support for the particular relocation.
>>
>> Looking forward to your review.
>>
>> Best regards,
>> Cupertino
>>
>> This patch adds linker support to patch R_BPF_64_NODYLD32 relocations.
>> The implementation was based on comments and code in LLVM, as the GNU
>> toolchain does not uses this relocation type.
>> ---
>>  bfd/elf64-bpf.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/bfd/elf64-bpf.c b/bfd/elf64-bpf.c
>> index aefad7da5ac..5820dd3d7d4 100644
>> --- a/bfd/elf64-bpf.c
>> +++ b/bfd/elf64-bpf.c
>> @@ -276,6 +276,7 @@ bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
>>            }
>>  	case R_BPF_64_ABS64:
>>  	case R_BPF_64_ABS32:
>> +	case R_BPF_64_NODYLD32:
>
> I would add here a comment explaining that R_BPF_64_NODYLD32 shall be
> handled/resolved like R_BPF_64_ABS32 and that it differs from ABS32 only
> in that the LLVM execution engine is not supposed to resolve it.
>
> Given that, the patch is OK.
> Thanks!
>
>>  	  {
>>  	    addend = bfd_get (howto->bitsize, input_bfd, where);
>>  	    relocation += addend;


More information about the Binutils mailing list