From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.151.62.29; helo=mail-in7.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from mail-in7.apple.com (mail-out7.apple.com [17.151.62.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3F020203BBBA6 for ; Fri, 18 May 2018 15:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1526683117; x=2390596717; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8+fYdHGT4XDbAvBOdLmC7x5Evqtd15wpsYpGwSjBT4w=; b=E0I7H3H3/LFRVFbB3G7vfGAwGJF9kSpWLzDXGyZ4mfiqAvd+jt/VEbkCPihYP/Wg C6BlkEmVh+3mWeWxUoxGMPrRboZUqEM8vqaCfWWOmMtejKud8dn5KcvcbGwZ60Nw 8Y327NyOqVD8abfRasQjBsaDIDicQtL1Kqhs/UPvO7LPghQzOgIe6OLSVFRJ/trB EfJSn6hvr8Or1mAOzSuJJuhu8/AAMBKAS1TAvb1apk5H8C7Nay4/d1t5AfQB/RGA 498PBnJcgdMRmBFxirLBmZ6C7p92anWvthdpbqsS9goZWsUNKF4Lsrmbtqld8tzj CUA8Ckxttb6rkYKOaLPSFQ==; Received: from relay5.apple.com (relay5.apple.com [17.128.113.88]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in7.apple.com (Apple Secure Mail Relay) with SMTP id 25.20.04908.DE55FFA5; Fri, 18 May 2018 15:38:37 -0700 (PDT) X-AuditID: 11973e16-446529e00000132c-02-5aff55ed9ced Received: from nwk-mmpp-sz12.apple.com (nwk-mmpp-sz12.apple.com [17.128.115.204]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by relay5.apple.com (Apple SCV relay) with SMTP id FD.1C.23499.DE55FFA5; Fri, 18 May 2018 15:38:37 -0700 (PDT) MIME-version: 1.0 Received: from [17.235.32.23] (unknown [17.235.32.23]) by nwk-mmpp-sz12.apple.com (Oracle Communications Messaging Server 8.0.2.2.20180403 64bit (built Apr 3 2018)) with ESMTPSA id <0P8Y002X448CB0C0@nwk-mmpp-sz12.apple.com>; Fri, 18 May 2018 15:38:37 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish Message-id: <01146E3B-6B4F-4C58-B753-63BFD5ADF3E4@apple.com> Date: Fri, 18 May 2018 15:38:35 -0700 In-reply-to: <03b101d3eef6$a5f4dd90$f1de98b0$@insyde.com> Cc: edk2-devel@lists.01.org To: Tim Lewis References: <03b101d3eef6$a5f4dd90$f1de98b0$@insyde.com> X-Mailer: Apple Mail (2.3445.6.18) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsUi2FAYofs29H+UwfQvFhZ7Dh1ltrj4YxWT A5NH+5v/bB7ds/+xBDBFcdmkpOZklqUW6dslcGXsvVhU8K62YvnVV4wNjLvzuhg5OSQETCSe NvWzdzFycQgJrGaSOH1nPztMYu3F1SwQiQ1MEkued4MleAUEJX5MvscCYjMLhEn07W2E6u5n kjh6voUVJCEsIC7x7swmZhCbTUBZYsX8D0BFHEDNNhLnPopBlPhIrNrcDFbCIqAq8fL6fEYQ m1PAUmL2mc+MEPOlJR5OPA42UkRARaJ14kqwG4QELCTezNjCCnGoksT/XUeYQW6QEJjDJvGv qZNpAqPQLCS3zkJyK4StJfH9UStQnAPIlpc4eF4WIqwp8ezeJ6gSbYkn7y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xFxYkAk0UscVgCAAA= X-Content-Filtered-By: Mailman/MimeDel 2.1.26 Subject: Re: Does __attribute__ ((selectany)) make sense now for GCC? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2018 22:38:39 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT Tim, Looks like that is only available on Windows versions of GCC, and is more about compatible behavior. selectany The selectany attribute causes an initialized global variable to have link-once semantics. When multiple definitions of the variable are encountered by the linker, the first is selected and the remainder are discarded. Following usage by the Microsoft compiler, the linker is told not to warn about size or content differences of the multiple definitions. Although the primary usage of this attribute is for POD types, the attribute can also be applied to global C++ objects that are initialized by a constructor. In this case, the static initialization and destruction code for the object is emitted in each translation defining the object, but the calls to the constructor and destructor are protected by a link-once guard variable. The selectany attribute is only available on Microsoft Windows targets. You can use __declspec (selectany) as a synonym for __attribute__ ((selectany)) for compatibility with other compilers. What I've noticed with clang/LLVM is the unreferenced globals get removed when you enable link time optimizations. I'd actually ask the opposite question. Does __declspec(selectany) impact dead code removal on current versions of VC++? Thanks, Andrew Fish > On May 18, 2018, at 3:22 PM, Tim Lewis wrote: > > In Visual Studio we have __declspec(selectany) to limit the impact of unused > data. > > > > I see that GCC for Windows has __attribute__ ((selectany)). > > > > Should we me using this for GLOBAL_REMOVE_IF_UNREFERENCED in > MdePkg\Include\Base.h? > > > > Tim > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel