Print this page
10077 usr/src/uts/ Makefile changes for smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86pc/unix/Makefile
+++ new/usr/src/uts/i86pc/unix/Makefile
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
↓ open down ↓ |
10 lines elided |
↑ open up ↑ |
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 -
22 -#
23 21 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 22 # Use is subject to license terms.
25 23 #
26 -# This makefile drives the production of unix (and unix.o).
27 -#
28 -# i86pc implementation architecture dependent
29 -#
24 +# Copyright (c) 2018, Joyent, Inc.
30 25
31 26 #
32 27 # Path to the base of the uts directory tree (usually /usr/src/uts).
33 28 #
34 29 UTSBASE = ../..
35 30
36 31 #
37 32 # Define the module and object file sets.
38 33 #
39 34 UNIX = unix
40 35 DBOOT = dboot
41 36
42 37 OBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
43 38 $(CORE_OBJS:%=$(OBJS_DIR)/%) \
44 39 $(KRTLD_OBJS:%=$(OBJS_DIR)/%) \
45 40 $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
46 41
47 42 LINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
48 43 $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
49 44 $(KRTLD_OBJS:%.o=$(LINTS_DIR)/%.ln) \
50 45 $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
51 46 $(LINTS_DIR)/vers.ln \
52 47 $(LINTS_DIR)/modstubs.ln
53 48
54 49 ROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX)
55 50
56 51 UNIX_BIN = $(OBJS_DIR)/$(UNIX)
57 52
58 53 LIBS = $(GENLIB)
59 54
60 55 GENUNIX = genunix
61 56 GENUNIX_DIR = ../../intel/$(GENUNIX)
62 57
63 58 LIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
64 59
65 60 COMMP_CTF_SRC = $(OBJS_DIR)/comm_page_ctf.c
66 61
67 62 CTFEXTRAOBJS = $(OBJS_DIR)/vers.o $(OBJS_DIR)/comm_page_ctf.o
68 63
69 64 DBOOT_OBJS_DIR = dboot/$(OBJS_DIR)
70 65 DBOOT_OBJECTS = $(DBOOT_OBJS:%=$(DBOOT_OBJS_DIR)/%)
71 66 DBOOT_BIN = $(DBOOT_OBJS_DIR)/$(DBOOT)
72 67 DBOOT_O = $(OBJS_DIR)/$(DBOOT).o
73 68 DBOOT_S = $(DBOOT_O:%.o=%.s)
74 69 DBOOT_LINTS = $(DBOOT_OBJS:%.o=$(DBOOT_OBJS_DIR)/%.ln)
75 70 DBOOT_LINT = $(i386_LINT)
76 71 DBOOT_LINTTAGS = -erroff=E_STATIC_UNUSED
77 72
78 73 #
79 74 # Include common rules.
80 75 #
81 76 include $(UTSBASE)/i86pc/Makefile.i86pc
82 77
83 78 #
84 79 # Define targets
85 80 #
86 81 ALL_TARGET = $(UNIX_BIN)
87 82 LINT_TARGET = $(LINT_LIB) $(DBOOT_LINT_LIB)
88 83 INSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE)
89 84
90 85 #
91 86 # This is UNIX_DIR. Use a short path.
92 87 #
93 88 UNIX_DIR = .
94 89
95 90 #
96 91 # Overrides
97 92 #
98 93 CLEANFILES += \
99 94 $(UNIX_O) $(MODSTUBS_O) \
100 95 $(OBJS_DIR)/vers.c \
101 96 $(OBJS_DIR)/dtracestubs.s \
102 97 $(DTRACESTUBS_O) $(DTRACESTUBS) \
103 98 $(CTFEXTRAOBJS) \
104 99 $(COMMP_CTF_SRC)
105 100
106 101 CLEANFILES += \
107 102 $(DBOOT_O) $(DBOOT_S) \
108 103 $(DBOOT_OBJECTS) \
109 104 $(OBJS_DIR)/bios_call_src.o \
110 105 $(OBJS_DIR)/bios_call_src \
111 106 $(OBJS_DIR)/bios_call.s \
112 107 $(DBOOT_BIN)
113 108
114 109 CLEANFILES += \
115 110 $(DBOOT_OBJS_DIR)/$(VGATEXT_FONT).c \
116 111 $(OBJS_DIR)/$(VGATEXT_FONT).c
117 112
118 113 CLEANFILES += \
119 114 $(OBJS_DIR)/fb_swtch_src.o \
120 115 $(OBJS_DIR)/fb_swtch_src \
121 116 $(OBJS_DIR)/fb_swtch.s
122 117
123 118 CLEANFILES += \
124 119 $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.o) \
125 120 $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.ln)
126 121
127 122 CLOBBERFILES = $(CLEANFILES) $(UNIX_BIN)
128 123 CLEANLINTFILES += $(LINT_LIB) $(DBOOT_LINT_LIB) $(DBOOT_LINTS)
129 124
130 125 # instr_size needs a special header
131 126 $(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386
132 127 $(OBJS_DIR)/instr_size.ln := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386
133 128
134 129 #
135 130 # When performing shadow studio builds, the pre-processed comm page
136 131 # output from gcc can end up confusing studio.
137 132 #
138 133 $(OBJS_DIR)/comm_page_ctf.o := CERRWARN += -_cc=-erroff=E_TKNS_IGNORED_AT_END_OF_DIR
139 134
140 135 CFLAGS += -DDIS_MEM
141 136
142 137 #
143 138 # For now, disable these lint checks; maintainers should endeavor
144 139 # to investigate and remove these for maximum lint coverage.
145 140 # Please do not carry these forward to new Makefiles.
146 141 #
147 142 LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN
148 143 LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON
149 144 LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
150 145 LINTTAGS += -erroff=E_STATIC_UNUSED
151 146 LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW
152 147 LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
153 148
154 149 CERRWARN += -_gcc=-Wno-parentheses
↓ open down ↓ |
115 lines elided |
↑ open up ↑ |
155 150 CERRWARN += -_gcc=-Wno-uninitialized
156 151 CERRWARN += -_gcc=-Wno-char-subscripts
157 152 CERRWARN += -_gcc=-Wno-unused-variable
158 153 CERRWARN += -_gcc=-Wno-unused-function
159 154 CERRWARN += -_gcc=-Wno-unused-label
160 155 CERRWARN += -_gcc=-Wno-type-limits
161 156 CERRWARN += -_gcc=-Wno-clobbered
162 157 CERRWARN += -_gcc=-Wno-empty-body
163 158 CERRWARN += -_gcc=-Wno-unused-value
164 159
160 +# false positives
161 +SMOFF += index_overflow
162 +
163 +# needs work
164 +SMOFF += all_func_returns,deref_check,signed
165 +
166 +$(OBJS_DIR)/fmsmb.o := SMOFF += indenting
167 +$(OBJS_DIR)/zutil.o := SMOFF += indenting
168 +$(OBJS_DIR)/bootrd_cpio.o := SMOFF += allocating_enough_data
169 +
165 170 # Ensure that lint sees 'struct cpu' containing a fully declared
166 171 # embedded 'struct machcpu'
167 172 #
168 173 LINTFLAGS += -D_MACHDEP -I../../i86pc
169 174
170 175 #
171 176 # Default build targets.
172 177 #
173 178 .KEEP_STATE:
174 179
175 180 def: $(DEF_DEPS)
176 181
177 182 all: $(ALL_DEPS)
178 183
179 184 clean: $(CLEAN_DEPS)
180 185
181 186 clobber: $(CLOBBER_DEPS)
182 187
183 188 lint: $(LINT_DEPS)
184 189
185 190 clean.lint: $(CLEAN_LINT_DEPS)
186 191
187 192 install: $(INSTALL_DEPS)
188 193
189 194 MAPFILE_32 = $(MAPFILE)
190 195 MAPFILE_64 = $(MAPFILE).amd64
191 196
192 197 MAPFILE_NAME = $(MAPFILE_$(CLASS))
193 198
194 199 $(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \
195 200 $(GENLIB) $(DTRACESTUBS) $(DBOOT_O)
196 201 $(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \
197 202 $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \
198 203 $(DTRACESTUBS)
199 204 $(MBH_PATCH) $(UNIX_BIN)
200 205 $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
201 206 $(POST_PROCESS)
202 207
203 208 $(UNIX_O): $(OBJECTS) $(CTFEXTRAOBJS)
204 209 $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
205 210
206 211 $(DBOOT_BIN): $(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot
207 212 $(LD) -dn -e _start -M dboot/Mapfile.dboot \
208 213 -o $(DBOOT_BIN) $(DBOOT_OBJECTS)
209 214
210 215 $(DBOOT_O): $(DBOOT_BIN)
211 216 @echo " .data" > $(DBOOT_S)
212 217 @echo " .globl dboot_image" >> $(DBOOT_S)
213 218 @echo "dboot_image:" >> $(DBOOT_S)
214 219 $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S)
215 220 $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S)
216 221
217 222 $(DBOOT_OBJS_DIR):
218 223 -@mkdir -p $@ 2> /dev/null
219 224
220 225 $(COMMP_CTF_SRC): $(UTSBASE)/i86pc/ml/comm_page.s
221 226 $(COMPILE.cpp) -D_GENCTF -o $@ $(UTSBASE)/i86pc/ml/comm_page.s
222 227
223 228 $(OBJS_DIR)/comm_page_ctf.o: $(COMMP_CTF_SRC)
224 229 $(COMPILE.c) -o $@ $<
225 230 $(CTFCONVERT_O)
226 231
227 232 #
228 233 # Special rules for generating assym.h for inclusion in assembly files.
229 234 #
230 235 $(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h: FRC
231 236 @cd $(DSF_DIR); $(MAKE) all.targ
232 237
233 238 #
234 239 # The global lint target builds the kernel lint library (llib-lunix.ln)
235 240 # which is equivalent to a lint of /unix.o. Then all kernel modules for
236 241 # this architecture are linted against the kernel lint library.
237 242 #
238 243 # Note: lint errors in the kernel lint library will be repeated for
239 244 # each module. It is important that the kernel lint library
240 245 # be clean to keep the textual output to a reasonable level.
241 246 #
242 247
243 248 $(LINT_LIB): $(LINT_LIB_DIR) $(LINTS)
244 249 @pwd
245 250 @-$(ECHO) "\n$(UNIX): (library construction):"
246 251 @$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS)
247 252 @$(MV) $(@F) $@
248 253
249 254 $(DBOOT_LINT_LIB): $(LINT_LIB_DIR) $(DBOOT_LINTS)
250 255 @pwd
251 256 @-$(ECHO) "\n$(DBOOT): (library construction):"
252 257 @$(LINT) -o$(DBOOT) $(DBOOT_LINTFLAGS) $(DBOOT_LINTS)
253 258 @$(MV) $(@F) $@
254 259
255 260 lintlib: $(LINT_DEPS)
256 261
257 262 #
258 263 # Include common targets.
259 264 #
260 265 include $(UTSBASE)/i86pc/Makefile.targ
↓ open down ↓ |
86 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX