public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined
@ 2012-01-10 14:38 sefi@s-e-f-i.de
2012-01-13 12:03 ` [Bug c++/51813] [4.7 Regression] " paolo.carlini at oracle dot com
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: sefi@s-e-f-i.de @ 2012-01-10 14:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
Bug #: 51813
Summary: -fvisibility=hidden causes std::codecvt members to be
undefined
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: sefi@s-e-f-i.de
The following program causes undefined symbols when -fvisibility=hidden is
used:
#include <locale>
int main()
{
std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>
>(std::locale());
}
g++-4.7 -fvisibility=hidden test.cpp
/tmp/cclBRkzy.o: In function `main':
test.cpp:(.text+0x1d): undefined reference to `std::codecvt<wchar_t, char,
__mbstate_t> const& std::use_facet<std::codecvt<wchar_t, char, __mbstate_t>
>(std::locale const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0-alpha20120107/../../../../x86_64-pc-linux-gnu/bin/ld:
a.out: hidden symbol
`_ZSt9use_facetISt7codecvtIwc11__mbstate_tEERKT_RKSt6locale' isn't defined
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0-alpha20120107/../../../../x86_64-pc-linux-gnu/bin/ld:
final link failed: Bad value
collect2: error: ld returned 1 exit status
It works with gcc-4.6.2.
use_facet is only an example. I had other functions like do_length, the
destructor, etc. reported as undefined as well.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
@ 2012-01-13 12:03 ` paolo.carlini at oracle dot com
2012-01-13 15:59 ` jason at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-13 12:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-01-13
CC| |jason at gcc dot gnu.org
Summary|-fvisibility=hidden causes |[4.7 Regression]
|std::codecvt members to be |-fvisibility=hidden causes
|undefined |std::codecvt members to be
| |undefined
Ever Confirmed|0 |1
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-13 11:53:58 UTC ---
Jason, this happens only in mainline and I'm trying to figure if it may have to
do with our recent changes in the visibility area (like PR35688).
We have a problem with, for example, the std::use_facet specializations which
we declare extern template (in bits/codecvt.h):
extern template
const codecvt<wchar_t, char, mbstate_t>&
use_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
note that the latter happens in the namespace std as decorated visibility
default.
The library normally exports the required use_facet symbol from the .so but for
some reason, see Description, the linker doesn't find it.
Apparently the problem has more generally to do with extern template things.
Any idea what may be going wrong? Is there something the library should do
here?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
2012-01-13 12:03 ` [Bug c++/51813] [4.7 Regression] " paolo.carlini at oracle dot com
@ 2012-01-13 15:59 ` jason at gcc dot gnu.org
2012-01-13 16:41 ` [Bug libstdc++/51813] " jason at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 15:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-13 15:57:35 UTC ---
The difference is that now for the same input, GCC marks the undefined
use_facet symbol as hidden, while 4.6 doesn't. I'll take a look.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
2012-01-13 12:03 ` [Bug c++/51813] [4.7 Regression] " paolo.carlini at oracle dot com
2012-01-13 15:59 ` jason at gcc dot gnu.org
@ 2012-01-13 16:41 ` jason at gcc dot gnu.org
2012-01-13 16:43 ` paolo.carlini at oracle dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 16:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Component|c++ |libstdc++
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-13 16:19:11 UTC ---
I see the problem: mbstate_t is hidden, so codecvt is hidden, so use_facet is
hidden. This is indeed revealed by the fix for PR 35688.
What do we want to do about C library visibility?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
` (2 preceding siblings ...)
2012-01-13 16:41 ` [Bug libstdc++/51813] " jason at gcc dot gnu.org
@ 2012-01-13 16:43 ` paolo.carlini at oracle dot com
2012-01-13 16:53 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-13 16:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-13 16:24:07 UTC ---
Eh, thanks for the analysis. Is there some sort of conservative option here? I
don't think we want to take risks at this stage only for the sake of hiding a
few more symbols ws 4.6. Could we somehow convince the compiler that mbstate_t
is not hidden?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
` (3 preceding siblings ...)
2012-01-13 16:43 ` paolo.carlini at oracle dot com
@ 2012-01-13 16:53 ` redi at gcc dot gnu.org
2012-01-13 17:01 ` paolo.carlini at oracle dot com
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-01-13 16:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-13 16:43:12 UTC ---
(In reply to comment #3)
> What do we want to do about C library visibility?
We can't redeclare all the types with default visibility, because we don't know
if e.g. mbstate_t is just a typedef.
This appears to fix it, but would it need to be done for any explicit
instantation relying on non-builtin types defined outside libstdc++?
extern template
__attribute__((visibility("default")))
const codecvt<wchar_t, char, mbstate_t>&
use_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
` (4 preceding siblings ...)
2012-01-13 16:53 ` redi at gcc dot gnu.org
@ 2012-01-13 17:01 ` paolo.carlini at oracle dot com
2012-01-13 17:05 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-13 17:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-13 16:46:56 UTC ---
Thanks for your help Jon. Note the issue isn't just about std::use_facet, is
about std::codecvt too, any type we instantiate with mbstate_t.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
` (5 preceding siblings ...)
2012-01-13 17:01 ` paolo.carlini at oracle dot com
@ 2012-01-13 17:05 ` jason at gcc dot gnu.org
2012-01-13 17:24 ` [Bug c++/51813] " jason at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 17:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-13 16:52:41 UTC ---
The right answer would seem to be wrapping includes of C headers in #pragma GCC
visibility push/pop, like many of the libsupc++ headers do. But I'm not sure
why the compiler wants to emit a .hidden directive for this symbol but not
other hidden externs; I'll look into that.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
` (6 preceding siblings ...)
2012-01-13 17:05 ` jason at gcc dot gnu.org
@ 2012-01-13 17:24 ` jason at gcc dot gnu.org
2012-01-13 18:10 ` jason at gcc dot gnu.org
2012-01-13 18:40 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 17:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Component|libstdc++ |c++
Target Milestone|--- |4.7.0
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-13 17:01:06 UTC ---
Mine.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
` (7 preceding siblings ...)
2012-01-13 17:24 ` [Bug c++/51813] " jason at gcc dot gnu.org
@ 2012-01-13 18:10 ` jason at gcc dot gnu.org
2012-01-13 18:40 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 18:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-13 17:51:04 UTC ---
Author: jason
Date: Fri Jan 13 17:50:58 2012
New Revision: 183156
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183156
Log:
PR c++/51813
* decl2.c (constrain_visibility): Clear DECL_VISIBILITY_SPECIFIED
when reducing the visibility.
Added:
trunk/gcc/testsuite/g++.dg/ext/visibility/template9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl2.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51813] [4.7 Regression] -fvisibility=hidden causes std::codecvt members to be undefined
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
` (8 preceding siblings ...)
2012-01-13 18:10 ` jason at gcc dot gnu.org
@ 2012-01-13 18:40 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-13 18:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51813
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-13 17:52:47 UTC ---
Fixed. I think the change to C header visibility would still be a good idea,
though.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-01-13 17:53 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-10 14:38 [Bug c++/51813] New: -fvisibility=hidden causes std::codecvt members to be undefined sefi@s-e-f-i.de
2012-01-13 12:03 ` [Bug c++/51813] [4.7 Regression] " paolo.carlini at oracle dot com
2012-01-13 15:59 ` jason at gcc dot gnu.org
2012-01-13 16:41 ` [Bug libstdc++/51813] " jason at gcc dot gnu.org
2012-01-13 16:43 ` paolo.carlini at oracle dot com
2012-01-13 16:53 ` redi at gcc dot gnu.org
2012-01-13 17:01 ` paolo.carlini at oracle dot com
2012-01-13 17:05 ` jason at gcc dot gnu.org
2012-01-13 17:24 ` [Bug c++/51813] " jason at gcc dot gnu.org
2012-01-13 18:10 ` jason at gcc dot gnu.org
2012-01-13 18:40 ` jason at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).