Skip to content

Commit

Permalink
12217 add ld assert-deflib and guidance to gate build
Browse files Browse the repository at this point in the history
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
  • Loading branch information
tsoome committed Feb 5, 2020
1 parent 9487617 commit 5801b0f
Show file tree
Hide file tree
Showing 168 changed files with 306 additions and 531 deletions.
31 changes: 24 additions & 7 deletions usr/src/Makefile.master
Expand Up @@ -42,6 +42,14 @@ ROOT= /proto
# 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.
Expand Down Expand Up @@ -813,13 +821,19 @@ CCEXTNEEDED64 = -lCrun -lCstd
$(__GNUC64)CCNEEDED64 = -L$(GCCLIBDIR) -lstdc++ -lgcc_s
$(__GNUC64)CCEXTNEEDED = $(CCNEEDED64)

LINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
LINK64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
NORUNPATH= -norunpath -nolib
LINK.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
$(LDFLAGS) $(CCNEEDED)
LINK64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
$(LDFLAGS) $(CCNEEDED64)
# Libraries we expect to use natively on the build machine
NATIVE_LIBS=

LDCHECKS = $(ZASSERTDEFLIB) $(ZGUIDANCE) $(ZFATALWARNINGS)
LDCHECKS += $(NATIVE_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) $(LDCHECKS)
LINK64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
$(LDFLAGS) $(CCNEEDED64) $(LDCHECKS)

#
# lint macros
Expand Down Expand Up @@ -982,6 +996,9 @@ ZRECORD= -zrecord
ZREDLOCSYM= -zredlocsym
ZTEXT= -ztext
ZVERBOSE= -zverbose
ZASSERTDEFLIB= -zassert-deflib
ZGUIDANCE= -zguidance
ZFATALWARNINGS= -zfatal-warnings

GSHARED= -G
CCMT= -mt
Expand Down
4 changes: 1 addition & 3 deletions usr/src/cmd/availdevs/Makefile
Expand Up @@ -37,8 +37,8 @@ INCS += -I$(ADJUNCT_PROTO)/usr/include/libxml2
# it during lint, as well as turning off the warnings lint would generate.
#
LDLIBS += -lzfs_jni -lnvpair -lzfs
NATIVE_LIBS += libxml2.so
all install := LDLIBS += -lxml2
LINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2

CPPFLAGS += $(INCS) -D_LARGEFILE64_SOURCE=1 -D_REENTRANT
$(NOT_RELEASE_BUILD) CPPFLAGS += -DDEBUG
Expand All @@ -51,6 +51,4 @@ install: all $(ROOTCMD)

clean:

lint: lint_PROG

include ../Makefile.targ
1 change: 1 addition & 0 deletions usr/src/cmd/boot/bootadm/Makefile
Expand Up @@ -45,6 +45,7 @@ POFILE= bootadm_cmd.po
LDLIBS_i386= -lfdisk
LDLIBS += -lficl-sys -lmd -lcryptoutil -lnvpair -lgen -ladm -lefi
LDLIBS += -lscf -lz -lbe -lzfs -lofmt $(LDLIBS_$(MACH))
NATIVE_LIBS += libz.so

# Writing into string literals is incorrect. We need to match gcc's
# behavior, which causes us to take SIGSEGV on such a write.
Expand Down
6 changes: 2 additions & 4 deletions usr/src/cmd/boot/fiocompress/Makefile
Expand Up @@ -36,11 +36,11 @@ include ../Makefile.com
.KEEP_STATE:

LDLIBS += -lz
NATIVE_LIBS += libz.so

CFLAGS += -I../../../uts/common
LINTFLAGS += -I../../../uts/common

SMOFF += leaks
SMOFF += leaks

all: $(PROG)

Expand All @@ -55,6 +55,4 @@ clean:

_msg:

lint: lint_SRCS

include ../Makefile.targ
9 changes: 3 additions & 6 deletions usr/src/cmd/cdrw/Makefile
Expand Up @@ -35,13 +35,12 @@ include ../hal/Makefile.hal

SRCS= $(OBJS:.o=.c)

LDLIBS += -lhal -lsecdb
NONLINTLDLIBS = -ldbus-1
LDLIBS += -lhal -lsecdb -ldbus-1
NATIVE_LIBS += libdbus-1.so
CFLAGS += $(CCVERBOSE)
CERRWARN += $(CNOWARN_UNINIT)
CERRWARN += -_gcc=-Wno-parentheses
CPPFLAGS += -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(HAL_DBUS_CPPFLAGS)
LINTFLAGS += -um

# not linted
SMATCH=off
Expand All @@ -53,16 +52,14 @@ $(ROOTBIN)/cdrw := FILEMODE = 04755
all: $(PROG)

$(PROG): $(OBJS)
$(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS) $(NONLINTLDLIBS) $(CFLAGS)
$(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS) $(CFLAGS)
$(POST_PROCESS)

install: all $(ROOTPROG)

clean:
$(RM) $(OBJS)

lint: lint_SRCS

$(POFILE) : $(SRCS)
$(RM) $@
$(COMPILE.cpp) $(SRCS) | $(XGETTEXT) $(XGETFLAGS) -
Expand Down
3 changes: 1 addition & 2 deletions usr/src/cmd/cmd-crypto/Makefile
Expand Up @@ -40,12 +40,11 @@ all:= TARGET= all
install:= TARGET= install
clean:= TARGET= clean
clobber:= TARGET= clobber
lint:= TARGET= lint
_msg:= TARGET= _msg

.KEEP_STATE:

all clean clobber lint _msg: $(SUBDIRS1) $($(MACH)_SUBDIRS)
all clean clobber _msg: $(SUBDIRS1) $($(MACH)_SUBDIRS)

install: $(SUBDIRS1) $(SUBDIRS2) $($(MACH)_SUBDIRS)

Expand Down
3 changes: 1 addition & 2 deletions usr/src/cmd/cmd-crypto/kmfcfg/Makefile
Expand Up @@ -51,6 +51,7 @@ CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/libxml2 \
-I$(KMFDIR)/include -I.
LDLIBS += -L$(ROOT)/usr/lib -lkmf -lcryptoutil
XMLLIB = -lxml2
NATIVE_LIBS += libxml2.so

.KEEP_STATE:

Expand Down Expand Up @@ -83,6 +84,4 @@ $(DTDDIR)/%: %
clean:
$(RM) $(OBJS)

lint : lint_SRCS

include ../../Makefile.targ
4 changes: 1 addition & 3 deletions usr/src/cmd/cmd-crypto/tpmadm/Makefile
Expand Up @@ -35,8 +35,8 @@ POFILE = $(PROG)_msg.po
MSGFILES=$(SRCS:%.c=%.i)

CPPFLAGS += -xCC
LINTFLAGS += -XCC -L$(ADJUNCT_PROTO)/usr/lib
LDLIBS += -ltspi -luuid
NATIVE_LIBS += libtspi.so

CLOBBERFILES = C.ln $(POFILE) $(POFILES)

Expand All @@ -56,6 +56,4 @@ install : all $(ROOTPROG)
clean :
$(RM) $(OBJS)

lint : lint_SRCS

include ../../Makefile.targ
9 changes: 3 additions & 6 deletions usr/src/cmd/cmd-inet/usr.lib/wpad/Makefile
Expand Up @@ -27,17 +27,16 @@ PROG = wpad
MANIFEST = wpa.xml
OBJS = wpa_supplicant.o wpa.o wpa_enc.o eloop.o \
driver_wifi.o l2_packet.o
SRCS = $(OBJS:%.o=%.c)
SRCS = $(OBJS:%.o=%.c)

include ../../../Makefile.cmd

ROOTMANIFESTDIR = $(ROOTSVCNETWORK)

LDLIBS += -ldladm -ldlpi
LDLIBS += -ldladm -ldlpi
NATIVE_LIBS += libcrypto.so
all install := LDLIBS += -lcrypto

LINTFLAGS += -u

SMOFF += all_func_returns

.KEEP_STATE:
Expand All @@ -57,6 +56,4 @@ check: $(CHKMANIFEST)
clean:
$(RM) $(OBJS)

lint: lint_SRCS

include ../../../Makefile.targ
5 changes: 2 additions & 3 deletions usr/src/cmd/dfs.cmds/sharemgr/Makefile.com
Expand Up @@ -40,8 +40,9 @@ MYCPPFLAGS = -I../../../../lib/libfsmgt/common \
-I../..
CPPFLAGS += $(MYCPPFLAGS)
LDLIBS += -lshare -lscf -lsecdb -lumem
NATIVE_LIBS += libxml2.so

all install := LDLIBS += -lxml2
LINTFLAGS += -u

CERRWARN += $(CNOWARN_UNINIT)

Expand All @@ -64,8 +65,6 @@ install: all

$(SHAREMGRNO64)install: $(ROOTUSRSBINPROG)

lint: lint_SRCS

clean:
$(RM) $(OBJS)

Expand Down
2 changes: 1 addition & 1 deletion usr/src/cmd/fm/modules/common/fabric-xlate/Makefile
Expand Up @@ -34,10 +34,10 @@ CPPFLAGS += -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I$(KMFDIR)/include -I.
CPPFLAGS += -I$(SRC)/uts/sun4v/io/px
INCDIRS = $(SRC)/uts/common
CFLAGS += -I$(INCDIRS)
LINTFLAGS += -I$(INCDIRS)

LDFLAGS += -L$(ROOT)/usr/lib/fm -R/usr/lib/fm
LDLIBS += -luutil -lxml2 -L$(ROOTLIB)/fm -ltopo
NATIVE_LIBS += libxml2.so

CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-switch
Expand Down
16 changes: 3 additions & 13 deletions usr/src/cmd/fm/notify/snmp-notify/Makefile.com
Expand Up @@ -28,7 +28,6 @@

SRCS += snmp-notify.c
OBJS = $(SRCS:%.c=%.o)
LINTFILES = $(SRCS:%.c=%.ln)

PROG = snmp-notify
ROOTLIBFM = $(ROOT)/usr/lib/fm
Expand All @@ -47,13 +46,13 @@ CSTD = $(CSTD_GNU99)
CFLAGS += $(CTF_FLAGS) $(CCVERBOSE) $(XSTRCONST)
LDLIBS += -L$(ROOT)/usr/lib/fm -lnvpair -lfmevent -lfmd_msg -lfmnotify \
-lumem -lnetsnmp -lnetsnmpagent
NATIVE_LIBS += libnetsnmp.so libnetsnmpagent.so
LDFLAGS += -R/usr/lib/fm
LINTFLAGS += -mnu

CERRWARN += -_gcc=-Wno-parentheses

.NO_PARALLEL:
.PARALLEL: $(OBJS) $(LINTFILES)
.PARALLEL: $(OBJS)

all: $(PROG)

Expand All @@ -71,20 +70,11 @@ $(PROG): $(OBJS)
$(CTFCONVERT_O)

clean:
$(RM) $(OBJS) $(LINTFILES)
$(RM) $(OBJS)

clobber: clean
$(RM) $(PROG)

%.ln: ../common/%.c
$(LINT.c) -c $<

%.ln: %.c
$(LINT.c) -c $<

lint: $(LINTFILES)
$(LINT) $(LINTFLAGS) $(LINTFILES)

$(ROOTLIBNOTIFY):
$(INS.dir)

Expand Down
5 changes: 1 addition & 4 deletions usr/src/cmd/geniconvtbl/Makefile
Expand Up @@ -21,8 +21,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
# cmd/geniconvtbl/Makefile


Expand All @@ -37,7 +35,6 @@ all := TARGET = all
install := TARGET = install
clean := TARGET = clean
clobber := TARGET = clobber
lint := TARGET = lint
_msg := TARGET = catalog

.KEEP_STATE:
Expand All @@ -46,7 +43,7 @@ _msg := TARGET = catalog

all clean clobber install: $(SUBDIRS) .WAIT $(SAMPLES)

_msg lint: $(SUBDIRS)
_msg: $(SUBDIRS)

$(SUBDIRS) $(SAMPLES): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
Expand Down
17 changes: 1 addition & 16 deletions usr/src/cmd/geniconvtbl/Makefile.com
Expand Up @@ -104,7 +104,7 @@ $(ITM) := sparcv9_CFLAGS += -xregs=no%appl
LDLIBS += -lgen

MY_NATIVE_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -I. -I..
MY_NATIVE_LDFLAGS = $(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
MY_NATIVE_LDFLAGS = $(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) $(ZDIRECT) $(ZLAZYLOAD)
MY_NATIVE_LDLIBS = -lgen

#
Expand Down Expand Up @@ -151,18 +151,6 @@ $(POFILES): $(SRCSC) $(SRCI) $(SRCY) $(SRCL)
$(COMPILE.cpp) $< > $<.i
$(BUILD.po)


lint : lint_SRCS1 lint_SRCS2


lint_SRCS1: $(SRCS)
$(LINT.c) $(SRCS) $(LDLIBS)

lint_SRCS2: $(SRCI)
$(LINT.c) $(SRCI) $(LDLIBS)



hdrchk: $(HDRCHECKS)

cstyle: $(SRCS)
Expand All @@ -177,8 +165,6 @@ clean:
%.o: ../%.c
$(COMPILE.c) $<



# install rule
$(ROOTDIRS32)/%: $(ROOTDIRS32) %
-$(INS.file)
Expand All @@ -196,4 +182,3 @@ $(ROOTLIB) $(ROOTBIN):
-$(INS.dir)

include ../../Makefile.targ

3 changes: 1 addition & 2 deletions usr/src/cmd/geniconvtbl/native/Makefile
Expand Up @@ -23,8 +23,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#

.KEEP_STATE:

Expand All @@ -38,6 +36,7 @@ CFLAGS = $(NATIVE_CFLAGS)
CPPFLAGS = $(MY_NATIVE_CPPFLAGS)
LDFLAGS = $(MY_NATIVE_LDFLAGS)
LDLIBS = $(MY_NATIVE_LDLIBS)
NATIVE_LIBS += libgen.so libc.so
POST_PROCESS =

all install: $(PROG)
Expand Down
1 change: 1 addition & 0 deletions usr/src/cmd/hal/addons/acpi/Makefile
Expand Up @@ -33,6 +33,7 @@ include ../../Makefile.hal
ROOTCMDDIR = $(ROOTLIB_HAL)

LDLIBS += -lc -ldbus-1 -lhal -lglib-2.0
NATIVE_LIBS += libdbus-1.so libglib-2.0.so

CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../hald
Expand Down
1 change: 1 addition & 0 deletions usr/src/cmd/hal/addons/cpufreq/Makefile
Expand Up @@ -34,6 +34,7 @@ include ../../Makefile.hal
ROOTCMDDIR = $(ROOTLIB_HAL)

LDLIBS += -lc -ldbus-1 -lhal -lglib-2.0 -ldbus-glib-1 -lpolkit -lbsm
NATIVE_LIBS += libdbus-1.so libglib-2.0.so libdbus-glib-1.so

CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../hald
Expand Down
1 change: 1 addition & 0 deletions usr/src/cmd/hal/addons/network-devices/Makefile
Expand Up @@ -42,6 +42,7 @@ ROOTCMDDIR = $(ROOTLIB_HAL)
LDLIBS += -lc -ldbus-1 -lhal -lglib-2.0 -ldbus-glib-1
LDLIBS += -lnsl -lsocket
LDLIBS += $(ZIGNORE) -lnetsnmp
NATIVE_LIBS += libdbus-1.so libglib-2.0.so libdbus-glib-1.so libnetsnmp.so

CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
CPPFLAGS += -I$(ROOT)/usr/include/hal -I../../hald -I../../utils
Expand Down

0 comments on commit 5801b0f

Please sign in to comment.