This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Make some comdats implicitly hidden
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 28 Aug 2013 19:23:19 +0200
- Subject: Re: Make some comdats implicitly hidden
- Authentication-results: sourceware.org; auth=none
- References: <20130826195724 dot GB13069 at kam dot mff dot cuni dot cz> <521BFB17 dot 5000902 at redhat dot com>
> On 08/26/2013 03:57 PM, Jan Hubicka wrote:
> >While analyzing the relocations of libreoffice I noticed that I can play
> >the same game w/o LTO at linker level. Making those symbols hidden truns
> >external relocations to internal and should improve runtime, too: comdat
> >sharing by dynamic linker is expensive and won't save duplicated functions
> >from the binary.
>
> Makes sense.
>
> >There is ext/visibility/template2.C that fails with the patch. It tests that
> >visibility pragma does not bring the symbol local, but now we do so based
> >on logic above.
> >
> >Jason, do you have any idea how to fix the testcase? I tried to use different
> >visility but that doesn't work, since we do not have corresponding scan-not-*
>
> Maybe change it to use a function that has its address taken, so
> this optimization doesn't apply.
OK, thanks. This did not appear to me. Does the following look resonable?
Index: testsuite/g++.dg/ext/visibility/template2.C
===================================================================
--- testsuite/g++.dg/ext/visibility/template2.C (revision 202047)
+++ testsuite/g++.dg/ext/visibility/template2.C (working copy)
@@ -4,15 +4,16 @@
/* { dg-do compile } */
/* { dg-require-visibility "" } */
-/* { dg-final { scan-not-hidden "_ZN1SIiED1Ev" } } */
-/* { dg-final { scan-not-hidden "_ZN1SIiEC1ERKi" } } */
+/* { dg-final { scan-not-hidden "_ZN1SIiE9nothiddenEv" } } */
template <class T>
struct S
{
S (const T &);
+ void nothidden(void);
~S ();
T t;
+ void (S::* ptr) (void);
};
template <class T>
@@ -20,6 +21,13 @@ S<T>::S (const T &x)
{
t = x;
}
+template <class T>
+void
+S<T>::nothidden(void)
+{
+ if (t)
+ ptr=&S::nothidden;
+}
template <class T>
S<T>::~S ()
@@ -30,6 +38,6 @@ S<T>::~S ()
struct U
{
S<int> s;
- U () : s (6) { }
+ U () : s (6) { s.nothidden();}
} u;
#pragma GCC visibility pop