From patchwork Wed Dec 21 21:19:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 5935 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id BDB41240A4 for ; Wed, 21 Dec 2011 21:20:08 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id A26C0A1852C for ; Wed, 21 Dec 2011 21:20:08 +0000 (UTC) Received: by eaac11 with SMTP id c11so5079136eaa.11 for ; Wed, 21 Dec 2011 13:20:08 -0800 (PST) Received: by 10.205.120.148 with SMTP id fy20mr2180400bkc.125.1324502408226; Wed, 21 Dec 2011 13:20:08 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs50203bkc; Wed, 21 Dec 2011 13:20:08 -0800 (PST) Received: by 10.227.203.84 with SMTP id fh20mr7855894wbb.27.1324502406765; Wed, 21 Dec 2011 13:20:06 -0800 (PST) Received: from e06smtp16.uk.ibm.com (e06smtp16.uk.ibm.com. [195.75.94.112]) by mx.google.com with ESMTPS id eu12si3593827wbb.122.2011.12.21.13.20.06 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Dec 2011 13:20:06 -0800 (PST) Received-SPF: pass (google.com: domain of uweigand@de.ibm.com designates 195.75.94.112 as permitted sender) client-ip=195.75.94.112; Authentication-Results: mx.google.com; spf=pass (google.com: domain of uweigand@de.ibm.com designates 195.75.94.112 as permitted sender) smtp.mail=uweigand@de.ibm.com Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Dec 2011 21:20:02 -0000 Received: from d06nrmr1507.portsmouth.uk.ibm.com ([9.149.38.233]) by e06smtp16.uk.ibm.com ([192.168.101.146]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 21 Dec 2011 21:19:59 -0000 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBLLJxxc2199722 for ; Wed, 21 Dec 2011 21:19:59 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBLLJxYg022862 for ; Wed, 21 Dec 2011 14:19:59 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id pBLLJw37022836; Wed, 21 Dec 2011 14:19:58 -0700 Message-Id: <201112212119.pBLLJw37022836@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 21 Dec 2011 22:19:58 +0100 Subject: [commit+7.4][arm] Fix PR tdep/12797 and callfuncs.exp regression To: gdb-patches@sourceware.org Date: Wed, 21 Dec 2011 22:19:58 +0100 (CET) From: "Ulrich Weigand" Cc: patches@linaro.org X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 x-cbid: 11122121-3548-0000-0000-00000079E6EE Hello, in comparing 7.3 and 7.4 testsuite results on ARM I noticed this regression: FAIL: gdb.base/callfuncs.exp: gdb function calls preserve register contents The problem is that some of the preceding tests already failed due to missing support for complex data types in arm_return_value. This had previously been noticed and KFAILed as PR tdep/12797, but since the inferior calls with wrong ABI actually segfault, we were now seeing follow-on failures in unrelated tests in the same test case. To fix this, the patch below simply implements the missing support for complex types in arm_return_value. Tested on arm-linux-gnueabi with no regressions. Committed to mainline and 7.4. Bye, Ulrich ChangeLog: gdb/ PR tdep/12797 * arm-tdep.c (arm_return_value): Handle complex types. gdb/testsuite/ PR tdep/12797 * gdb.base/callfuncs.exp: Remove KFAIL. Index: gdb/arm-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/arm-tdep.c,v retrieving revision 1.354 diff -u -p -r1.354 arm-tdep.c --- gdb/arm-tdep.c 7 Dec 2011 20:53:08 -0000 1.354 +++ gdb/arm-tdep.c 21 Dec 2011 18:05:30 -0000 @@ -9061,6 +9061,12 @@ arm_return_value (struct gdbarch *gdbarc return RETURN_VALUE_STRUCT_CONVENTION; } + /* AAPCS returns complex types longer than a register in memory. */ + if (tdep->arm_abi != ARM_ABI_APCS + && TYPE_CODE (valtype) == TYPE_CODE_COMPLEX + && TYPE_LENGTH (valtype) > INT_REGISTER_SIZE) + return RETURN_VALUE_STRUCT_CONVENTION; + if (writebuf) arm_store_return_value (valtype, regcache, writebuf); Index: gdb/testsuite/gdb.base/callfuncs.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.exp,v retrieving revision 1.46 diff -u -p -r1.46 callfuncs.exp --- gdb/testsuite/gdb.base/callfuncs.exp 6 Dec 2011 14:14:50 -0000 1.46 +++ gdb/testsuite/gdb.base/callfuncs.exp 21 Dec 2011 18:05:33 -0000 @@ -248,19 +248,16 @@ proc do_function_calls {} { if [support_complex_tests] { setup_kfail_for_target gdb/12796 "x86_64-*-*" - setup_kfail_for_target gdb/12797 "arm*-*-*" gdb_test "p t_structs_fc(struct_val1)" ".*= 3 \\+ 3 \\* I" \ "call inferior func with struct - returns float _Complex" setup_kfail_for_target gdb/12783 "i?86-*-*" setup_kfail_for_target gdb/12796 "x86_64-*-*" - setup_kfail_for_target gdb/12797 "arm*-*-*" gdb_test "p t_structs_dc(struct_val1)" ".*= 4 \\+ 4 \\* I" \ "call inferior func with struct - returns double _Complex" setup_kfail_for_target gdb/12783 "i?86-*-*" setup_kfail_for_target gdb/12796 "x86_64-*-*" - setup_kfail_for_target gdb/12797 "arm*-*-*" gdb_test "p t_structs_ldc(struct_val1)" "= 5 \\+ 5 \\* I" \ "call inferior func with struct - returns long double _Complex" }