Print this page
8411 Build should warn when linking against libraries outside proto area

@@ -25,10 +25,11 @@
 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
 # Copyright 2015 Gary Mills
 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
 # Copyright 2016 Toomas Soome <tsoome@me.com>
+# Copyright 2017 RackTop Systems.
 #
 
 #
 # Makefile.master, global definitions for system source
 #

@@ -97,10 +98,16 @@
 
 __SUNC=                 $(POUND_SIGN)
 $(__SUNC)__GNUC=        $(POUND_SIGN)
 __GNUC64=               $(__GNUC)
 
+# If ADJUNCT_PROTO was set we set ADJUNCT_PROTO_NOT_SET to POUND_SIGN so
+# we can use it to turn off the -zassert-deflib exceptions that allow
+# linking against host libraries.
+ADJUNCT_PROTO_NOT_SET=          $(ADJUNCT_PROTO:%=$(POUND_SIGN))
+$(ADJUNCT_PROTO_NOT_SET)ADJUNCT_PROTO_SET=      $(POUND_SIGN)
+
 # Allow build-time "configuration" to enable or disable some things.
 # The default is POUND_SIGN, meaning "not enabled". If the environment
 # passes in an override like ENABLE_SMB_PRINTING= (empty) that will
 # uncomment things in the lower Makefiles to enable the feature.
 ENABLE_SMB_PRINTING=    $(POUND_SIGN)

@@ -670,15 +677,10 @@
 
 #
 # LDLIBS32 and LDLIBS64 can be set in the environment to override the following
 # assignments.
 #
-# These environment settings make sure that no libraries are searched outside
-# of the local workspace proto area:
-#       LDLIBS32=-YP,$ROOT/lib:$ROOT/usr/lib
-#       LDLIBS64=-YP,$ROOT/lib/$MACH64:$ROOT/usr/lib/$MACH64
-#
 LDLIBS32 =      $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
 LDLIBS32 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
 LDLIBS.cmd =    $(LDLIBS32)
 LDLIBS.lib =    $(LDLIBS32)
 

@@ -686,10 +688,16 @@
                 $(ENVLDLIBS2:%=%/$(MACH64)) \
                 $(ENVLDLIBS3:%=%/$(MACH64))
 LDLIBS64 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64))
 
 #
+# Defines to be used when overriding the default search path with -YP.
+#
+DEFLDPATH =     /lib:/usr/lib
+DEFLDPATH64 =   /lib/64:/usr/lib/64
+
+#
 # Define compilation macros.
 #
 COMPILE.c=      $(CC) $(CFLAGS) $(CPPFLAGS) -c
 COMPILE64.c=    $(CC) $(CFLAGS64) $(CPPFLAGS) -c
 COMPILE.cc=     $(CCC) $(CCFLAGS) $(CPPFLAGS) -c

@@ -871,10 +879,11 @@
 ZNOVERSION=     -znoversion
 ZRECORD=        -zrecord
 ZREDLOCSYM=     -zredlocsym
 ZTEXT=          -ztext
 ZVERBOSE=       -zverbose
+ZASSERTDEFLIB=  -zassert-deflib
 
 GSHARED=        -G
 CCMT=           -mt
 
 # Handle different PIC models on different ISAs