From patchwork Wed Jun 6 21:04:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 163427 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]) by ozlabs.org (Postfix) with SMTP id 07B84B6F62 for ; Thu, 7 Jun 2012 07:04:48 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1339621489; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:Message-Id:From:To:CC:Subject: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=GRcGpkAlUSG7XkbW0ZEy 31VtRh8=; b=kmw2LgLbzzYiBo9awunThLVR+3Fn3mFhaenJ1L8MwJaQ7A6xlOHH bQ8zMgBcjbV0qe3lkfA99hDAnUhwon7YFlZBpLRPiL17FdOKUbeOkQF0tZiz5Y26 7lVu36zsbyPRXP7NIjnX9GqvIls6iNLrjrzECNoleE4FBDxPRbVFJn0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Date:Message-Id:From:To:CC:Subject:X-Gm-Message-State:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=cKk7ilQfQi4BfIELPJpw/6OBm9R+n921/EaaHRpPMCYyxwiSPnFvg3D4wAnWzo rHhVtBVIJ5F92tQ/2dCGn5zh7pJ6jiQB5oD/fbEQjdljS23S2zRkOdIwQy6DbsGR W+YtIjexIM1oWy+R7As9Ol6KtUWVk6ECgdr7pEdRNGStw=; Received: (qmail 24882 invoked by alias); 6 Jun 2012 21:04:43 -0000 Received: (qmail 24850 invoked by uid 22791); 6 Jun 2012 21:04:41 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KAM_STOCKGEN, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Jun 2012 21:04:27 +0000 Received: by dalh21 with SMTP id h21so9177041dal.20 for ; Wed, 06 Jun 2012 14:04:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:message-id:from:to:cc:subject:emacs:x-gm-message-state; bh=pTLM8fkhHu4yS3noQum3eZorU2Y4VfYBecft1WHxfDM=; b=a7AW6nIKUPa0IlOBgFhiTPqDZTjH5rPuCDnkoI15P+quuYx1F1mx+m6XG6ng3dwP9Z aQt8aCFNeQ1+IrtWSB1B6Ny1TRppFsP3LkLvs3RQOAh3/kxvQYFaSUXRslIzMOxGwloT 6H8vnbO0hrrfy4jRohDayXqWN4Ga+cAWejoSJPUgV/f+m5RnilLV9PwmNx8VdPtAG6fU mElsx2lDLoPBHruGAhoswFkP8u5tz29/a2bvCFY+OSUmjkdQOsjiTnpo58x11DsIMxgl /JJZkiuN8lUhjv6N6Eqayh8kMpC9tZGxZ/DBL99nb5ZOfRtVQBc+POLqbVWW0ZGyvaYc TGLQ== Received: by 10.68.197.136 with SMTP id iu8mr463482pbc.111.1339016667348; Wed, 06 Jun 2012 14:04:27 -0700 (PDT) Received: by 10.68.197.136 with SMTP id iu8mr463464pbc.111.1339016667181; Wed, 06 Jun 2012 14:04:27 -0700 (PDT) Received: from frobland.mtv.corp.google.com.google.com ([2620:0:1000:1b01:6631:50ff:fe3b:961a]) by mx.google.com with ESMTPS id ms1sm1525747pbb.63.2012.06.06.14.04.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 06 Jun 2012 14:04:26 -0700 (PDT) Date: Wed, 06 Jun 2012 14:04:24 -0700 Message-Id: From: Roland McGrath To: Jakub Jelinek CC: gcc-patches@gcc.gnu.org Subject: [PATCH] don't presume undelegitimized UNSPEC_TLS SYMBOL_REF is a decl X-Gm-Message-State: ALoCoQklZeE1ZuV2pPwAHJRkpVPlZiS0K8/STKlPtCjeMnEGnwuTsE0qMQ5t9I1JNNbCDY+eHD0Av6GZDMZm3vJJw/+W2BmiOYkLt/zCVMWRO7qDKLatAcSew/45FvieAFoY7RUehQMuzi5G3/tIXEHYpDxwwoTT2A== 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 cf this change: 2010-11-19 Jakub Jelinek PR target/45870 * dwarf2out.c (const_ok_for_output_1): Don't complain about non-delegitimized TLS UNSPECs. This case hit me where the rtx was: (unspec:SI [ (symbol_ref:SI ("*.LANCHOR0") [flags 0x1aa]) (const_int 4 [0x4]) ] UNSPEC_TLS) Note: 1. The UNSPEC has two operands, not one. 2. The SYMBOL_REF does not correspond to any decl. This corresponds to this ARM code: ldr r3, .L10+4 ... .L10: .word .LANCHOR0(tpoff) ... .section .tdata,"awT",%progbits .align 4 .LANCHOR0 = . + 0 .type tdata1, %object .size tdata1, 4 tdata1: .word 1 The only way I know to reproduce this is using a variant ARM target that I'm still developing and is not yet ready to be submitted, so I don't have a proper test case to offer. But I think the principle of the following change is fairly sound. What do you think? (Recall that I am not a GCC committer, so if you like the change, please commit it for me.) Thanks, Roland 2012-06-06 Roland McGrath * dwarf2out.c (const_ok_for_output_1): Detect a TLS UNSPEC using SYMBOL_REF_TLS_MODEL rather than DECL_THREAD_LOCAL_P, in case it's not a VAR_DECL. Also don't limit it to UNSPECs with exactly one operand. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6e4ab76..bc68205 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10129,12 +10129,12 @@ const_ok_for_output_1 (rtx *rtlp, void *data ATTRIBUTE_UNUSED) we can't express it in the debug info. */ #ifdef ENABLE_CHECKING /* Don't complain about TLS UNSPECs, those are just too hard to - delegitimize. */ - if (XVECLEN (rtl, 0) != 1 + delegitimize. Note this could be a non-decl SYMBOL_REF such as + one in a constant pool entry, so testing SYMBOL_REF_TLS_MODEL + rather than DECL_THREAD_LOCAL_P is not just an optimization. */ + if (XVECLEN (rtl, 0) == 0 || GET_CODE (XVECEXP (rtl, 0, 0)) != SYMBOL_REF - || SYMBOL_REF_DECL (XVECEXP (rtl, 0, 0)) == NULL - || TREE_CODE (SYMBOL_REF_DECL (XVECEXP (rtl, 0, 0))) != VAR_DECL - || !DECL_THREAD_LOCAL_P (SYMBOL_REF_DECL (XVECEXP (rtl, 0, 0)))) + || SYMBOL_REF_TLS_MODEL (XVECEXP (rtl, 0, 0)) == TLS_MODEL_NONE) inform (current_function_decl ? DECL_SOURCE_LOCATION (current_function_decl) : UNKNOWN_LOCATION,