From patchwork Wed Jan 11 09:00:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Ostapenko X-Patchwork-Id: 90829 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1023614qgi; Wed, 11 Jan 2017 01:01:20 -0800 (PST) X-Received: by 10.84.143.162 with SMTP id 31mr11734511plz.2.1484125280190; Wed, 11 Jan 2017 01:01:20 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id c21si5160862pfd.231.2017.01.11.01.01.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 01:01:20 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445823-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-445823-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445823-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type :references; q=dns; s=default; b=VHn1lz1aQzH73yk7vlYFe34DJXq3WTb QIWxHBfK1W4c+IgM4RDhJxBNCdMsaV1vPmbsmUJAQwlB6zpaqcQbIbP+L0MD6JOq KlSSbDmU0OjCPRBh8lILFJgoVDVvWIbSwXPh080HZ5h8453Fylg0FUQ7/herAEL+ PjWM7cZKKFuU= 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 :subject:to:message-id:date:mime-version:content-type :references; s=default; bh=DjHeGdm1RQnP+nYBh59Ic81mYkU=; b=mtUf4 YDxFmTHH/Y3aLzzz33bRxS3vVd7x3eS6BKpZ7kUpEIjGfMXgoLfA/1LAG5OL/YaH kAiNBodxwRxTWyWI3FCeEXNjqtQ+NIhEvvz0g6WyQ0K6W2/ihd8u024C4PC5RUZw WFLxXx96URnZ+GolVfI7ejf48C/5pPm9WiqQSo= Received: (qmail 36718 invoked by alias); 11 Jan 2017 09:01:07 -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 36704 invoked by uid 89); 11 Jan 2017 09:01:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=fiasco, Hx-spam-relays-external:sk:2017011, H*RU:sk:2017011, HContent-type:mixed X-HELO: mailout2.w1.samsung.com Received: from mailout2.w1.samsung.com (HELO mailout2.w1.samsung.com) (210.118.77.12) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Jan 2017 09:00:54 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJL005BTYDCLI70@mailout2.w1.samsung.com> for gcc-patches@gcc.gnu.org; Wed, 11 Jan 2017 09:00:49 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170111090049eucas1p21ac968a85d08212380e717feea1dbec9~YrA0NpXz12143421434eucas1p22 for ; Wed, 11 Jan 2017 09:00:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id AD.35.28517.044F5785; Wed, 11 Jan 2017 09:00:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170111090048eucas1p26b3a2c088f090ca203458f5be358f3ed~YrAzj3mX-2141321413eucas1p2A for ; Wed, 11 Jan 2017 09:00:48 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 32.00.06687.474F5785; Wed, 11 Jan 2017 09:01:40 +0000 (GMT) Received: from [106.109.129.18] by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OJL0055NYDB1X00@eusync2.samsung.com> for gcc-patches@gcc.gnu.org; Wed, 11 Jan 2017 09:00:48 +0000 (GMT) From: Maxim Ostapenko Subject: [PATCH][PR lto/79042] Propagate node->dynamically_initialized bit for varpool node to LTRANS stage. To: GCC Patches Message-id: <5875F43C.6080901@samsung.com> Date: Wed, 11 Jan 2017 12:00:44 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-version: 1.0 Content-type: multipart/mixed; boundary=------------070800000001060300070301 X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170111090048eucas1p26b3a2c088f090ca203458f5be358f3ed X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFrc2ltIE9zdGFwZW5rbxtTUlItU1cgVG9vbHMgTGFiGw==?= =?UTF-8?B?7IK87ISx7KCE7J6QG0VuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?TWF4aW0gT3N0YXBlbmtvG1NSUi1TVyBUb29scyBMYWIbU2Ft?= =?UTF-8?B?c3VuZ8KgRWxlY3Ryb25pY3MbRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1Nw==?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170111090048eucas1p26b3a2c088f090ca203458f5be358f3ed X-RootMTR: 20170111090048eucas1p26b3a2c088f090ca203458f5be358f3ed References: X-IsSubscribed: yes Hi, as mentioned in PR, LTO doesn't propagate node->dynamically_initialized bit for varpool nodes that leads to ASan fails to detect initialization order fiasco even for trivial example (e.g. from here: https://github.com/google/sanitizers/wiki/AddressSanitizerExampleInitOrderFiasco). This trivial patch fixes the issue. Regtested on x86_64-unknown-linux-gnu, OK for mainline? -Maxim gcc/ChangeLog: 2017-01-11 Maxim Ostapenko PR lto/79042 * lto-cgraph.c (lto_output_varpool_node): Pack dynamically_initialized bit. (input_varpool_node): Unpack dynamically_initialized bit. diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index c0321f7..77605f7 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -626,6 +626,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node, } bp_pack_value (&bp, node->tls_model, 3); bp_pack_value (&bp, node->used_by_single_function, 1); + bp_pack_value (&bp, node->dynamically_initialized, 1); bp_pack_value (&bp, node->need_bounds_init, 1); streamer_write_bitpack (&bp); @@ -1400,6 +1401,7 @@ input_varpool_node (struct lto_file_decl_data *file_data, node->alias_target = get_alias_symbol (node->decl); node->tls_model = (enum tls_model)bp_unpack_value (&bp, 3); node->used_by_single_function = (enum tls_model)bp_unpack_value (&bp, 1); + node->dynamically_initialized = bp_unpack_value (&bp, 1); node->need_bounds_init = bp_unpack_value (&bp, 1); group = read_identifier (ib); if (group)