From: Alexander Monakov <amonakov@ispras.ru>
To: Sebastian Huber <sebastian.huber@embedded-brains.de>
Cc: GCC Development <gcc@gcc.gnu.org>
Subject: Re: Use -ftls-model=local-exec for RTEMS by default?
Date: Wed, 20 Jul 2022 16:01:30 +0300 (MSK) [thread overview]
Message-ID: <2592dc25-bf0-6051-a9d8-68db5c3ad6a7@ispras.ru> (raw)
In-Reply-To: <e7c64c37-b405-566c-6109-198f3b5c4472@embedded-brains.de>
On Wed, 20 Jul 2022, Sebastian Huber wrote:
> On 20/07/2022 13:41, Alexander Monakov wrote:
> > On Wed, 20 Jul 2022, Sebastian Huber wrote:
> >
> >> How does Ada get its default TLS model?
> > You shouldn't need to do anything special, GCC automatically selects
> > initial-exec or local-exec for non-PIC (including PIE).
>
> I am not sure, for this test program:
>
> extern _Thread_local int i;
> _Thread_local int j;
>
> int f(void)
> {
> return i + j;
> }
>
> I get:
[snip]
Thanks, I missed that you are asking about promoting initial-exec to local-exec
rather than x-dynamic to y-exec. There's a pending patch that implements such
promotion based on visibility information:
https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598017.html
With that patch, you'll get local-exec model for the extern variable 'i' if you
inform the compiler that its definition will end up in the current module:
__attribute__((visibility("hidden")))
extern _Thread_local int i;
_Thread_local int j;
int f(void)
{
return i + j;
}
Thus I would try to enhance the binds_local_p target hook for RTEMS to inform
the compiler that there's no dynamic linking (although apart from TLS variables
I cannot instantly name other places where it would enhance optimization).
HTH
Alexander
next prev parent reply other threads:[~2022-07-20 13:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 8:43 Sebastian Huber
2022-07-20 9:28 ` Sebastian Huber
2022-07-20 11:41 ` Alexander Monakov
2022-07-20 11:48 ` Sebastian Huber
2022-07-20 13:01 ` Alexander Monakov [this message]
2022-07-21 5:25 ` Sebastian Huber
2022-07-21 8:03 ` Iain Sandoe
2022-07-22 11:19 ` Sebastian Huber
2022-07-22 11:35 ` Iain Sandoe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2592dc25-bf0-6051-a9d8-68db5c3ad6a7@ispras.ru \
--to=amonakov@ispras.ru \
--cc=gcc@gcc.gnu.org \
--cc=sebastian.huber@embedded-brains.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).