From: "H.J. Lu" <hjl.tools@gmail.com>
To: Sriraman Tallam <tmsriram@google.com>
Cc: Xinliang David Li <davidxl@google.com>,
Richard Guenther <richard.guenther@gmail.com>,
Jan Hubicka <jh@suse.cz>, Uros Bizjak <ubizjak@gmail.com>,
reply@codereview.appspotmail.com, gcc-patches@gcc.gnu.org,
Ian Lance Taylor <iant@google.com>
Subject: Re: User directed Function Multiversioning via Function Overloading (issue5752064)
Date: Sun, 27 May 2012 02:06:00 -0000 [thread overview]
Message-ID: <CAMe9rOqeSiSpMo+gwdkog4fN76-FD5=Tjge0fOQ1OJvoE_+r-Q@mail.gmail.com> (raw)
In-Reply-To: <CAAs8HmzFLK3EAOv7d8KP_7q8T3Fnfu8FLuL97SBLSnG9OiW9SA@mail.gmail.com>
On Sat, May 26, 2012 at 5:23 PM, Sriraman Tallam <tmsriram@google.com> wrote:
> On Sat, May 26, 2012 at 4:56 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Sat, May 26, 2012 at 3:34 PM, Sriraman Tallam <tmsriram@google.com> wrote:
>>> On Fri, May 25, 2012 at 10:05 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Fri, May 25, 2012 at 8:38 PM, Sriraman Tallam <tmsriram@google.com> wrote:
>>>>>
>>>>> On May 25, 2012 7:15 PM, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>>>>>>
>>>>>>
>>>>>> On May 25, 2012 6:54 PM, "Sriraman Tallam" <tmsriram@google.com> wrote:
>>>>>> >
>>>>>> >
>>>>>> > >>
>>>>>> > >> On Fri, May 25, 2012 at 5:0 > > BTW, I noticed:
>>>>>>
>>>>>> > >
>>>>>> > > [hjl@gnu-6 pr14170]$ readelf -sW libgcc.a | grep __cpu_model
>>>>>> > > 20: 0000000000000010 16 OBJECT GLOBAL HIDDEN COM __cpu_model
>>>>>> > > [hjl@gnu-6 pr14170]$ readelf -sW libgcc_s.so | grep __cpu_model
>>>>>> > > 82: 0000000000214ff0 16 OBJECT GLOBAL DEFAULT 24
>>>>>> > > __cpu_model@@GCC_4.8.0
>>>>>> > > 310: 0000000000214ff0 16 OBJECT GLOBAL DEFAULT 24 __cpu_model
>>>>>> > > [hjl@gnu-6 pr14170]$
>>>>>> > >
>>>>>> > > Why is __cpu_model in both libgcc.a and libgcc_s.o?
>>>>>> >
>>>>>> > How do I disallow this in libgcc_s.so? Looks like t-cpuinfo file is
>>>>>> > wrong but I cannot figure out the fix.
>>>>>> >
>>>>>> Why don't you want it in libgcc_s.so?
>>>>>
>>>>> I thought libgcc.a is always linked in for static and dynamic builds. So
>>>>> having it in libgcc_s.so is redundant.
>>>>>
>>>>
>>>> [hjl@gnu-6 pr14170]$ readelf -sW libgcc.a | grep _cpu_
>>>> 20: 0000000000000010 16 OBJECT GLOBAL HIDDEN COM __cpu_model
>>>> 21: 0000000000000110 612 FUNC GLOBAL HIDDEN 4 __cpu_indicator_init
>>>> [hjl@gnu-6 pr14170]$ readelf -sW libgcc_s.so.1 | grep _cpu_
>>>> 82: 0000000000214ff0 16 OBJECT GLOBAL DEFAULT 24
>>>> __cpu_model@@GCC_4.8.0
>>>> 223: 0000000000002b60 560 FUNC LOCAL DEFAULT 11 __cpu_indicator_init
>>>> 310: 0000000000214ff0 16 OBJECT GLOBAL DEFAULT 24 __cpu_model
>>>> [hjl@gnu-6 pr14170]$
>>>>
>>>> I think there should be only one copy of __cpu_model in the process.
>>>> It should be in libgcc_s.so. Why isn't __cpu_indicator_init exported
>>>> from libgcc_s.so?
>>>
>>> Ok, I am elaborating so that I understand the issue clearly.
>>>
>>> The dynamic symbol table of libgcc_s.so:
>>>
>>> $ objdump -T libgcc_s.so | grep __cpu
>>>
>>> 0000000000015fd0 g DO .bss 0000000000000010 GCC_4.8.0 __cpu_model
>>>
>>> It only has __cpu_model, not __cpu_indicator_init just like you
>>> pointed out. I will fix this by adding a versioned symbol of
>>> __cpu_indicator_init to the *.ver files.
>>
>> That will be great.
>>
>>> Do you see any other issues here? I dont get the duplicate entries
>>> part you are referring to. The static symbol table also contains
>>> references to __cpu_model and __cpu_indicator_init, but that is
>>> expected right?
>>
>> Duplication comes from static and dynamic symbol tables.
>>
>>> In libgcc.a:
>>>
>>> readelf -sWt /g/tmsriram/GCC_trunk_svn_mv_fe_at_nfs/native_builds/bld1/install/lib/gcc/x86_64-unknown-linux-gnu/libgcc.a
>>> | grep __cpu
>>>
>>> 20: 0000000000000010 16 OBJECT GLOBAL HIDDEN COM __cpu_model
>>> 21: 0000000000000110 612 FUNC GLOBAL HIDDEN 4 __cpu_indicator_init
>>>
>>> libgcc.a has __cpu_model and __cpu_indicator_init as GLOBAL syms with
>>> HIDDEN visibility. Is this an issue? Is this not needed for static
>>> linking?
>>>
>>> Further thoughts:
>>>
>>> * It looks like libgcc.a is always linked for both static and dynamic
>>> links. It occurred to me when you brought this up. So, I thought why
>>> not exclude the symbols from libgcc_s.so! Is there any problem here?
>>>
>>
>> You don't want one copy of those 2 symbols in each DSO where
>> they are used.
>
> Right, I agree. But this problem exists right now even if libgcc_s.so
> is provided with these symbols. Please see example below:
>
> Example:
>
> dso.c
> -------
>
> int some_func ()
> {
> return (int) __builtin_cpu_is ("corei7");
> }
>
> Build with gcc driver:
> $ gcc dso.c -fPIC -shared -o dso.so
> $ nm dso.so | grep __cpu
> 0000000000000780 t __cpu_indicator_init
> 0000000000001e00 b __cpu_model
>
> This DSO is getting its own local copy of __cpu_model. This is fine
> functionally but this is not the behaviour you have in mind.
>
> whereas, if I build with g++ driver:
>
> $ g++ dso.c -fPIC -shared dso.so
> $ nm dso.so | grep __cpu
> U __cpu_model
>
> This is as we would like, __cpu_model is undefined.
>
> The difference is that with the gcc driver, the link line is -lgcc
> -lgcc_s, whereas with the g++ driver -lgcc is not even present!
>
> Should I fix the gcc driver instead? This double-standard is not clear to me.
>
That is because libgcc_s.so is preferred by g++. We can do one
of 3 things:
1. Abuse libgcc_eh.a by moving __cpu_model and __cpu_indicator_init
from libgcc.a to libgcc_eh.a.
2. Rename libgcc_eh.a to libgcc_static.a and move __cpu_model and
__cpu_indicator_init from libgcc.a to libgcc_static.a.
3. Add libgcc_static.a and move __cpu_model and __cpu_indicator_ini
from libgcc.a to libgcc_static.a. We treat libgcc_static.a similar to
libgcc_eh.a.
--
H.J.
next prev parent reply other threads:[~2012-05-27 2:06 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-07 0:47 Sriraman Tallam
2012-03-07 14:05 ` Richard Guenther
2012-03-07 19:08 ` Sriraman Tallam
2012-03-08 21:37 ` Xinliang David Li
2012-03-08 21:00 ` Xinliang David Li
2012-03-09 20:04 ` Sriraman Tallam
2012-04-27 5:09 ` Sriraman Tallam
2012-04-27 13:39 ` H.J. Lu
2012-04-27 14:35 ` Sriraman Tallam
2012-04-27 14:39 ` H.J. Lu
2012-04-27 14:53 ` Sriraman Tallam
2012-04-27 15:36 ` H.J. Lu
2012-04-27 15:45 ` Sriraman Tallam
2012-05-01 23:51 ` Sriraman Tallam
2012-05-02 0:09 ` H.J. Lu
2012-05-02 2:45 ` Sriraman Tallam
2012-05-02 13:42 ` H.J. Lu
2012-05-02 15:08 ` Sriraman Tallam
2012-05-02 16:06 ` H.J. Lu
2012-05-02 17:44 ` Sriraman Tallam
2012-05-02 18:04 ` H.J. Lu
2012-05-07 16:58 ` Sriraman Tallam
2012-05-09 19:01 ` Sriraman Tallam
2012-05-10 17:55 ` H.J. Lu
2012-05-12 2:04 ` Sriraman Tallam
2012-05-12 13:38 ` H.J. Lu
2012-05-14 18:29 ` Sriraman Tallam
2012-05-26 0:07 ` H.J. Lu
2012-05-26 0:16 ` Sriraman Tallam
2012-05-26 0:27 ` H.J. Lu
2012-05-26 1:54 ` Sriraman Tallam
[not found] ` <CAMe9rOowm9K7r1xnRdRjW5Y4Ay+WxgSsBLTgGvq24z=i42AS+g@mail.gmail.com>
[not found] ` <CAAs8HmzeQigcLQyfkC02u=6gCTLkjLLa_jYmp+b1HEtpMCrYWw@mail.gmail.com>
2012-05-26 5:06 ` H.J. Lu
2012-05-26 22:35 ` Sriraman Tallam
2012-05-26 23:56 ` H.J. Lu
2012-05-27 0:24 ` Sriraman Tallam
2012-05-27 2:06 ` H.J. Lu [this message]
2012-05-27 2:23 ` Sriraman Tallam
2012-05-27 2:31 ` H.J. Lu
2012-05-27 19:02 ` Ian Lance Taylor
2012-06-04 19:01 ` Sriraman Tallam
2012-06-04 21:36 ` H.J. Lu
2012-06-04 22:29 ` Sriraman Tallam
2012-06-05 13:56 ` H.J. Lu
2012-06-14 20:35 ` Sriraman Tallam
2012-06-20 1:10 ` Sriraman Tallam
2012-07-06 9:14 ` Richard Guenther
2012-07-06 17:38 ` Sriraman Tallam
2012-07-07 6:06 ` Jason Merrill
2012-07-07 18:38 ` Xinliang David Li
2012-07-08 11:21 ` Jason Merrill
2012-07-09 21:27 ` Xinliang David Li
2012-07-10 9:46 ` Jason Merrill
2012-07-10 16:09 ` Xinliang David Li
[not found] ` <CAAs8HmxHF38ktt6syjWp-MpjiX+6NcXh7_8Xn6iKnAiF2vRymQ@mail.gmail.com>
2012-07-19 20:40 ` Jason Merrill
2012-07-30 19:16 ` Sriraman Tallam
2012-08-25 0:34 ` Sriraman Tallam
2012-09-18 16:29 ` Sriraman Tallam
2012-10-05 17:07 ` Xinliang David Li
2012-10-05 17:44 ` Jason Merrill
2012-10-05 18:14 ` Jason Merrill
2012-10-05 21:58 ` Sriraman Tallam
2012-10-05 22:50 ` Jason Merrill
2012-10-05 23:45 ` Sriraman Tallam
2012-10-05 18:32 ` Jason Merrill
2012-10-11 0:13 ` Sriraman Tallam
2012-10-12 22:41 ` Sriraman Tallam
2012-10-19 15:23 ` Diego Novillo
2012-10-20 4:29 ` Sriraman Tallam
2012-10-23 21:21 ` Sriraman Tallam
2012-10-26 16:53 ` Jan Hubicka
2012-10-28 4:31 ` Sriraman Tallam
2012-10-29 13:05 ` Jan Hubicka
2012-10-29 17:56 ` Sriraman Tallam
2012-10-30 19:18 ` Jason Merrill
2012-10-31 0:58 ` Sriraman Tallam
[not found] ` <CAAs8Hmw09giv-5_v0irhByTjTJV=kD58rCAD2SAz7M8zrwjBOA@mail.gmail.com>
2012-10-31 14:27 ` Jason Merrill
2012-11-02 2:53 ` Sriraman Tallam
2012-11-06 2:38 ` Sriraman Tallam
2012-11-06 15:52 ` Jason Merrill
2012-11-06 18:17 ` Sriraman Tallam
2012-11-10 1:33 ` Sriraman Tallam
2012-11-12 5:04 ` Jason Merrill
2012-11-13 1:11 ` Sriraman Tallam
2012-11-13 2:39 ` Jason Merrill
2012-11-13 21:57 ` Sriraman Tallam
2012-11-17 22:23 ` H.J. Lu
2012-11-06 22:15 ` Gerald Pfeifer
2012-10-26 14:11 ` Diego Novillo
2012-10-26 16:54 Xinliang David Li
2012-10-26 17:28 ` Sriraman Tallam
2012-11-06 22:17 Dominique Dhumieres
2012-11-07 1:16 ` Gerald Pfeifer
2012-11-07 8:53 ` Dominique Dhumieres
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='CAMe9rOqeSiSpMo+gwdkog4fN76-FD5=Tjge0fOQ1OJvoE_+r-Q@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=davidxl@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=iant@google.com \
--cc=jh@suse.cz \
--cc=reply@codereview.appspotmail.com \
--cc=richard.guenther@gmail.com \
--cc=tmsriram@google.com \
--cc=ubizjak@gmail.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).