This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: fix --check-sections consistency error
On Thu, Oct 09, 2003 at 06:48:06PM -0300, Alexandre Oliva wrote:
> On Oct 9, 2003, Alan Modra <amodra@bigpond.net.au> wrote:
>
> > On Wed, Oct 08, 2003 at 07:17:09PM -0300, Alexandre Oliva wrote:
> >> * ldlang.c (lang_size_sections_1): Use IGNORE_SECTION to tell
> >> whether to skip test for no memory region.
>
> > Um, this changes more than just checking of zero sized sections. You
> > now ignore sections with just one of SEC_ALLOC or SEC_LOAD set.
>
> Hmm... Are you sure?
Yep. Consider the case where just SEC_LOAD is set. The old code
if ((bfd_get_section_flags (output_bfd, os->bfd_section)
& (SEC_ALLOC | SEC_LOAD)) != 0
...
obviously gets past the first condition. Your replacement
if (!IGNORE_SECTION (output_bfd, os->bfd_section)
...
doesn't, because IGNORE_SECTION will be true.
#define IGNORE_SECTION(bfd, s) \
(((bfd_get_section_flags (bfd, s) & (SEC_ALLOC | SEC_LOAD)) \
!= (SEC_ALLOC | SEC_LOAD)) \
|| bfd_section_size (bfd, s) == 0)
--
Alan Modra
IBM OzLabs - Linux Technology Centre