This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Make some comdats implicitly hidden


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]