This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: weak_global_object_name useless?


On Wed, Jun 29, 2011 at 6:26 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Wed, Jun 29, 2011 at 6:13 PM, Gabriel Charette <gchare@google.com> wrote:
>> Adding gcc@gcc.gnu.org
>>
>> On Wed, Jun 29, 2011 at 6:08 PM, Gabriel Charette <gchare@google.com> wrote:
>>>
>>> What's the purpose ofÂweak_global_object_name? Defined in gcc/varasm.c
>>> grepping from the base of the source recursively I only find this:
>>> ./gcc/ChangeLog-1998: * varasm.c (assemble_start_function): Add weak_global_object_name.
>>> ./gcc/output.h:extern const char *weak_global_object_name;
>>> ./gcc/ChangeLog-2000: weak_global_object_name here, as const char *.
>>> ./gcc/ChangeLog-2000: first_global_object_name or weak_global_object_name. ÂClean up string
>>> ./gcc/ChangeLog-2000: * varasm.c (first_global_object_name, weak_global_object_name):
>>> ./gcc/tree.c: Â Â Âconst char *name = weak_global_object_name;
>>> ./gcc/ChangeLog-2005: (weak_global_object_name): Likewise.
>>> ./gcc/varasm.c:extern GTY(()) const char *weak_global_object_name;
>>> ./gcc/varasm.c:const char *weak_global_object_name;
>>> ./gcc/varasm.c: Â Set first_global_object_name and weak_global_object_name as appropriate. Â*/
>>> ./gcc/varasm.c: Â Âtype = &weak_global_object_name;
>>> It seems like it's never actually set... some references to it are set... but that seems like a very weird usage? And there is never any code that checks whether `something == weak_global_object_name`...
>>> I'm tempted to try to remove it... shall we ask Jason?
>
> It is set in notice_global_symbol if I read the code correctly.
> *type is either Âweak_global_object_name or first_global_object_name.
> If Âfirst_global_object_name was set by this function, then
> weak_global_object_name would never be set. ÂOtherwise
> weak_global_object_name is set to the first time notice_global_symbol
> is called with a weak decl, or an one only decl, or when flag_shlib is
> true.
> get_file_function_name uses Âweak_global_object_name if
> first_global_object_name was not set.
> The purpose is the name of the first weak global symbol to create a
> name which is uniq at link time.
> get_file_function_name uses it to create a semi uniq number.

I should mention the easiest way to get weak_global_object_name set is
to use -fPIC when compiling since that sets flag_shlib  to true.

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]