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

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

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


From: Joern Rennecke
Subject: [PATCH]: sh-hms: set target_defaulted in bfd_generic_archive_p
Date: Sun, 30 Sep 2001 21:47:02 +0100 (BST)

With current bfd, ld complains about the first file in libgcc.a:
:_ashiftrt.o: File format is ambiguous
:Matching formats: coff-shl coff-shl-small
And then fails to use any symbols defined in this file.  Thus, several
hundred of the c-torture testcases fail.  Moreover, any substantial
program is likely to need an arithmitcal shift right in some place or
other, and thus fail to link.

For a simpler testcase, you can try to look at libgcc.a with nm; it also
rejects the first file as having an ambigous format.

What I have found is that coff_small_object_p checks target_defaulted,
to make sure that coff-shl-small is used only if explicitly requested.
However, bfd_generic_archive_p sets target_defaulted to false and then
searches through all available bfd targets.

It seems to me that searching through all available targets for a match
is pretty similar to (trying to) defaulting to each particular target,
so target_defaulted should be set in this case.

As far as I can see, there are only three places where target_defaulted
is used (other than copied): binary.c, coff-sh.c, and ppcboot.c .
binary.c and ppcboot.c say that they should only be used as output formats;
does that mean they should not be present in archives?

The following patch fixes the sh-hms port:

Sun Sep 30 21:27:03 2001  J"orn Rennecke <address@hidden>

        * archive.c (bfd_generic_archive_p):
        Start out with target_defaulted = true.

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/09/30 20:26:36
*************** bfd_generic_archive_p (abfd)
*** 673,679 ****
        {
          boolean fail;
  
!         first->target_defaulted = false;
          fail = false;
          if (bfd_check_format (first, bfd_object)
              && first->xvec != abfd->xvec)
--- 673,679 ----
        {
          boolean fail;
  
!         first->target_defaulted = true;
          fail = false;
          if (bfd_check_format (first, bfd_object)
              && first->xvec != abfd->xvec)



reply via email to

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