Re: [PATCH 1/5] readelf: Consolidate get_[32|64]bit_section_headers
"H.J. Lu" <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <CAMe9rOrJwS=He48ROu++bgQdni_xxD4FaGq9xDOcanbn_0Nc1w@mail.gmail.com> |
On Fri, Jul 17, 2026 at 6:57 PM Jan Beulich <[email protected]> wrote: > > On 17.07.2026 11:28, H.J. Lu wrote: > > On Fri, Jul 17, 2026 at 5:27 PM H.J. Lu <[email protected]> wrote: > >> > >> On Fri, Jul 17, 2026 at 5:16 PM Jan Beulich <[email protected]> wrote: > >>> > >>> On 17.07.2026 10:32, H.J. Lu wrote: > >>>> On Fri, Jul 10, 2026 at 9:41 PM Jan Beulich <[email protected]> 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 <[email protected]> > >>>>>> --- > >>>>>> 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. > Similar approach, not use it directly. -- H.J.