http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58678

--- Comment #53 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Markus Trippelsdorf from comment #41)
> markus@x4 tmp % g++ -flto -c -O2 test.ii && nm test.o | grep
> _ZN8Calligra6Sheets5qHashERKNS0_10ConditionsE
>          U _ZN8Calligra6Sheets5qHashERKNS0_10ConditionsE
> markus@x4 tmp % g++ -c -O2 test.ii && nm test.o | grep
> _ZN8Calligra6Sheets5qHashERKNS0_10ConditionsE

OK.  The reason you're seeing this in gcc-nm output for test.o is that with
-flto, in compute_ltrans_boundary we decide to keep any possible targets for
late devirtualization.  This smaller testcase shows the same thing:

void f();

struct A { virtual void g(); };  
struct B: A {
  virtual void g() { f(); }
};

void h(A* ap) { ap->g(); }

With -flto, this refers to f because we keep B::g around until link time.  But
then it is discarded at link time if it isn't actually used, so the reference
to f goes away.  I guess that in the case of libcalligrasheetscommon we do end
up needing the definition of whatever function.

In any case, I agree with you that this is a bug in Calligra; headers shouldn't
contain calls to hidden functions.  So I'm inclined to close the bug again.

Reply via email to