Print this page
9059 Simplify SMAP relocations with krtld
Portions contributed by: John Levon <john.levon@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86pc/Makefile.rules
+++ new/usr/src/uts/i86pc/Makefile.rules
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
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 21
22 22 #
23 23 # Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
25 25 # Copyright 2019 Joyent, Inc.
26 26 # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
27 27 #
28 28
29 29 # This Makefile defines the build rules for the directory uts/i86pc
30 30 # and its children. These are the source files which are i86pc
31 31 # "implementation architecture" dependent.
32 32 #
33 33 # The following two-level ordering must be maintained in this file.
34 34 # Lines are sorted first in order of decreasing specificity based on
35 35 # the first directory component. That is, i86pc rules come before
36 36 # intel rules come before common rules.
37 37 #
38 38 # Lines whose initial directory components are equal are sorted
39 39 # alphabetically by the remaining components.
40 40
41 41 #
42 42 # Section 1a: C object build rules
43 43 #
44 44 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/conf/%.c
45 45 $(COMPILE.c) -o $@ $<
46 46 $(CTFCONVERT_O)
47 47
48 48 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/amd_opteron/%.c
49 49 $(COMPILE.c) -o $@ $<
50 50 $(CTFCONVERT_O)
51 51
52 52 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/authenticamd/%.c
53 53 $(COMPILE.c) -o $@ $<
54 54 $(CTFCONVERT_O)
55 55
56 56 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/generic_cpu/%.c
57 57 $(COMPILE.c) -o $@ $<
58 58 $(CTFCONVERT_O)
59 59
60 60 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/cpu/genuineintel/%.c
61 61 $(COMPILE.c) -o $@ $<
62 62 $(CTFCONVERT_O)
63 63
64 64 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/%.c
65 65 $(COMPILE.c) -o $@ $<
66 66 $(CTFCONVERT_O)
67 67
68 68 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi_drv/%.c
69 69 $(COMPILE.c) -o $@ $<
70 70 $(CTFCONVERT_O)
71 71
72 72 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/fipe/%.c
73 73 $(COMPILE.c) -o $@ $<
74 74 $(CTFCONVERT_O)
75 75
76 76 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/acpidev/%.c
77 77 $(COMPILE.c) -o $@ $<
78 78 $(CTFCONVERT_O)
79 79
80 80 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/acpinex/%.c
81 81 $(COMPILE.c) -o $@ $<
82 82 $(CTFCONVERT_O)
83 83
84 84 SBD_IOCTL = $(UTSBASE)/i86pc/sys/sbd_ioctl.h
85 85 DRMACH_IO = $(UTSBASE)/i86pc/io/acpi/drmach_acpi
86 86 DRMACH_GENERR = $(DRMACH_IO)/sbdgenerr
87 87 DR_IO = $(UTSBASE)/i86pc/io/dr
88 88 DR_GENERR = $(DR_IO)/sbdgenerr
89 89
90 90 $(DRMACH_GENERR): $(DR_IO)/sbdgenerr.pl
91 91 $(RM) $@
92 92 $(CAT) $(DR_IO)/sbdgenerr.pl > $@
93 93 $(CHMOD) +x $@
94 94
95 95 $(DRMACH_IO)/drmach_err.c: $(DRMACH_GENERR) $(SBD_IOCTL)
96 96 $(RM) $@
97 97 $(DRMACH_GENERR) EX86 < $(SBD_IOCTL) > $(DRMACH_IO)/drmach_err.c
98 98
99 99 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/acpi/drmach_acpi/%.c
100 100 $(COMPILE.c) -o $@ $<
101 101 $(CTFCONVERT_O)
102 102
103 103 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/amd_iommu/%.c
104 104 $(COMPILE.c) -o $@ $<
105 105 $(CTFCONVERT_O)
106 106
107 107 $(DR_GENERR): $(DR_IO)/sbdgenerr.pl
108 108 $(RM) $@
109 109 $(CAT) $(DR_IO)/sbdgenerr.pl > $@
110 110 $(CHMOD) +x $@
111 111
112 112 $(DR_IO)/dr_err.c: $(DR_GENERR) $(SBD_IOCTL)
113 113 $(RM) $@
114 114 $(DR_GENERR) ESBD < $(SBD_IOCTL) > $(DR_IO)/dr_err.c
115 115
116 116 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/dr/%.c
117 117 $(COMPILE.c) -o $@ $<
118 118 $(CTFCONVERT_O)
119 119
120 120 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ioat/%.c
121 121 $(COMPILE.c) -o $@ $<
122 122 $(CTFCONVERT_O)
123 123
124 124 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/imc/%.c
125 125 $(COMPILE.c) -o $@ $<
126 126 $(CTFCONVERT_O)
127 127
128 128 $(OBJS_DIR)/%.o: $(SRC)/common/mc/imc/%.c
129 129 $(COMPILE.c) -o $@ $<
130 130 $(CTFCONVERT_O)
131 131
132 132 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pci/%.c
133 133 $(COMPILE.c) -o $@ $<
134 134 $(CTFCONVERT_O)
135 135
136 136 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pciex/%.c
137 137 $(COMPILE.c) -o $@ $<
138 138 $(CTFCONVERT_O)
139 139
140 140 $(OBJS_DIR)/%.o: $(UTSBASE)/intel/io/pciex/hotplug/%.c
141 141 $(COMPILE.c) -o $@ $<
142 142 $(CTFCONVERT_O)
143 143
144 144 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.c
145 145 $(COMPILE.c) -o $@ $<
146 146 $(CTFCONVERT_O)
147 147
148 148 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/pcplusmp/%.s
149 149 $(COMPILE.s) -o $@ $<
150 150
151 151 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/apix/%.c
152 152 $(COMPILE.c) -o $@ $<
153 153 $(CTFCONVERT_O)
154 154
155 155 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.c
156 156 $(COMPILE.c) -o $@ $<
157 157 $(CTFCONVERT_O)
158 158
159 159 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/ppm/%.s
160 160 $(COMPILE.s) -o $@ $<
161 161
162 162 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.c
163 163 $(COMPILE.c) -o $@ $<
164 164 $(CTFCONVERT_O)
165 165
166 166 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/psm/%.s
167 167 $(COMPILE.s) -o $@ $<
168 168
169 169 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/tzmon/%.c
170 170 $(COMPILE.c) -o $@ $<
171 171 $(CTFCONVERT_O)
172 172
173 173 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/ml/%.s
174 174 $(COMPILE.s) -o $@ $<
175 175
176 176 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/%.c
177 177 $(COMPILE.c) -_gcc=-fno-stack-protector -o $@ $<
178 178 $(CTFCONVERT_O)
179 179
180 180 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/os/cpupm/%.c
181 181 $(COMPILE.c) -o $@ $<
182 182 $(CTFCONVERT_O)
183 183
184 184 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c
185 185 $(COMPILE.c) -o $@ $<
186 186 $(CTFCONVERT_O)
187 187
188 188 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/vm/%.c
189 189 $(COMPILE.c) -o $@ $<
190 190 $(CTFCONVERT_O)
191 191
192 192 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/%.c
193 193 $(COMPILE.c) -o $@ $<
194 194 $(CTFCONVERT_O)
195 195
196 196 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/ppm/%.c
197 197 $(COMPILE.c) -o $@ $<
198 198 $(CTFCONVERT_O)
199 199
200 200 $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/pciex/%.c
201 201 $(COMPILE.c) -o $@ $<
202 202 $(CTFCONVERT_O)
203 203
204 204 $(OBJS_DIR)/%.o: $(UTSBASE)/common/os/%.c
205 205 $(COMPILE.c) -o $@ $<
206 206 $(CTFCONVERT_O)
207 207
208 208 $(OBJS_DIR)/%.o: $(SRC)/common/dis/i386/%.c
209 209 $(COMPILE.c) -o $@ $<
210 210 $(CTFCONVERT_O)
211 211
212 212 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/gfx_private/%.c
213 213 $(COMPILE.c) -o $@ $<
214 214 $(CTFCONVERT_O)
215 215
216 216 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/io/xsvc/%.c
217 217 $(COMPILE.c) -o $@ $<
218 218 $(CTFCONVERT_O)
219 219
220 220 $(OBJS_DIR)/%.o: $(UTSBASE)/common/xen/os/%.c
221 221 $(COMPILE.c) -o $@ $<
222 222 $(CTFCONVERT_O)
223 223
224 224 $(OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.c
225 225 $(COMPILE.c) -o $@ $<
226 226 $(CTFCONVERT_O)
227 227
228 228 #
229 229 # dboot stuff is always 32 bit, linked to run with phys_addr == virt_addr
230 230 #
231 231 DBOOT_OBJS_DIR = dboot/$(OBJS_DIR)
232 232 DBOOT_MACH_32 = -D_BOOT_TARGET_i386
233 233 DBOOT_MACH_64 = -D_BOOT_TARGET_amd64
234 234 DBOOT_DEFS = -D_BOOT $(DBOOT_MACH_$(CLASS))
235 235 DBOOT_DEFS += -D_MACHDEP -U_KERNEL -D_I32LPx
236 236 DBOOT_FLAGS = $(CFLAGS_XARCH_32) $(CCVERBOSE) $(CSTD) $(CERRWARN)
237 237 DBOOT_FLAGS += $(CCNOAUTOINLINE)
238 238
239 239 DBOOT_CC_INCL = -I$(SRC)/common -I$(SRC)/common/util $(INCLUDE_PATH)
240 240 DBOOT_AS_INCL = $(AS_INC_PATH)
241 241
242 242 DBOOT_AS = $(ONBLD_TOOLS)/bin/$(MACH)/aw
243 243
244 244 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/boot/%.c
245 245 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
246 246
247 247 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.c
248 248 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
249 249
250 250 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/intel/ia32/%.s
251 251 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
252 252
253 253 $(DBOOT_OBJS_DIR)/%.o: $(SRC)/common/font/%.c
254 254 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
255 255
256 256 $(DBOOT_OBJS_DIR)/$(FONT).c: $(FONT_DIR)/$(FONT_SRC).bdf
257 257 $(VTFONTCVT) -f source -o $@ $(FONT_DIR)/$(FONT_SRC).bdf
258 258
259 259 $(DBOOT_OBJS_DIR)/%.o: $(DBOOT_OBJS_DIR)/%.c
260 260 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
261 261
262 262 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/crypto/sha1/%.c
263 263 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
264 264
265 265 $(DBOOT_OBJS_DIR)/%.o: $(DBOOT_OBJS_DIR)/%.c
266 266 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
267 267
268 268 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/%.c
269 269 $(i386_CC) $(DBOOT_FLAGS) -O $(DBOOT_DEFS) $(DBOOT_CC_INCL) -c -o $@ $<
270 270
271 271 $(DBOOT_OBJS_DIR)/%.o: $(COMMONBASE)/util/i386/%.s
272 272 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
273 273
274 274 $(DBOOT_OBJS_DIR)/%.o: $(UTSBASE)/i86pc/dboot/%.s
275 275 $(DBOOT_AS) -P -D_ASM $(DBOOT_DEFS) $(DBOOT_AS_INCL) -o $@ $<
276 276
277 277 #
278 278 # Stuff to build bios_call.o for the kernel.
279 279 #
280 280 MAPFILE_BIOS = $(UTSBASE)/i86pc/conf/Mapfile.bios
281 281 $(OBJS_DIR)/bios_call.o: $(UTSBASE)/i86pc/ml/bios_call_src.s
282 282 $(COMPILE.s) -o $(OBJS_DIR)/bios_call_src.o \
283 283 $(UTSBASE)/i86pc/ml/bios_call_src.s
284 284 $(LD) -dn -M $(MAPFILE_BIOS) \
285 285 -o $(OBJS_DIR)/bios_call_src $(OBJS_DIR)/bios_call_src.o
286 286 @echo " .data" > $(OBJS_DIR)/bios_call.s
287 287 @echo " .globl bios_image" >> $(OBJS_DIR)/bios_call.s
288 288 @echo "bios_image:" >> $(OBJS_DIR)/bios_call.s
289 289 $(ELFEXTRACT) $(OBJS_DIR)/bios_call_src >> $(OBJS_DIR)/bios_call.s
290 290 @echo " .align 4" >> $(OBJS_DIR)/bios_call.s
291 291 @echo " .globl bios_size" >> $(OBJS_DIR)/bios_call.s
292 292 @echo "bios_size:" >> $(OBJS_DIR)/bios_call.s
293 293 @echo " .long . - bios_image" >> $(OBJS_DIR)/bios_call.s
294 294 $(COMPILE.s) -o $@ $(OBJS_DIR)/bios_call.s
295 295
296 296 #
297 297 # Stuff to build fb_swtch.o for the kernel.
298 298 #
299 299 MAPFILE_FBSWTCH = $(UTSBASE)/i86pc/conf/Mapfile.fb_swtch
300 300 $(OBJS_DIR)/fb_swtch.o: $(UTSBASE)/i86pc/ml/fb_swtch_src.s
301 301 $(COMPILE.s) -o $(OBJS_DIR)/fb_swtch_src.o \
302 302 $(UTSBASE)/i86pc/ml/fb_swtch_src.s
303 303 $(LD) -dn -M $(MAPFILE_FBSWTCH) \
304 304 -o $(OBJS_DIR)/fb_swtch_src $(OBJS_DIR)/fb_swtch_src.o
305 305 @echo " .data" > $(OBJS_DIR)/fb_swtch.s
306 306 @echo " .globl fb_swtch_image" >> $(OBJS_DIR)/fb_swtch.s
307 307 @echo "fb_swtch_image:" >> $(OBJS_DIR)/fb_swtch.s
308 308 $(ELFEXTRACT) $(OBJS_DIR)/fb_swtch_src >> $(OBJS_DIR)/fb_swtch.s
309 309 @echo " .align 4" >> $(OBJS_DIR)/fb_swtch.s
310 310 @echo " .globl fb_swtch_size" >> $(OBJS_DIR)/fb_swtch.s
311 311 @echo "fb_swtch_size:" >> $(OBJS_DIR)/fb_swtch.s
312 312 @echo " .long . - fb_swtch_image" >> $(OBJS_DIR)/fb_swtch.s
313 313 $(COMPILE.s) -o $@ $(OBJS_DIR)/fb_swtch.s
314 314
315 315 # ridiculous contortions ---
316 316 ATOMIC_SUBDIR_32 = i386
317 317 ATOMIC_SUBDIR_64 = amd64
↓ open down ↓ |
317 lines elided |
↑ open up ↑ |
318 318 ATOMIC_SUBDIR = $(ATOMIC_SUBDIR_$(CLASS))
319 319
320 320 $(OBJS_DIR)/%.o: $(SRC)/common/atomic/$(ATOMIC_SUBDIR)/%.s
321 321 $(COMPILE.s) -o $@ $<
322 322
323 323 #
324 324 # dtrace stubs
325 325 #
326 326
327 327 $(OBJS_DIR)/dtracestubs.s: $(UNIX_O) $(LIBS)
328 - $(NM) -u $(UNIX_O) $(LIBS) | $(GREP) __dtrace_probe_ | $(SORT) | \
328 + $(NM) -u $(UNIX_O) $(LIBS) | \
329 + $(EGREP) '(__dtrace_probe_|smap_(disable|enable))' | $(SORT) | \
329 330 $(UNIQ) | $(AWK) '{ \
330 331 printf("\t.globl %s\n\t.type %s,@function\n%s:\n", \
331 332 $$1, $$1, $$1); }' > $(OBJS_DIR)/dtracestubs.s
332 333
333 334 $(DTRACESTUBS): $(DTRACESTUBS_O)
334 335 $(BUILD.SO) $(DTRACESTUBS_O)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX