From patchwork Wed Jan 18 15:49:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 18942 Received: (qmail 95204 invoked by alias); 18 Jan 2017 15:50:16 -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 95170 invoked by uid 89); 18 Jan 2017 15:50:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=gdbtesters, gdb-testers, H*o:Research, Architecture X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Jan 2017 15:50:01 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v0IFn2uQ131196 for ; Wed, 18 Jan 2017 10:50:00 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2829n1w6rr-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 18 Jan 2017 10:49:59 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Jan 2017 15:49:57 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Jan 2017 15:49:55 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 49ECE2190056 for ; Wed, 18 Jan 2017 15:49:01 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v0IFnsJi721350 for ; Wed, 18 Jan 2017 15:49:54 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5D7BA405D for ; Wed, 18 Jan 2017 14:47:49 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A49C7A404D for ; Wed, 18 Jan 2017 14:47:49 +0000 (GMT) Received: from oc1027705133.ibm.com (unknown [9.152.212.222]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS for ; Wed, 18 Jan 2017 14:47:49 +0000 (GMT) From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [RFC][PATCH] Big-endian hosts: Fix "set architecture cris" Date: Wed, 18 Jan 2017 16:49:54 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17011815-0020-0000-0000-000002F4398D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17011815-0021-0000-0000-00004012FCEA Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-01-18_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701180206 X-IsSubscribed: yes The all-architectures-1.exp test case currently yields 66 FAILs on s390x, because the "set architecture" command fails each time when attempting to switch to "cris", "crisv32", or "cris:common_v10_v32". Actually, the command would succeed if the endianness had been set to "little" before. Instead, the test case sets the endianness to "auto", which results in "big" on s390x. So on x86_64: (gdb) set endian auto The target endianness is set automatically (currently little endian) (gdb) set architecture cris warning: A handler for the OS ABI "AIX" is not built into this configuration of GDB. Attempting to continue with the default cris settings. The target architecture is assumed to be cris But on s390x: (gdb) set endian auto The target endianness is set automatically (currently big endian) (gdb) set architecture cris Architecture `cris' not recognized. See also the test results for s390x and ppc64be: https://sourceware.org/ml/gdb-testers/2016-q4/msg05150.html https://sourceware.org/ml/gdb-testers/2016-q4/msg05713.html Indeed, cris_gdbarch_init in cris-tdep.c returns a failure unless the user-specified endianness is "little". Other architectures usually ignore the user-specified endianness and return a valid gdbarch anyhow, even if they can not really cope with the given endianness. This patch removes the check in cris-tdep.c and forces little-endian byte order instead. gdb/ChangeLog: * cris-tdep.c (cris_gdbarch_init): Remove check for info.byte_order and force it to BFD_ENDIAN_LITTLE. --- gdb/cris-tdep.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index c2ce338..aefd44a 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -4022,31 +4022,14 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* No matching architecture was found. Create a new one. */ tdep = XNEW (struct gdbarch_tdep); + info.byte_order = BFD_ENDIAN_LITTLE; gdbarch = gdbarch_alloc (&info, tdep); tdep->cris_version = usr_cmd_cris_version; tdep->cris_mode = usr_cmd_cris_mode; tdep->cris_dwarf2_cfi = usr_cmd_cris_dwarf2_cfi; - /* INIT shall ensure that the INFO.BYTE_ORDER is non-zero. */ - switch (info.byte_order) - { - case BFD_ENDIAN_LITTLE: - /* Ok. */ - break; - - case BFD_ENDIAN_BIG: - /* Cris is always little endian, but the user could have forced - big endian with "set endian". */ - return 0; - - default: - internal_error (__FILE__, __LINE__, - _("cris_gdbarch_init: unknown byte order in info")); - } - set_gdbarch_return_value (gdbarch, cris_return_value); - set_gdbarch_sp_regnum (gdbarch, 14); /* Length of ordinary registers used in push_word and a few other