From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4735 invoked from network); 25 Jun 2022 05:52:14 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 25 Jun 2022 05:52:14 -0000 Received: (qmail 21807 invoked by uid 550); 25 Jun 2022 05:52:12 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 21773 invoked from network); 25 Jun 2022 05:52:11 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=7SAX1VnS8JpnIo4X7TLf9Z4PwzLN27kn9Ft8CCU9He0=; b=V561/czO64gFLK/2I1fYp5hB/j8RAMGuStZhFjzCQNB7VqZb8ENT2AwR7Khn2bvin5 piCnd/f3mGPRWhVoNmK3SLPCWyYEIqMfEPa5y1vVyHFOWscK+dWHaLKK9J47Cq0TPlvk +HUiVIiBCnf4h16xcbqYz8npFTj/SpCBQr2PfBNSN+OG5QhZdk8nOtW/Vy3lQi13FnbE OOMaepyrOqMNG1NiPzi8HsDdQzqGNLW6oL9mmW3xRb3neP0DPjuumAyyjcdz85jDq1aq R+XVsUzU6M2JtnIE2wJEHK/MDYadnISZq/KLRGBXn3ozb7ojr9g0lj+E/n9+02ItZ+me UTAQ== X-Gm-Message-State: AJIora+TbqomWjtIMB7spIQvsO1llcF5P9VZK1Ai9+7qyUn0sbrMZ7US lEVUhgmD+GcRZ8y0Sfpdi/RwoSmIIQo= X-Google-Smtp-Source: AGRyM1v7WLqCzXMOJ4u4mMFxLyGx4mxk1OzzuAgRqfzo3ML0J094e0WVkGVnKGH3WsQoZ/pktsAWbg== X-Received: by 2002:a17:902:e0c3:b0:16a:1c8a:5ae8 with SMTP id e3-20020a170902e0c300b0016a1c8a5ae8mr2774392pla.97.1656136319104; Fri, 24 Jun 2022 22:51:59 -0700 (PDT) Date: Fri, 24 Jun 2022 22:51:57 -0700 From: Fangrui Song To: musl@lists.openwall.com Cc: mesa-dev@lists.freedesktop.org Message-ID: <20220625055157.5vy2pbvbdljgo2p3@gmail.com> References: <20220625044724.GB2408@voyager> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [musl] Fwd: mesa | Remove USE_ELF_TLS macro (!17213) On 2022-06-25, 罗勇刚(Yonggang Luo) wrote: >On Sat, Jun 25, 2022 at 12:47 PM Markus Wichmann wrote: >> >> On Sat, Jun 25, 2022 at 11:36:09AM +0800, 罗勇刚(Yonggang Luo) wrote: >> > So I am confused. What's the situation about ELF-TLS support in musl? >> > Is that still broken now? >> >> musl has always supported ELF-TLS anywhere except in libc itself. That >> was also never the problem. The problem was that the mesa people select >> the initial-exec TLS model explicitly, even though libGL ends up being >> dlopen()ed quite often, and then you should be using the general-dynamic >> model instead. > >My question is does musl support ELS-TLS when using dl-open. It is supported. For shared objects using the initial-exec TLS model, they must be at load time (DT_NEEDED), not via dlopen. See https://maskray.me/blog/2021-02-14-all-about-thread-local-storage for background. > >> >> According to [1], Rich proposed dropping the initial-exec attribute and >> replacing it with -mtls-dialect=gnu2 eight years ago. Has that happened >> yet? If so, dlopen()ing libGL with musl ought to work. > >`initial-exec` are only specified for __GLIBC__, If musl not predefined >macro ` __GLIBC__` >``` >#if defined(__GLIBC__) >#define __THREAD_INITIAL_EXEC thread_local >__attribute__((tls_model("initial-exec"))) >#define REALLY_INITIAL_EXEC >#else >#define __THREAD_INITIAL_EXEC thread_local >#endif >``` On x86, you may enable (currently GCC only) -mtls-dialect=gnu2 to get performance boost. It's just a tiny bit slower than initial-exec. I added x86-32 TLSDESC and mixed TLS GD/TLSDESC support to lld 14 after I saw the -mtls-dialect=gnu2 build system improvement in mesa :) > >> >> Ciao, >> Markus >> >> [1] https://gitlab.freedesktop.org/mesa/mesa/-/issues/966 > > > >-- > 此致 >礼 >罗勇刚 >Yours > sincerely, >Yonggang Luo