xref: /illumos-gate/usr/src/uts/Makefile.mapfile (revision 55fea89dcaa64928bed4327112404dcb3e07b79f)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2016 Joyent, Inc.
14# Copyright 2021 Oxide Computer Company
15#
16
17#
18# This Makefile should be included in individual kernel modules to opt
19# into a -z defs world. Note, this should be included after a MAPFILES
20# entry is defined. See uts/common/README.mapfiles for more information.
21#
22
23#
24# Mapfile base
25#
26MAPBASE = $(UTSBASE)/common/mapfiles
27DTRACE_MAPFILE = $(OBJS_DIR)/dtrace.mapfile
28
29#
30# Always append -z defs to the LD FLAGS and append all mapfiles.
31#
32LDFLAGS += -z defs $(MAPFILES:%=-M $(MAPBASE)/%.mapfile) -M $(DTRACE_MAPFILE)
33
34#
35# Definitions and rules to assemble the DTrace probe mapfile. There's no
36# good way to automatically do this, hence we have a slightly gross
37# series of automated tools. This does mean that we have a bit more work
38# to do, but also means that probes can be added arbitrarily without
39# having to manually edit mapfiles.
40#
41DTRACE_AWK_FILE = $(MAPBASE)/dtrace.mapfile.awk
42
43$(OBJS_DIR)/dtrace.mapfile: $(OBJECTS) $(DTRACE_AWK_FILE)
44	$(NM) -u $(OBJECTS) | $(AWK) -f $(DTRACE_AWK_FILE) > $@
45
46#
47# Make sure that we don't leave behind the DTrace related mapfiles.
48#
49CLEANFILES += $(DTRACE_MAPFILE)
50