From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89561 invoked by alias); 4 Jan 2017 03:09:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 89215 invoked by uid 89); 4 Jan 2017 03:09:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HX-Greylist:EST, HX-Greylist:0500, rozycki, Hx-languages-length:2102 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Jan 2017 03:09:06 +0000 Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id A170310B514; Tue, 3 Jan 2017 22:09:04 -0500 (EST) From: John Baldwin To: "Maciej W. Rozycki" Cc: "Maciej W. Rozycki" , gdb-patches@sourceware.org, binutils@sourceware.org Subject: Re: [PATCH v3 1/3] Use bfd_mach_mips4000 as the default machine type for 64-bit MIPS ABIs. Date: Wed, 04 Jan 2017 03:09:00 -0000 Message-ID: <5297044.gtT06bVioC@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <20170103184341.58346-1-jhb@FreeBSD.org> <20170103184341.58346-2-jhb@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00041.txt.bz2 On Wednesday, January 04, 2017 02:09:17 AM Maciej W. Rozycki wrote: > On Tue, 3 Jan 2017, John Baldwin wrote: > > > If the flags word of an ELF header is empty, _bfd_elf_mips_mach always > > returned bfd_mach_mips3000 which is a 32-bit MIPS ABI. This change > > uses bfd_mach_mips4000 if the ELF class identifies a 64-bit binary. > > Since this touches the MIPS port I'll have a look at it in details when I > am back next week. > > In particular I'm a bit concerned about the inconsistency between n64 and > n32 it introduces by making one default to `bfd_mach_mips4000' but not the > other, while both are 64-bit ABIs requiring a 64-bit processor to run. > Which is also already known at the time `_bfd_elf_mips_mach' is being > called. So rather than changing its API entirely perhaps we just need an > extra `need_64bit' or suchlike extra argument for the callee to select the > BFD appropriately if the ISA is set incorrectly in the ELF object. > > Also can you please remind me why this is the case in the first place and > how exactly such ELF objects are annotated, e.g. can we identify (limit > the handling of) such faulty objects with the EI_OSABI marker for example? > NB this should be explained in details for posterity in the commit message > itself. The specific use case is that FreeBSD/mips kernels currently write out process core dumps with the 'flags' field in the ELF header set to zero. This is true for o32, n64, and n32. I originally added a workaround in elfcore_grok_freebsd_* to use the ELF class instead of 'bits_per_word' to determine the layout of the process info and status core dump notes, but switched to this approach in reponse to review of the first patch. I would be fine with making this conditional on ELFOSABI_FREEBSD. At some point I will probably fix FreeBSD/mips kernels to set a suitable value in e_flags (probably just copy it over from the binary) at which point this workaround would no longer be needed, but that doesn't fix existing cores. -- John Baldwin