[Bug target/51726] LTO and attribute 'selectany'

2016-11-24 Thread d.g.gorbachev at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

Dmitry Gorbachev  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Dmitry Gorbachev  ---
Likely fixed, closing the report.

[Bug target/51726] LTO and attribute 'selectany'

2015-10-02 Thread ktietz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

--- Comment #9 from Kai Tietz  ---
Author: ktietz
Date: Fri Oct  2 08:06:52 2015
New Revision: 228370

URL: https://gcc.gnu.org/viewcvs?rev=228370=gcc=rev
Log:
PR target/51726
* config/i386/winnt.c (ix86_handle_selectany_attribute): Handle
selectany within this function without need to keep attribute.
(i386_pe_encode_section_info): Remove selectany-code.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/winnt.c


[Bug target/51726] LTO and attribute 'selectany'

2015-10-02 Thread ktietz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

--- Comment #10 from Kai Tietz  ---
Author: ktietz
Date: Fri Oct  2 08:08:38 2015
New Revision: 228371

URL: https://gcc.gnu.org/viewcvs?rev=228371=gcc=rev
Log:
PR target/51726
* g++.dg/ext/selectany2.C: Allow uninitialized variable case.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/ext/selectany2.C


[Bug target/51726] LTO and attribute 'selectany'

2015-10-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

Richard Biener  changed:

   What|Removed |Added

  Known to fail|4.10.0  |5.0

--- Comment #7 from Richard Biener  ---
(In reply to Kai Tietz from comment #6)
> Created attachment 36427 [details]
> Suggested patch
> 
> I will do some further testing with that patch, and later on send patch
> upstream with a testcase for the common-case with selectany-attribute.
> 
> It would be appreciated  if you could test patch too.

I believe you can skip adding the attribute after you handled it this way
(unless other code literally looks for the attribute rather than its effect)


[Bug target/51726] LTO and attribute 'selectany'

2015-10-01 Thread ktietz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

Kai Tietz  changed:

   What|Removed |Added

 CC||thiago at kde dot org

--- Comment #8 from Kai Tietz  ---
*** Bug 67688 has been marked as a duplicate of this bug. ***


[Bug target/51726] LTO and attribute 'selectany'

2015-09-30 Thread ktietz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

--- Comment #6 from Kai Tietz  ---
Created attachment 36427
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36427=edit
Suggested patch

I will do some further testing with that patch, and later on send patch
upstream with a testcase for the common-case with selectany-attribute.

It would be appreciated  if you could test patch too.


[Bug target/51726] LTO and attribute 'selectany'

2015-05-21 Thread jacek at codeweavers dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

Jacek Caban jacek at codeweavers dot com changed:

   What|Removed |Added

 CC||jacek at codeweavers dot com

--- Comment #5 from Jacek Caban jacek at codeweavers dot com ---
It seems like selectany is not supported at all in LTO:

$ cat selectany.c 
__attribute__((selectany)) int i = 0;

$ i686-w64-mingw32-gcc selectany.c selectany.c -flto -shared
/tmp/cchTGZVt.o (symbol from plugin):(.text+0x0): multiple definition of `i'
/tmp/ccAy2OzL.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status

$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Should I file separated bug?


[Bug target/51726] LTO and attribute 'selectany'

2014-08-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org
  Component|lto |target

--- Comment #4 from Richard Biener rguenth at gcc dot gnu.org ---
On trunk the backend has to use varpool_node::get (decl)-get_constructor ().

But seriously the backend should process the attribute once at compile-time
and then discard it rather than trying to re-do the job at WPA/LTRANS time.

That is, _not_ do this in i386_pe_encode_section_info which is way too late
but instead directly in ix86_handle_selectany_attribute so LTO can see
the decl is one-only (and also the linker is informed correctly).

Still completely a backend bug.  IMHO as soon as it's not necessary to
retain the attribute on the decl it's a sign of a good implementation.


[Bug target/51726] LTO and attribute 'selectany'

2012-01-23 Thread d.g.gorbachev at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

--- Comment #2 from Dmitry Gorbachev d.g.gorbachev at gmail dot com 
2012-01-23 20:22:00 UTC ---
Created attachment 26437
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26437
Patch (not tested)


[Bug target/51726] LTO and attribute 'selectany'

2012-01-02 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51726

Richard Guenther rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2012-01-02
 Ever Confirmed|0   |1

--- Comment #1 from Richard Guenther rguenth at gcc dot gnu.org 2012-01-02 
11:19:41 UTC ---
It's a target bug - the target should ignore the attribute on extern
declarations.

case VAR_DECL:
  if (lookup_attribute (selectany, DECL_ATTRIBUTES (decl)))
{
  if (DECL_INITIAL (decl)
  /* If an object is initialized with a ctor, the static
 initialization and destruction code for it is present in
 each unit defining the object.  The code that calls the
 ctor is protected by a link-once guard variable, so that
 the object still has link-once semantics,  */
  || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
  else
error (%q+D:'selectany' attribute applies only to 
   initialized objects, decl);
}

thus, restrict processing to !DECL_EXTERNAL