This is the mail archive of the gcc@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]

linking .common and .weak definitions


Currently gcc.c-torture/execute/960218-1.c fails on arm-netbsdelf because 
we get a warning from the linker about a "compatibility" glob() 
definition.  However, on reflection I'm not convinced that the test's 
behaviour is well defined when compiling with -fcommon (the default).  The 
definition of 'glob' in the source is uninitialized, which leads to it 
being output as a .common block.

A .common is a tentative definition with no contents, and similarly a 
.weak is also a tentative definition with contents.  In the absence of a 
further strong definition it therefore does not seam unreasonable for the 
linker to try to combine these two.  Do others agree?

If we accept that the test as it is currently specified is ill-defined, 
then there are two options.

1) Always compile 960218-1.c with -fno-common
2) Ensure that glob is initialized so that it isn't give a .common 
definition in the output file.

Comments?

R.


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