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: Fix notice_global_symbol


> > On Fri, Oct 10, 2003 at 11:25:34PM +0200, Jan Hubicka wrote:
> > > 	* varasm.c (notice_global_symbol):  Fix handling of variables; avoid
> > > 	re-computing of variable.
> > 
> > This looks ok.  I think it could stand to be cleaned up a bit more
> > to use targetm.binds_local_p.
> 
> OK, I will apply the patch as it is (it has been rather dificult to get
> it into shape it is right now) and will try to make another one using
> binds_local_p that passes Richard's testsuite (his application is
> directly accessing _GLOBAL_* symbols produced by GCC that is not very
> portable but good testing on where we changed mind for no good reason)

Thinking about this deeper, I am not quite sure whether it is good idea.
notice_global_symbol tests whether someone else can define same symbol
same way and not get linker error, while binds_local_p tests whether
someone else can overwrite the given symbol.

This is something else even when number of tests are similar, so perhaps
these can be split out into third function somehow, but I don't see
directly how.

This also brings into mind a problem - in C++ is it valid to overwrite
global symbol currently noticed binds_local_p so the constructor will
also get (incorrectly) overwriten?  Perhaps we need to add
!binds_local_p into the tests in function?  That will make us to use
random numbers for all shared libraries that is quite ugly....
Or perhaps we can make binds_local_p to be more strict for C++. 

Honza
> 
> Thanks,
> Honza
> > 
> > 
> > r~


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