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?


Well looking at notice_global_symbol:

The comments says that weak_global_object_name is set in it, but there
is nothing actually doing so...

The only line of code containing weak_global_object_name in
notice_global_symbol is:
type = &weak_global_object_name;

Gab

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.
>
> Thanks,
> Andrew Pinski
>


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