[PATCH 1/5] readelf: Consolidate get_[32|64]bit_section_headers
Jan Beulich
jbeulich@suse.com
Fri Jul 17 10:57:00 GMT 2026
On 17.07.2026 11:28, H.J. Lu wrote:
> On Fri, Jul 17, 2026 at 5:27 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>> On Fri, Jul 17, 2026 at 5:16 PM Jan Beulich <jbeulich@suse.com> wrote:
>>>
>>> On 17.07.2026 10:32, H.J. Lu wrote:
>>>> On Fri, Jul 10, 2026 at 9:41 PM Jan Beulich <jbeulich@suse.com> wrote:
>>>>> On 09.07.2026 14:40, H.J. Lu wrote:
>>>>>> Consolidate get_32bit_section_headers and get_64bit_section_headers into
>>>>>> get_section_headers. Use BYTE_GET_SIZE to retrieve external ELF section
>>>>>> header fields.
>>>>>>
>>>>>> PR binutils/34356
>>>>>> * elfcomm.h (BYTE_GET_SIZE): New.
>>>>>> * readelf.c (get_32bit_section_headers): Moved to ...
>>>>>> (get_section_headers): This. Use BYTE_GET_SIZE to retrieve
>>>>>> external ELF section header fields.
>>>>>> (get_64bit_section_headers): Removed.
>>>>>>
>>>>>> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
>>>>>> ---
>>>>>> binutils/elfcomm.h | 6 ++
>>>>>> binutils/readelf.c | 146 ++++++++++++---------------------------------
>>>>>> 2 files changed, 43 insertions(+), 109 deletions(-)
>>>>>
>>>>> While this of course is a nice reduction in code size, ...
>>>>
>>>> Code size reduction isn't my main motivation. I don't like
>>>> adding duplication codes to 2 different places.
>>>
>>> Neither do I. How about the attached alternatives to two of your patches?
>>>
>>
>> These are similar to bfd/elfcode.h. They should work.
>
> elfcode.h kind of thing should cover all duplicated codes.
Except that readelf carefully avoids to become dependent on libbfd.
Jan
More information about the Binutils
mailing list