gcc merrily compiles empty files

Michael Meissner meissner@cygnus.com
Tue Jun 20 19:00:00 GMT 2000

On Tue, Jun 20, 2000 at 09:32:36PM -0400, Henry Sobotka wrote:
> Mo McKinlay wrote:
> > 
> > Surely these would amount to the same thing, in terms of object files,
> > though...and hence lead to the same problems?
> Not necessarily. A conditionally empty source normally shouldn't produce
> linkage failure. In the case of my accident, a zero-length file in the
> object directory got compiled instead of the sourcefile in the source
> tree, so all kinds of symbols were missing.
> > If I didn't misread your original message, it points to a more serious
> > problem on your platform (i.e, why did those empty C sources compile to
> > produce object files which caused linkings problems?)
> It could be a platform thing. What happens if you try feeding gcc a
> 0-byte foo.c on your platform?

You get a perfectly valid object file that contains no sections (like I would

Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482

More information about the Gcc-bugs mailing list