From patchwork Thu Feb 26 17:05:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 5315 Received: (qmail 37189 invoked by alias); 26 Feb 2015 17:05:10 -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 37180 invoked by uid 89); 26 Feb 2015 17:05:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp12.uk.ibm.com Received: from e06smtp12.uk.ibm.com (HELO e06smtp12.uk.ibm.com) (195.75.94.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 26 Feb 2015 17:05:08 +0000 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Feb 2015 17:05:05 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Feb 2015 17:05:03 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id AE797219005F for ; Thu, 26 Feb 2015 17:04:55 +0000 (GMT) Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1QH52ln55312580 for ; Thu, 26 Feb 2015 17:05:02 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1QH52V0031151 for ; Thu, 26 Feb 2015 10:05:02 -0700 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-115.boeblingen.de.ibm.com [9.152.212.115]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t1QH51HJ031116 for ; Thu, 26 Feb 2015 10:05:01 -0700 From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH] S390: Fix compiler invocation with "compile" command Date: Thu, 26 Feb 2015 18:05:01 +0100 Message-ID: <871tlc4n9e.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15022617-0009-0000-0000-0000034701E0 X-IsSubscribed: yes On 64-bit S390 platforms the "compile" command always failed because gcc was not invoked correctly. This patch fixes the compiler invocation. gdb/ChangeLog: * s390-linux-tdep.c (s390_gcc_target_options): Not just handle 31-bit targets, but 64-bit targets as well. (s390_gnu_triplet_regexp): New function. (s390_gdbarch_init): Set the gcc_target_options gdbarch method for 64-bit targets as well. Set the gnu_triplet_regexp gdbarch method. --- gdb/s390-linux-tdep.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index 9bd25fe..803779c 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -2808,12 +2808,24 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, return 0; } -/* Implement gdbarch_gcc_target_options. GCC does not know "-m32". */ +/* Implement gdbarch_gcc_target_options. GCC does not know "-m32" or + "-mcmodel=large". */ static char * s390_gcc_target_options (struct gdbarch *gdbarch) { - return xstrdup ("-m31"); + return xstrdup (gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31"); +} + +/* Implement gdbarch_gnu_triplet_regexp. Target triplets are "s390-*" + for 31-bit and "s390x-*" for 64-bit, while the BFD arch name is + always "s390". Note that an s390x compiler supports "-m31" as + well. */ + +static const char * +s390_gnu_triplet_regexp (struct gdbarch *gdbarch) +{ + return "s390x?"; } /* Implementation of `gdbarch_stap_is_single_operand', as defined in @@ -3112,7 +3124,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { case ABI_LINUX_S390: set_gdbarch_addr_bits_remove (gdbarch, s390_addr_bits_remove); - set_gdbarch_gcc_target_options (gdbarch, s390_gcc_target_options); set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); @@ -3152,6 +3163,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_stap_register_indirection_suffixes (gdbarch, stap_register_indirection_suffixes); set_gdbarch_stap_is_single_operand (gdbarch, s390_stap_is_single_operand); + set_gdbarch_gcc_target_options (gdbarch, s390_gcc_target_options); + set_gdbarch_gnu_triplet_regexp (gdbarch, s390_gnu_triplet_regexp); return gdbarch; }