From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0.arrikto.com (mx0.arrikto.com [IPv6:2a01:7e00::f03c:91ff:fe6e:d7ab]) by sourceware.org (Postfix) with ESMTPS id 27A393870857 for ; Tue, 23 Jun 2020 20:37:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 27A393870857 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arrikto.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ndragazis@arrikto.com Received: from troi.prod.arr (mail.arr [10.99.0.5]) by mx0.arrikto.com (Postfix) with ESMTP id CCB6719E0B4 for ; Tue, 23 Jun 2020 23:37:24 +0300 (EEST) Received: from [10.89.50.23] (naxos.vpn.arr [10.89.50.23]) by troi.prod.arr (Postfix) with ESMTPSA id 89B3C2B2 for ; Tue, 23 Jun 2020 23:37:24 +0300 (EEST) To: gcc-help@gcc.gnu.org From: Nikos Dragazis Subject: Force global-dynamic TLS model Message-ID: <889e96a3-f7d0-4703-c3d7-66a4d5913d72@arrikto.com> Date: Tue, 23 Jun 2020 23:37:24 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2020 20:37:27 -0000 Hi all, Apologies if this has already been answered before. I am experimenting with thread-local variables. I was wondering if it is possible to make gcc force a specific TLS access model for some TLS variables. For example, let's say we have an ELF executable that defines and accesses a TLS variable. From gcc's man page, I read that, in this case, gcc will use the initial-exec TLS model by default. My question is if we can change that and, say, use the global-dynamic model. To this end, I have tried the `-ftls-model=global-dynamic` option and the `tls_model` gcc variable attribute. None of these worked. So, my question is: In this particular example, can we force gcc to use the global-dynamic instead of the initial-exec TLS model?  And, in general, can we force gcc to use global-dynamic for all accesses to thread-local variables? Thanks, Nikos