reopen 363423
found 363423 2.18.1~cvs20080103-1
tag 363423 + fixed-upstream
thanks

On Fri, Jan 18, 2008 at 10:35:09PM +0100, Aurelien Jarno wrote:
> Version: 2.18.1~cvs20080103-1
> 
> On Tue, Apr 18, 2006 at 04:06:46PM -0600, Stuart R. Anderson wrote:
> > Package: binutils
> > Version: 2.16.1cvs20060117-1.1
> > Severity: important
> > Tags: patch
> > 
> > ar (and ranlib) do not correctly identify ELF64 files in an archive. It 
> > complains that
> > the format is ambiguous.
> > 
> > cc -mabi=64   -c -o foo.o foo.c
> > ar cq libfoo.a foo.o
> > ar t libfoo.a
> > ar: libfoo.a: File format is ambiguous
> > ar: Matching formats: ecoff-littlemips ecoff-bigmips elf64-tradlittlemips
> > 
> > The test case illustrated here is attached.
> > 
> 
> The problem has been fixed somewhere between 2.18 and the current
> version. Marking the bug fixed in latest version in unstable.
> 

I was actually wrong, the problem is not fixed in the Debian package,
but it is fixed in upstream CVS.

Please find attached a patch pulled from CVS that can be dropped into 
debian/patches to fix the problem.

-- 
  .''`.  Aurelien Jarno             | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [EMAIL PROTECTED]         | [EMAIL PROTECTED]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#!/bin/sh -e
## 306_pr4453.dpatch
##
## DP: Description: Fix PR binutils/4453
## DP: Upstream status: Fix in CVS head

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as 
argument"
                exit 1;;
esac

exit 0

2008-01-21  Alan Modra  <[EMAIL PROTECTED]>

        PR 4453
        * format.c (bfd_check_format_matches): Don't accept archives as
        fully matching unless they have a map.

@DPATCH@
===================================================================
RCS file: /cvs/src/src/bfd/format.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- src/bfd/format.c    2007/09/14 05:19:27     1.26
+++ src/bfd/format.c    2008/01/21 04:56:47     1.27
@@ -1,6 +1,6 @@
 /* Generic BFD support for file formats.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
-   2003, 2005, 2007 Free Software Foundation, Inc.
+   2003, 2005, 2007, 2008 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -210,7 +210,7 @@
 
       temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
 
-      if (temp)
+      if (temp && (abfd->format != bfd_archive || bfd_has_map (abfd)))
        {
          /* This format checks out as ok!  */
          right_targ = temp;
@@ -228,12 +228,13 @@
            matching_vector[match_count] = temp;
          match_count++;
        }
-      else if ((err = bfd_get_error ()) == bfd_error_wrong_object_format
+      else if (temp
+              || (err = bfd_get_error ()) == bfd_error_wrong_object_format
               || err == bfd_error_file_ambiguously_recognized)
        {
-         /* An archive with objects of the wrong type, or an
-            ambiguous match.  We want this target to match if we get
-            no better matches.  */
+         /* An archive with no armap or objects of the wrong type,
+            or an ambiguous match.  We want this target to match
+            if we get no better matches.  */
          if (ar_right_targ != bfd_default_vector[0])
            ar_right_targ = *target;
          if (matching_vector)

Reply via email to