From patchwork Fri Jul 8 03:06:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Bowman X-Patchwork-Id: 646286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rlztG5mwSz9sdQ for ; Fri, 8 Jul 2016 13:07:01 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ALiwd1Ag; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=PQs ioH78Lxq8LDo3j82aawMbWc/Ed3ksIb7jVvyUOyLSiRPgXUt9ktfj2I6Tl/JzRe0 /5Uv+IZP0gW9sZ/kbgcM3wX+U7ipNOUdh5gaBSHNyyyLYbdTYh9Gfrt0ne0lvaJm C1k/R93h8Tq61TN9cMcLieq5pMKmcICtFgsKFRPc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=b6VDcuh8c 9NkrYL7mz1987XmXRg=; b=ALiwd1AgrbyXbcI7iKorFIs8811FscWuG9ihq4ozE ROsFuL0GqAw00W23X9nVqJfDzjjhwSfTmFfXJVLG4Vh02O0+pSxGh9yadsgLhTUQ 2TXVhwPj/BcnTCguxEaxdAhOvil1j6xbUVktTSPAzXgpo2olCorUMvpWzrMqWz2Q aY= Received: (qmail 93731 invoked by alias); 8 Jul 2016 03:06:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 93699 invoked by uid 89); 8 Jul 2016 03:06:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=D*ftdichip.com, james.bowman@ftdichip.com, Bowman, U*james.bowman X-HELO: smtp-out6.electric.net Received: from smtp-out6.electric.net (HELO smtp-out6.electric.net) (192.162.217.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 08 Jul 2016 03:06:40 +0000 Received: from 1bLM7h-0007f0-TW by out6d.electric.net with emc1-ok (Exim 4.87) (envelope-from ) id 1bLM7h-0007fG-Uy for gcc-patches@gcc.gnu.org; Thu, 07 Jul 2016 20:06:37 -0700 Received: by emcmailer; Thu, 07 Jul 2016 20:06:37 -0700 Received: from [188.39.184.226] (helo=GLAEXCH1.ftdi.local) by out6d.electric.net with esmtps (TLSv1:AES128-SHA:128) (Exim 4.87) (envelope-from ) id 1bLM7h-0007f0-TW for gcc-patches@gcc.gnu.org; Thu, 07 Jul 2016 20:06:37 -0700 Received: from GLAEXCH3.ftdi.local ([172.16.0.161]) by glaexch1 ([172.16.0.121]) with mapi id 14.01.0438.000; Fri, 8 Jul 2016 04:06:37 +0100 From: James Bowman To: "gcc-patches@gcc.gnu.org" Subject: [patch] Fix DWARF type output for non-default address spaces Date: Fri, 8 Jul 2016 03:06:35 +0000 Message-ID: MIME-Version: 1.0 X-Outbound-IP: 188.39.184.226 X-Env-From: james.bowman@ftdichip.com X-PolicySMART: 3094660 FT32 makes use of multiple address spaces. When trying to inspect objects in GDB, GDB was treating them as a straight "const". The cause seems to be in GCC DWARF2 output. This output is handled in gcc/gcc/dwarf2out.c, where modified_type_die() checks that TYPE has qualifiers CV_QUALS. However while TYPE has ADDR_SPACE qualifiers, the modified_type_die() explicitly discards the ADDR_SPACE qualifiers. This patch retains the ADDR_SPACE qualifiers as modified_type_die() outputs the DWARF type tree. This allows the types to match, and correct type information for the object is emitted. OK to commit? [gcc] 2016-07-07 James Bowman * gcc/dwarf2out.c (modified_type_die): Retain ADDR_SPACE qualifiers. (add_type_attribute) likewise. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 237998) +++ gcc/dwarf2out.c (working copy) @@ -11222,7 +11222,8 @@ modified_type_die (tree type, int cv_qua dw_die_ref mod_scope; /* Only these cv-qualifiers are currently handled. */ const int cv_qual_mask = (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE - | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC); + | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC | + ENCODE_QUAL_ADDR_SPACE(~0U)); if (code == ERROR_MARK) return NULL; @@ -19027,7 +19028,7 @@ add_type_attribute (dw_die_ref object_di return; type_die = modified_type_die (type, - cv_quals | TYPE_QUALS_NO_ADDR_SPACE (type), + cv_quals | TYPE_QUALS (type), reverse, context_die);