bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/25315] `__tcf_0' referenced in section `.rodata._ZNK6common26Cha


From: dave.anglin at bell dot net
Subject: [Bug ld/25315] `__tcf_0' referenced in section `.rodata._ZNK6common26ChainResidueAtomDescriptor3strB5cxx11Ev.cst4' of mode_query_balls_distances.o: defined in discarded section `.text.__tcf_0[_ZNK6common26ChainResidueAtomDescriptor3strB5cxx11Ev]' of mode_query_balls_dis
Date: Fri, 27 Dec 2019 15:08:02 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25315

--- Comment #6 from dave.anglin at bell dot net ---
On 2019-12-26 8:35 p.m., amodra at gmail dot com wrote:
> https://sourceware.org/bugzilla/show_bug.cgi?id=25315
>
> --- Comment #5 from Alan Modra <amodra at gmail dot com> ---
> Oh, wait a minute.  Why are there references to a local symbol in a comdat
> section?  That just seems odd.  The linker will keep just one of the multiple
> copies of the comdat section but there normally isn't any translation of a
> local symbol in one discarded comdat section to the equivalent local symbol in
> the kept section.  Locals are local after all.  This has to be a gcc problem.
>
This is how gcc sets up the decl for __tcf_0

start_cleanup_fn (void)
{
  char name[32];
  tree fntype;
  tree fndecl;
  bool use_cxa_atexit = flag_use_cxa_atexit
                        && !targetm.cxx.use_atexit_for_cxa_atexit ();

  push_to_top_level ();

  /* No need to mangle this.  */
  push_lang_context (lang_name_c);

  /* Build the name of the function.  */
  sprintf (name, "__tcf_%d", start_cleanup_cnt++);
  /* Build the function declaration.  */
  fntype = TREE_TYPE (get_atexit_fn_ptr_type ());
  fndecl = build_lang_decl (FUNCTION_DECL, get_identifier (name), fntype);
  /* It's a function with internal linkage, generated by the
     compiler.  */
  TREE_PUBLIC (fndecl) = 0;
  DECL_ARTIFICIAL (fndecl) = 1;
  /* Make the function `inline' so that it is only emitted if it is
     actually needed.  It is unlikely that it will be inlined, since
     it is only called via a function pointer, but we avoid unnecessary
     emissions this way.  */
  DECL_DECLARED_INLINE_P (fndecl) = 1;
  DECL_INTERFACE_KNOWN (fndecl) = 1;

The TREE_PUBLIC line makes the symbol local but the comment says it should have
internal
linkage.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]