[Bug c++/67834] Local references inside comdat groups

2019-12-29 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67834

--- Comment #10 from John David Anglin  ---
Created attachment 47564
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47564=edit
Patch

Untested fix.

[Bug c++/67834] Local references inside comdat groups

2019-12-27 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67834

John David Anglin  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
   Last reconfirmed||2019-12-27
Version|5.2.1   |9.2.1
 Resolution|FIXED   |---
   Target Milestone|5.5 |---
 Ever confirmed|0   |1

--- Comment #9 from John David Anglin  ---
This problem has reappeared since pa_reloc_rw_mask() was changed to allow
relocs in readonly data.

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

We have a plabel relocation to the local symbol __tcf_0 in a comdat section.

It is setup here:

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 original problem was worked around with this binutils change:

static unsigned int
elf_hppa_action_discarded (asection *sec)
{
  /* Ignore relocations in .data.rel.ro.local.  This section can contain
 PLABEL32 relocations to functions in discarded COMDAT groups.  */
  if (strcmp (".data.rel.ro.local", sec->name) == 0)
return 0;

[Bug c++/67834] Local references inside comdat groups

2017-10-10 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67834

John David Anglin  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from John David Anglin  ---
The test case now compiles successfully with 5.4.1 20171003 (Debian 5.4.1-14),
g++-6 and g++-7.

[Bug c++/67834] Local references inside comdat groups

2017-10-10 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67834

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org
Summary|[5 Regression] Local|Local references inside
   |references inside comdat|comdat groups
   |groups  |

--- Comment #7 from Jakub Jelinek  ---
The 5 branch has been closed, it is unclear what the state of this PR is on
supported branches.