From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28503 invoked by alias); 4 Jun 2011 18:00:11 -0000 Received: (qmail 28495 invoked by uid 22791); 4 Jun 2011 18:00:10 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-qy0-f169.google.com (HELO mail-qy0-f169.google.com) (209.85.216.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Jun 2011 17:59:51 +0000 Received: by qyk2 with SMTP id 2so266593qyk.0 for ; Sat, 04 Jun 2011 10:59:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.131.32 with SMTP id v32mr2381128qcs.35.1307210390733; Sat, 04 Jun 2011 10:59:50 -0700 (PDT) Received: by 10.229.39.78 with HTTP; Sat, 4 Jun 2011 10:59:50 -0700 (PDT) In-Reply-To: References: <20110604040358.GB20933@bubble.grove.modra.org> Date: Sat, 04 Jun 2011 18:00:00 -0000 Message-ID: Subject: Re: bfd_arch_get_compatible From: "H.J. Lu" To: binutils@sourceware.org, Alan Modra Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00043.txt.bz2 On Sat, Jun 4, 2011 at 10:20 AM, H.J. Lu wrote: > On Fri, Jun 3, 2011 at 9:03 PM, Alan Modra wrote: >> Some time ago --accept-unknown-input-format was added to ld, >> http://sourceware.org/ml/binutils/2002-12/msg00517.html but the patch >> committed differed from the posted patch, and had an error. =A0As far as >> I can tell the error would never be noticed, since the return value of >> bfd_arch_get_compatible is only tested for non-NULL, except in one >> place. =A0That place, elf32_m68k_merge_private_bfd_data, doesn't allow >> binary or unknown architectures, so the buggy return value doesn't >> matter there either. =A0Fixed by the following archures.c patch. >> >> Incidentally, the reason I happened to be looking at this code is >> because --accept-unknown-input-format has quite weird behaviour. =A0For >> example, suppose you build a powerpc-linux ld just using the default >> configure options, then --accept-unknown-input-format lets you link in >> i686-linux object files. =A0However, if you build powerpc-linux ld with >> --enable-targets=3Dall, then you can't link in i686-linux objects. =A0So >> --enable-targets=3Dall in this case gives you *less* functionality. >> >> In fact, you can't even do it by forcing the generic ELF target for >> the x86 objects with -b, hence the elfcode.h patch. elf_object_p change caused: http://sourceware.org/bugzilla/show_bug.cgi?id=3D12842 Do you have a testcase to show the bug you tried to fix? In the meantime, I will revert the elf_object_p change. >> =A0 =A0 =A0 =A0* archures.c (bfd_arch_get_compatible): If one arch is un= known, >> =A0 =A0 =A0 =A0return the other arch. >> =A0 =A0 =A0 =A0* elfcode.h (elf_object_p): Allow explicit match to gener= ic ELF >> =A0 =A0 =A0 =A0target. >> --=20 H.J.