public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kevin Klues <klueska@cs.berkeley.edu>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: TLS, gcc optimizations, and PIC on x86
Date: Tue, 06 Sep 2011 20:31:00 -0000	[thread overview]
Message-ID: <CAJR1fVpPAZ2STmfdJaUBiW7J1FNAZuku2GOcq8Y80SgOM_3nOA@mail.gmail.com> (raw)
In-Reply-To: <mcr1uvuxi2p.fsf@coign.corp.google.com>

It looks like 'optimize' is necessary in cases where I do something like:

__thread int i = 0;
i = 5;  // Set variable in original tls region
set_tls_desc(new_tls);
i = 5;  // Set variable in new tls region

Where I set i equal to the same value, but in 2 different TLS regions.
 Glancing through the assembly, it appears that the code for the
nested function indeed get's generated (as per the 'noinline'), but
then it simply noops and returns.

Kevin

On Tue, Sep 6, 2011 at 12:09 AM, Ian Lance Taylor <iant@google.com> wrote:
> Kevin Klues <klueska@cs.berkeley.edu> writes:
>
>> That said, do you see any obvious issues with my solution?  It seems
>> to work for all of the test cases I've thrown at it, but I could be
>> missing something.  Additionally, do you have any suggestions for a
>> better method that achieves similar results?  Ideally I'd like a
>> solution that didn't require the use of the 'optimize' attribute as
>> (unfortunately) some of the systems on which we'd like to compile our
>> code still use gcc < 4.4.
>
> I don't see any obvious issues with your solution.  I'm not sure why you
> need to use the optimize attribute; I would have expected that the
> noinline attribute would be sufficient here.
>
> Ian
>



-- 
~K€vin

      reply	other threads:[~2011-09-06 20:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01  1:55 Kevin Klues
2011-09-01  5:01 ` Ian Lance Taylor
2011-09-01  7:15   ` Kevin Klues
2011-09-06  7:10     ` Ian Lance Taylor
2011-09-06 20:31       ` Kevin Klues [this message]

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=CAJR1fVpPAZ2STmfdJaUBiW7J1FNAZuku2GOcq8Y80SgOM_3nOA@mail.gmail.com \
    --to=klueska@cs.berkeley.edu \
    --cc=gcc-help@gcc.gnu.org \
    --cc=iant@google.com \
    /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).