This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Implement objcopy/strip --keep-section=<sectionpattern>
- From: Alan Modra <amodra at gmail dot com>
- To: Fāng-ruì Sòng <maskray at google dot com>
- Cc: binutils at sourceware dot org, Nick Clifton <nickc at redhat dot com>
- Date: Fri, 1 Nov 2019 12:30:07 +1030
- Subject: Re: [PATCH] Implement objcopy/strip --keep-section=<sectionpattern>
- References: <CAFP8O3KYkhb=5qbsfh86Pd_8yd1J8fEuTQ-BGid6dnqQB4o5PQ@mail.gmail.com>
On Thu, Oct 31, 2019 at 05:06:58PM -0700, Fāng-ruì Sòng via binutils wrote:
> + * objcopy.c (enum option_values): Add OPTION_KEEP_SECTION.
> + (SECTION_CONTEXT_KEEP): New macro.
This needs to be more detailed. You haven't mentioned that you are
changing the other macros, nor have you mentioned the functions you
are changing in objcopy.c. The NEWS, binutils.texi, and testsuite
changes also need entries in the ChangeLog.
For the macro changes,
(SECTION_CONTEXT_KEEP): Define. Adjust other SECTION_CONTEXT macros.
would be sufficient.
> @@ -1367,6 +1373,10 @@ is_strip_section_1 (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
> static bfd_boolean
> is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
> {
> + if (find_section_list (bfd_section_name (sec), FALSE, SECTION_CONTEXT_KEEP)
> + != NULL)
> + return FALSE;
> +
> if (is_strip_section_1 (abfd, sec))
> return TRUE;
>
I believe this change should be made in is_strip_section_1 instead.
Otherwise, with a proper ChangeLog entry the patch looks good to
commit.
--
Alan Modra
Australia Development Lab, IBM