bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]: sh-hms: set target_defaulted in bfd_generic_archive_p


From: Nick Clifton
Subject: Re: [PATCH]: sh-hms: set target_defaulted in bfd_generic_archive_p
Date: 03 Oct 2001 17:55:50 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi Joern,

> > Of course it is also used in format.c:bfd_check_format_matches().
> ...
> > See also the comment and code in format.c starting at line 178.
> 
> Hmm, yes, it appears that we are breaking the non-recognition of
> archives for the binary format again.
> 
> So maybe we should leave target_defaulted being set to false in
> bfd_generic_archive_p, but clear it in bfd_check_format_matches
> when falling through from the ! target_defaulted path to the
> code that checks all available formats.

That does not work either.  (Try it and see!)

How about we check for binary archives before we even call
bfd_check_format, like this:

Cheers
        Nick

Index: archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.18
diff -p -r1.18 archive.c
*** archive.c   2001/09/19 05:33:11     1.18
--- archive.c   2001/10/03 16:57:02
*************** bfd_generic_archive_p (abfd)
*** 671,682 ****
        first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
        if (first != NULL)
        {
!         boolean fail;
  
!         first->target_defaulted = false;
!         fail = false;
!         if (bfd_check_format (first, bfd_object)
!             && first->xvec != abfd->xvec)
            {
  #if 0
              /* We ought to close `first' here, but we can't, because
--- 671,700 ----
        first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
        if (first != NULL)
        {
!         extern const bfd_target binary_vec;
  
!         /* We used to set target_defaulted to false.  This was a problem
!            for the coff-sh format archives, since coff-shl and
!            coff-shl-small targets look the same, and if target_defaulted
!            is false then the coff-shl-small target is selectable. Setting
!            target_defaulted to true solves this problem.
! 
!            Setting target_defaulted to true only changes the code slightly.
!            It now means that the special code in bfd_check_format_matches
!            to catch archives with a "binary" format will no longer be
!            triggered.  Since the binary format should never exist inside
!            an archive, this is not a big problem, but we add extra code
!            here to handle it, just in case.
! 
!            Setting target_defaulted to true also makes sense, since what we
!            are effectively doing here is using bfd_check_format to choose a
!            format for us, and then checking to see if this format matches
!            the format of the BFD.  */
!         first->target_defaulted = true;
! 
!         if (abfd->xvec == & binary_vec
!             || (bfd_check_format (first, bfd_object)
!                 && first->xvec != abfd->xvec))
            {
  #if 0
              /* We ought to close `first' here, but we can't, because




reply via email to

[Prev in Thread] Current Thread [Next in Thread]