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 #
15
16 LIBRARY = lx_vdso.a
17 VERS = .1
18
19 include $(SRC)/lib/commpage/Makefile.shared.com
20
21 COBJS = vdso_main.o vdso_subr.o
22 OBJECTS = $(COBJS) $(COMMPAGE_OBJS)
23
24 include ../../../../Makefile.lib
25 include ../../Makefile.lx
26
27 #
28 # Since our name doesn't start with "lib", Makefile.lib incorrectly
29 # calculates LIBNAME. Therefore, we set it here.
30 #
31 LIBNAME = lx_vdso
32
33 MAPFILES = ../common/mapfile-vers
34 MAPOPTS = $(MAPFILES:%=-M%)
35
36 ASOBJS = vdso_subr.o
37 COBJS = vdso_main.o
38 OBJECTS = $(ASOBJS) $(COBJS) $(COMMPAGE_OBJS)
39
40 SRCDIR = ../common
41
42 ASSRCS = $(ASOBJS:%.o=$(ISASRCDIR)/%.s)
43 CSRCS = $(COBJS:%.o=$(SRCDIR)/%.c)
44 SRCS = $(ASSRCS) $(CSRCS)
45
46 LIBS = $(DYNLIB)
47 DYNFLAGS += $(DYNFLAGS_$(CLASS))
48 DYNFLAGS += $(MAPOPTS)
49 LDLIBS +=
50 ASFLAGS = -P $(ASFLAGS_$(CURTYPE)) -D_ASM
51
52
53 LIBS = $(DYNLIB)
54
55 CLEANFILES += $(DYNLIB)
56 ROOTLIBDIR = $(ROOT)/usr/lib/brand/lx
57 ROOTLIBDIR64 = $(ROOT)/usr/lib/brand/lx/$(MACH64)
58
59 VDSO_TOOL = ../tools/vdso_tool
60
61 .KEEP_STATE:
62
63 #
64 # While $(VDSO_TOOL) performs most of the transformations required to
65 # construct a correct VDSO object, we still make use of $(ELFEDIT). To
66 # remove the $(ELFEDIT) requirement would mean shouldering the burden of
67 # becoming a link-editor; this dark lore is best left to the linker aliens.
68 #
69 all: $(LIBS)
70 $(ELFEDIT) -e "dyn:value -add VERSYM $$($(ELFEDIT) \
71 -e 'shdr:dump .SUNW_versym' $(DYNLIB) | \
72 $(AWK) '{ if ($$1 == "sh_addr:") { print $$2 } }')" $(DYNLIB)
73 $(VDSO_TOOL) -f $(DYNLIB)
74
75 lint: $(LINTLIB) lintcheck
76
77 include ../../../../Makefile.targ
78 include $(SRC)/lib/commpage/Makefile.shared.targ
79
80 pics/%.o: $(ISASRCDIR)/%.s
81 $(COMPILE.s) -o $@ $<
82 $(POST_PROCESS_O)
83
84 pics/vdso_main.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS) -I$(SRCDIR)
85 pics/vdso_subr.o := ASFLAGS += -I$(SRC)/uts/common/brand/lx -I$(SRCDIR)