[PATCH] dwarf: constify read_leb128()'s first parameter

Jan Beulich jbeulich@suse.com
Mon Jan 19 16:52:26 GMT 2026


On 19.01.2026 17:46, Matthieu Longo wrote:
> On 19/01/2026 11:54, Jan Beulich wrote:
>> It's not clear why the 2nd one is, but the 1st one isn't.
>>
>> --- a/binutils/dwarf.c
>> +++ b/binutils/dwarf.c
>> @@ -278,7 +278,7 @@ null_name (const char *p)
>>      No bytes will be read at address END or beyond.  */
>>   
>>   uint64_t
>> -read_leb128 (unsigned char *data,
>> +read_leb128 (const unsigned char *data,
>>   	     const unsigned char *const end,
>>   	     bool sign,
>>   	     unsigned int *length_return,
>> --- a/binutils/dwarf.h
>> +++ b/binutils/dwarf.h
>> @@ -269,7 +269,7 @@ extern void * xcrealloc (void *, uint64_
>>      offset.  */
>>   extern bool reloc_at (struct dwarf_section *, uint64_t);
>>   
>> -extern uint64_t read_leb128 (unsigned char *, const unsigned char *const,
>> +extern uint64_t read_leb128 (const unsigned char *, const unsigned char *const,
>>   			     bool, unsigned int *, int *);
>>   
>>   #if HAVE_LIBDEBUGINFOD
> 
> You might want to add this attached patch on top of it.

I think it's better to be separate anyway, and the patch is okay. Presumably
it is even independent of mine, and can hence go in at any time?

> Fixing the constness on read_leb128() was not enough to get the new OAv2 functions constified correctly.

I wasn't saying (nor even expecting) it would necessarily be.

Jan


More information about the Binutils mailing list