[PATCH] dwarf: constify read_leb128()'s first parameter
Matthieu Longo
matthieu.longo@arm.com
Mon Jan 19 16:56:13 GMT 2026
On 19/01/2026 16:52, Jan Beulich wrote:
> 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
Ok, I will publish the patch in a separate email.
Please let me know when you will merge yours, as the attached patch has a dependency on it.
Matthieu
More information about the Binutils
mailing list