From patchwork Fri Oct 4 16:27:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cary Coutant X-Patchwork-Id: 280667 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D4D3C2C00AA for ; Sat, 5 Oct 2013 02:28:04 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :to:subject:mime-version:content-type:content-transfer-encoding :message-id:from; q=dns; s=default; b=MzPseX28LnR8Dl2N15eQ+NBpmG mqEoFVH75OjFB2Bfmqx00aZHpX8Q9QpRFtsd/k3+nrwpDbTc++aqR1/FXMjsCq7u yI22LxQS1U8jgECjPMNiyED5G1sNgT/X8M6blL9LLEn2EZDKFaJMS2ukbd3A0rnu yMJWb+wzFJpRD2iig= 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:date :to:subject:mime-version:content-type:content-transfer-encoding :message-id:from; s=default; bh=CYbNUNALiU/CK5044+VPcNlE/M4=; b= Lyg47N58D1fcvJ8XMDDJfHoEqP815nGMGzAwF1e7WEh3jFzsmYAV14RYBpf/Iwsn unmmHj/WOtfZ+QYt7PSDfQwulWeRVw0iFhtCgX008Jhe3T+vAlS1fDNbQnNG5PPq 6Z4W7O+oxwOtFHTm+fI6NDfJJHQx0dOvL4sn/vrBALs= Received: (qmail 11079 invoked by alias); 4 Oct 2013 16:27:58 -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 11063 invoked by uid 89); 4 Oct 2013 16:27:58 -0000 Received: from mail-vc0-f202.google.com (HELO mail-vc0-f202.google.com) (209.85.220.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 04 Oct 2013 16:27:58 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=ALL_TRUSTED, AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-vc0-f202.google.com Received: by mail-vc0-f202.google.com with SMTP id gd11so342965vcb.1 for ; Fri, 04 Oct 2013 09:27:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:to:subject:user-agent:mime-version :content-type:content-transfer-encoding:message-id:from; bh=oziTghnF3kZKBP6mOFK+69YoboYGaDrQF0GzsV1cQzY=; b=jeNKECbG7P7EK+iwLZA3BG89O14W7Pf7G9yog/G9VEZT0uEn78YyUvOs8H0BZf3nJm AtWz5pz542qq7RoQtIo8VbQDXnI8v3lLVoEO51j0XI3MrIQFWEOMzWOl+xIaDbq1aZVn T+KZj1rylRVbbCqnCo2NPNKYubqMVWaaLxfzZXkYbm9pE9uz3e6zhPmsmpvfKtXNoCc2 6+eHJMy8yqZ4CmJy+KX+6PwxWhqAeQ8NYliKTY/nPKhRFgsEsvNM3tTnxrVdtPJc5yRU 6kgTSTNdk307CIOB/voVlXKGTn/vTsBJrvRDqb154nt8j7cmfqfTMQLb3VCVYmAhJ9x+ ex9w== X-Gm-Message-State: ALoCoQnX/Oni6SmoNICqokhxZ2piebQ1M74tHuDcAApRbFEEivF6E28wAXNsfx6YGqWBNniywkrzSJUIrFkIMWiy8yX+uIWARNw6br1b5p1Z24QRLVD00kjFutDoHoykLCqcdl90htPo6tKyTbOp73SW37ziKeYync438eGdKA6F2MSF4iLY0KoD0xzNqDXulUY3CCm8mYtvwVCgqzR9JeiC2v/9Jr9pnNsu2nEce0YRyzYe82Zv890= X-Received: by 10.236.82.115 with SMTP id n79mr13591452yhe.35.1380904074960; Fri, 04 Oct 2013 09:27:54 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id a24si696055yhl.1.1969.12.31.16.00.00 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Fri, 04 Oct 2013 09:27:54 -0700 (PDT) Received: from ccoutant.mtv.corp.google.com (ccoutant.mtv.corp.google.com [172.17.128.119]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id C2D145A410D for ; Fri, 4 Oct 2013 09:27:54 -0700 (PDT) Received: by ccoutant.mtv.corp.google.com (Postfix, from userid 62097) id 5AF1316058E; Fri, 4 Oct 2013 09:27:54 -0700 (PDT) Date: Fri, 04 Oct 2013 09:27:54 -0700 To: gcc-patches@gcc.gnu.org Subject: [patch] Fix unresolved symbol with -gsplit-dwarf User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-Id: <20131004162754.5AF1316058E@ccoutant.mtv.corp.google.com> From: ccoutant@google.com (Cary Coutant) X-IsSubscribed: yes When building the location list for a variable that has been optimized by SRA, dw_sra_loc_expr sometimes creates a DWARF expression or a piece of an expression, but then abandons it for some reason. When abandoning it, we neglected to release any addr_table entries created for DW_OP_addr_index opcodes, occasionally resulting in a link-time unresolved symbol. This patch releases the addr_table entries before abandoning a location expression. Bootstrapped and regression tested on x86-64. Committed to trunk at r203206. -cary 2013-10-03 Cary Coutant gcc/ * dwarf2out.c (dw_sra_loc_expr): Release addr_table entries when discarding a location list expression (or a piece of one). Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 203183) +++ dwarf2out.c (working copy) @@ -13492,6 +13492,9 @@ dw_sra_loc_expr (tree decl, rtx loc) if (last != NULL && opsize != bitsize) { padsize += bitsize; + /* Discard the current piece of the descriptor and release any + addr_table entries it uses. */ + remove_loc_list_addr_table_entries (cur_descr); continue; } @@ -13500,18 +13503,24 @@ dw_sra_loc_expr (tree decl, rtx loc) if (padsize) { if (padsize > decl_size) - return NULL; + { + remove_loc_list_addr_table_entries (cur_descr); + goto discard_descr; + } decl_size -= padsize; *descr_tail = new_loc_descr_op_bit_piece (padsize, 0); if (*descr_tail == NULL) - return NULL; + { + remove_loc_list_addr_table_entries (cur_descr); + goto discard_descr; + } descr_tail = &(*descr_tail)->dw_loc_next; padsize = 0; } *descr_tail = cur_descr; descr_tail = tail; if (bitsize > decl_size) - return NULL; + goto discard_descr; decl_size -= bitsize; if (last == NULL) { @@ -13547,9 +13556,9 @@ dw_sra_loc_expr (tree decl, rtx loc) { if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN && (memsize > BITS_PER_WORD || bitsize > BITS_PER_WORD)) - return NULL; + goto discard_descr; if (memsize < bitsize) - return NULL; + goto discard_descr; if (BITS_BIG_ENDIAN) offset = memsize - bitsize; } @@ -13557,7 +13566,7 @@ dw_sra_loc_expr (tree decl, rtx loc) *descr_tail = new_loc_descr_op_bit_piece (bitsize, offset); if (*descr_tail == NULL) - return NULL; + goto discard_descr; descr_tail = &(*descr_tail)->dw_loc_next; } } @@ -13568,9 +13577,14 @@ dw_sra_loc_expr (tree decl, rtx loc) { *descr_tail = new_loc_descr_op_bit_piece (decl_size, 0); if (*descr_tail == NULL) - return NULL; + goto discard_descr; } return descr; + +discard_descr: + /* Discard the descriptor and release any addr_table entries it uses. */ + remove_loc_list_addr_table_entries (descr); + return NULL; } /* Return the dwarf representation of the location list LOC_LIST of