[Bug c++/22592] -fvisibility-inlines-hidden broken differently

mmitchel at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Sep 3 01:03:00 GMT 2005


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-09-03 01:03 -------
Frankly, I think -fvisibility-inlines-hidden is a bad idea.  I don't feel that
way about -fvisibility, but giving inline functions special linkage in this way
is a very fragile concept, and awards something with minimal C++ semantics
("inline") substantial observable semantics.

The documentation for -fv-i-h is not clear about this case.  All it really says
is that any inlines emitted will be hidden.  The compiler's meeting that
requirement, trivially, because it's not emitting any inlines.  

I don't think that we should do anything different in *this* source file because
-fv-i-h is present.  The thing we actually want to know is how the file
containing the vtable is going to be compiled, and we can't know that here. 
Therefore, it seems to me that the mistake in Michael's chain of events is:

4) the call is emitted such that it expects a local (hidden) definition 
   of the function in the DSO (i.e. not over PLT but direct call) 

Nothing in the semantics of -fv-i-h says that all inline functions in the
program will be in this DSO.  If we were to try to believe that, other things
(like "extern template") would probably break too.  Instead, the linker should
have the responsibility of binding the relocation within the DSO at DSO
link-time, if there happens to be a satisfying symbol at link time.

Jan, I don't think your patch is correct, as I don't think anything about the
optimization of this program should change based on -fv-i-h.

-- 


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



More information about the Gcc-bugs mailing list