Print this page
9852 enable ld(1) guidance and deflib assertions for the illumos build

@@ -38,10 +38,18 @@
 #
 # Adjunct root, containing an additional proto area to be used for headers
 # and libraries.
 #
 ADJUNCT_PROTO=
+# HAVE_ADJUNCT_PROTO - ADJUNCT_PROTO is set to a non-default value
+# NO_ADJUNCT_PROTO - ADJUNCT_PROTO is unset
+#
+# This works by replacing any value in ADJUNCT_PROTO with POUND_SIGN, which
+# only happens if it has some value, and then setting HAVE_ADJUNCT_PROTO
+# oppositely.
+NO_ADJUNCT_PROTO=$(ADJUNCT_PROTO:%=$(POUND_SIGN))
+$(NO_ADJUNCT_PROTO)HAVE_ADJUNCT_PROTO=$(POUND_SIGN)
 
 #
 # Adjunct for building things that run on the build machine.
 #
 NATIVE_ADJUNCT= /usr

@@ -724,17 +732,26 @@
 CCNEEDED                = -lC
 CCEXTNEEDED             = -lCrun -lCstd
 $(__GNUC)CCNEEDED       = -L$(GCCLIBDIR) -lstdc++ -lgcc_s
 $(__GNUC)CCEXTNEEDED    = $(CCNEEDED)
 
-LINK.c=         $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
-LINK64.c=       $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
+# Libraries we expect to find in ADJUNCT_PROTO
+ADJUNCT_LIBS=
+# Libraries we expect to use natively on the build machine
+NATIVE_LIBS=
+
+LDCHECKS                = $(ZASSERTDEFLIB) $(ZGUIDANCE) $(ZFATALWARNINGS)
+LDCHECKS                += $(NATIVE_LIBS:%=$(ZASSERTDEFLIB)=%)
+$(NO_ADJUNCT_PROTO)LDCHECKS += $(ADJUNCT_LIBS:%=$(ZASSERTDEFLIB)=%)
+
+LINK.c=         $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS)
+LINK64.c=       $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS)
 NORUNPATH=      -norunpath -nolib
 LINK.cc=        $(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
-                $(LDFLAGS) $(CCNEEDED)
+                $(LDFLAGS) $(CCNEEDED) $(LDCHECKS)
 LINK64.cc=      $(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
-                $(LDFLAGS) $(CCNEEDED)
+                $(LDFLAGS) $(CCNEEDED) $(LDCHECKS)
 
 #
 # lint macros
 #
 # Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once

@@ -885,10 +902,13 @@
 ZNOVERSION=     -znoversion
 ZRECORD=        -zrecord
 ZREDLOCSYM=     -zredlocsym
 ZTEXT=          -ztext
 ZVERBOSE=       -zverbose
+ZASSERTDEFLIB=  -zassert-deflib
+ZGUIDANCE=      -zguidance
+ZFATALWARNINGS= -zfatal-warnings
 
 GSHARED=        -G
 CCMT=           -mt
 
 # Handle different PIC models on different ISAs