libcpp.a bugs (and fixes)

Melissa O'Neill oneill@cs.sfu.ca
Tue Nov 3 17:54:00 GMT 1998


In the 19981101 snapshot, there are some portability issues for libcpp.a
that prevent correct linking on some platforms (notably NEXTSTEP).

The gcc Makefile doesn't invoke ranlib on libcpp.a.

cppulp.c just contains a definition of the variable user_label_prefix,
but defines it as a common symbol. Some ranlib versions (notably NeXTs)
won't put common symbols in the archive table of contents to avoid
linking in a library member just because it uses an uninitialized global
that is undefined at that point in the linking. Thus user_label_prefix
ends up undefined. The fix is simple, have cppulp.c initialize
user_label_prefix.

cppfiles.c relies on the macros S_ISREG and S_ISDIR, which aren't defined
on all systems.

I've enclosed a patch for the first two of these issues. I don't know
enough about ``the proper way'' to fix cppfiles.c. I just applied a
bandaid of:

  #ifndef S_ISDIR
      #define S_ISDIR(mode)	(((mode) & (S_IFMT)) == (S_IFDIR))
      #define S_ISREG(mode)	(((mode) & (S_IFMT)) == (S_IFREG))
  #endif

... in cppfiles.c, but I'm sure there is a proper fix involving autoconf,
etc.

    Melissa.

P.S. 19981101 still doesn't compile on m68k-next-nextstep3; it crashes
out in the same place the last two snapshots have, at the second
compilation of libgcc2.a's _bb.o (i.e. when it is using
egcs-19981101-compiled-by-egcs-19981101 to make libgcc2.a (first time
around, it uses egcs-19981101-compiled-by-egcs-1.1b)).

Enc.

--- gcc/Makefile.in.orig	Tue Nov  3 11:01:34 1998
+++ gcc/Makefile.in	Tue Nov  3 17:26:00 1998
@@ -1886,6 +1886,7 @@

 libcpp.a: $(LIBCPP_OBJS)
 	$(AR) $(ARFLAGS) libcpp.a $(LIBCPP_OBJS)
+	$(RANLIB) libcpp.a

 cppmain$(exeext): cppmain.o libcpp.a $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \
--- gcc/cppulp.c.orig	Wed Oct 28 14:30:52 1998
+++ gcc/cppulp.c	Tue Nov  3 13:30:39 1998
@@ -24,4 +24,4 @@
 #include "gansidecl.h"
 #include "output.h"

-char *user_label_prefix;
+char *user_label_prefix = 0;



More information about the Gcc-bugs mailing list