This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: BZ #14370: Check mismatched TLS/non-TLS symbols
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 5 Sep 2012 16:05:34 -0700
- Subject: Re: PATCH: BZ #14370: Check mismatched TLS/non-TLS symbols
- References: <20120904221920.GA6320@intel.com><ork3w8ysvr.fsf@livre.localdomain>
On Wed, Sep 5, 2012 at 4:03 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Sep 4, 2012, "H.J. Lu" <hongjiu.lu@intel.com> wrote:
>
>> + && (__builtin_expect (ELFW(ST_TYPE) (current_value.s->st_info) == STT_TLS, 0)
>> + || __builtin_expect (ELFW(ST_TYPE) ((*ref)->st_info) == STT_TLS, 0))
>> + && __builtin_expect (ELFW(ST_TYPE) (current_value.s->st_info) !=
>> + ELFW(ST_TYPE) ((*ref)->st_info), 1))
>
> How about spelling this out as
>
>> && __builtin_expect ((ELFW(ST_TYPE) (current_value.s->st_info) == STT_TLS)
>> != (ELFW(ST_TYPE) ((*ref)->st_info) == STT_TLS), 0)
>
> ?
>
> We pretty much already have to perform both compares anyway, for most
> symbols won't pass the first test, and with != instead of || we avoid
> serializing the compares *and* the duplicate third comparison.
>
Works for me.
Thanks.
--
H.J.