From patchwork Mon Dec 19 11:43:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 18574 Received: (qmail 27498 invoked by alias); 19 Dec 2016 11:43:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27457 invoked by uid 89); 19 Dec 2016 11:43:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=H*F:U*macro, hosts, ase, H*r:10.100.10 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Dec 2016 11:43:26 +0000 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id DEE6C597F9D12; Mon, 19 Dec 2016 11:43:20 +0000 (GMT) Received: from [10.20.78.31] (10.20.78.31) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server id 14.3.294.0; Mon, 19 Dec 2016 11:43:23 +0000 Date: Mon, 19 Dec 2016 11:43:14 +0000 From: "Maciej W. Rozycki" To: CC: Subject: [committed] MIPS/opcodes: Only call `bfd_mips_elf_get_abiflags' if BFD64 Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Complement commit 5e7fc731f80e ("MIPS/opcodes: Also set disassembler's ASE flags from ELF structures") and fix an `--enable-targets=all' GDB build regression on 32-bit hosts where the MIPS target is a secondary: ../opcodes/libopcodes.a(mips-dis.o): In function `set_default_mips_dis_options': mips-dis.c:(.text+0x906): undefined reference to `bfd_mips_elf_get_abiflags' collect2: error: ld returned 1 exit status make[2]: *** [gdb] Error 1 by avoiding making a call to the `bfd_mips_elf_get_abiflags' function, which is not available, because there is no MIPS/ELF BFD included in 32-bit BFD builds. This call is only made from a conditional code block guarded by a check against `bfd_target_elf_flavour', which is dead in such a configuration, however cannot be optimized away by the compiler. Also some other MIPS BFDs may be available, such as a.out, ECOFF or PE, so the disassembler has to remain functional. opcodes/ * mips-dis.c (set_default_mips_dis_options) [BFD64]: Only call `bfd_mips_elf_get_abiflags' here. --- binutils-mips-opcodes-dis-bfd64.diff Index: binutils/opcodes/mips-dis.c =================================================================== --- binutils.orig/opcodes/mips-dis.c 2016-12-19 09:48:25.000000000 +0000 +++ binutils/opcodes/mips-dis.c 2016-12-19 10:54:58.853432832 +0000 @@ -845,8 +845,15 @@ set_default_mips_dis_options (struct dis { struct bfd *abfd = info->section->owner; Elf_Internal_Ehdr *header = elf_elfheader (abfd); - Elf_Internal_ABIFlags_v0 *abiflags = bfd_mips_elf_get_abiflags (abfd); + Elf_Internal_ABIFlags_v0 *abiflags = NULL; + /* We won't ever get here if !BFD64, because we won't then have + a MIPS/ELF BFD, however we need to guard against a link error + in a `--enable-targets=...' configuration with a 32-bit host, + where the MIPS target is a secondary. */ +#ifdef BFD64 + abiflags = bfd_mips_elf_get_abiflags (abfd); +#endif /* If an ELF "newabi" binary, use the n32/(n)64 GPR names. */ if (is_newabi (header)) mips_gpr_names = mips_gpr_names_newabi;