This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] partial fix to PR binutils/14663


> Index: objcopy.c
> ===================================================================
> RCS file: /cvs/src/src/binutils/objcopy.c,v
> retrieving revision 1.157
> diff -u -p -r1.157 objcopy.c
> --- objcopy.c   8 May 2012 17:49:36 -0000       1.157
> +++ objcopy.c   3 Oct 2012 18:59:23 -0000
> @@ -985,9 +985,24 @@ is_strip_section_1 (bfd *abfd ATTRIBUTE_
>        if (strip_symbols == STRIP_NONDEBUG)
>         return FALSE;
>      }
> +  else
> +    {
> +      /* DWO sections are implicitly SEC_DEBUGGING sections.  */
> +      if (strip_symbols == STRIP_NONDWO)
> +       return !is_dwo_section (abfd, sec);
>
> -  if (strip_symbols == STRIP_NONDWO)
> -    return !is_dwo_section (abfd, sec);

I don't think this part is right. Before, this test for STRIP_NONDWO
would be hit whether SEC_DEBUGGING is true or not, and there are
non-DWO sections that have SEC_DEBUGGING as well as non-DWO sections
that don't have that flag. With your change, since we only reach this
test if SEC_DEBUGGING is false, then is_dwo_section will effectively
always be false, and you may as well just return TRUE here. But then
you'd need to take care of the case where STRIP_NONDWO is true and
SEC_DEBUGGING is true, but the section is not a DWO section.

> +      if (strip_symbols == STRIP_NONDEBUG)
> +       {
> +         /* If ELF, keep note sections.
> +            SEC could be an *ABS* section with no associated bfd,
> +            so we use sec->owner and not abfd here.  */
> +         if (sec->owner != NULL
> +             && sec->owner->xvec->flavour == bfd_target_elf_flavour
> +             && elf_section_type (sec) == SHT_NOTE)
> +           return FALSE;
> +         return TRUE;
> +       }
> +    }

This part looks OK, but I think you need to keep the if (strip_symbols
== STRIP_NONDWO) { ... } outside the if...else.

-cary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]