xref: /illumos-gate/usr/src/cmd/sgs/rtld/Makefile.com (revision 9a411307f0d1eedbc81618ec290e0685284d8a2b)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28RTLD=		ld.so.1
29
30AVLOBJ=		avl.o
31TOOLOBJS=	alist.o strhash.o
32BLTOBJ=		msg.o
33OBJECTS=	$(BLTOBJ) \
34		$(AVLOBJ) \
35		$(TOOLOBJS) \
36		$(P_ASOBJS)   $(P_COMOBJS)   $(P_MACHOBJS)   $(G_MACHOBJS)  \
37		$(S_ASOBJS)   $(S_COMOBJS)   $(S_MACHOBJS)   $(CP_MACHOBJS)
38
39COMOBJS=	$(P_COMOBJS)  $(S_COMOBJS)
40ASOBJS=		$(P_ASOBJS)   $(S_ASOBJS)
41MACHOBJS=	$(P_MACHOBJS) $(S_MACHOBJS)
42NOCTFOBJS=	$(ASOBJS)
43
44include		$(SRC)/lib/Makefile.lib
45include		$(SRC)/cmd/sgs/Makefile.com
46
47SRCDIR =	../common
48PLAT =		$(VAR_PLAT_$(BASEPLAT))
49
50# Dtrace needs an executable data segment.
51NX_MAP=
52
53MAPFILES +=	$(MAPFILE-ORDER) $(MAPFILE-PLAT)
54
55# For the libc/libthread unified world:
56# This library needs to be placed in /lib to allow
57# dlopen() functionality while in single-user mode.
58ROOTFS_DYNLIB=	$(RTLD:%=$(ROOTFS_LIBDIR)/%)
59ROOTFS_DYNLIB64=	$(RTLD:%=$(ROOTFS_LIBDIR64)/%)
60
61# For the libc/libthread separated world:
62# A version of this library needs to be placed in /etc/lib to allow
63# dlopen() functionality while in single-user mode.
64ETCLIBDIR=	$(ROOT)/etc/lib
65ETCDYNLIB=	$(RTLD:%=$(ETCLIBDIR)/%)
66
67ROOTDYNLIB=	$(RTLD:%=$(ROOTFS_LIBDIR)/%)
68ROOTDYNLIB64=	$(RTLD:%=$(ROOTFS_LIBDIR64)/%)
69
70
71FILEMODE =	755
72
73CPPFEATUREMACROS= $(VAR_RTLD_CPPFEATUREMACROS)
74
75CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc \
76		-I$(SRCBASE)/uts/common/krtld \
77		-I$(SRCBASE)/uts/$(PLAT)/krtld \
78		-I$(SRC)/common/sgsrtcid \
79		 $(CPPFEATUREMACROS)
80
81ASFLAGS=	-P -D_ASM $(CPPFLAGS)
82LDLIB =		-L ../../libld/$(MACH)
83RTLDLIB =	-L ../../librtld/$(MACH)
84
85# These definitions require that libc be built in the same workspace
86# as the run-time linker and before the run-time linker is built.
87# This is required for the system's self-consistency in any case.
88CPICLIB =	$(VAR_RTLD_CPICLIB)
89CPICLIB64 =	$(VAR_RTLD_CPICLIB64)
90CLIB =		-lc_pic
91
92LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) \
93		$(CPICLIB) $(CLIB) \
94		$(LDDBGLIBDIR) $(LDDBG_LIB) \
95		$(RTLDLIB) -lrtld \
96		$(LDLIB) $(LD_LIB)
97
98DYNFLAGS +=	-i -e _rt_boot $(VERSREF) $(ZLAZYLOAD) $(ZNODLOPEN) \
99		$(ZINTERPOSE) -zdtrace=dtrace_data '-R$$ORIGIN'
100
101BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
102
103BLTDEFS=	msg.h
104BLTDATA=	msg.c
105BLTMESG=	$(SGSMSGDIR)/rtld
106
107BLTFILES=	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
108
109SGSMSGCOM=	../common/rtld.msg
110SGSMSG32=	../common/rtld.32.msg
111SGSMSG64=	../common/rtld.64.msg
112SGSMSGSPARC=	../common/rtld.sparc.msg
113SGSMSGSPARC32=	../common/rtld.sparc32.msg
114SGSMSGSPARC64=	../common/rtld.sparc64.msg
115SGSMSGINTEL=	../common/rtld.intel.msg
116SGSMSGINTEL32=	../common/rtld.intel32.msg
117SGSMSGINTEL64=	../common/rtld.intel64.msg
118SGSMSGCHK=	../common/rtld.chk.msg
119SGSMSGTARG=	$(SGSMSGCOM)
120SGSMSGALL=	$(SGSMSGCOM) $(SGSMSG32) $(SGSMSG64) \
121		$(SGSMSGSPARC) $(SGSMSGSPARC32) $(SGSMSGSPARC64) \
122		$(SGSMSGINTEL) $(SGSMSGINTEL32) $(SGSMSGINTEL64)
123
124SGSMSGFLAGS1=	$(SGSMSGFLAGS) -m $(BLTMESG)
125SGSMSGFLAGS2=	$(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n rtld_msg
126
127SRCS=		$(AVLOBJ:%.o=$(VAR_AVLDIR)/%.c) \
128		$(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
129		$(COMOBJS:%.o=../common/%.c)  $(MACHOBJS:%.o=%.c) $(BLTDATA) \
130		$(G_MACHOBJS:%.o=$(SRCBASE)/uts/$(PLAT)/krtld/%.c) \
131		$(CP_MACHOBJS:%.o=../$(MACH)/%.c) \
132		$(ASOBJS:%.o=%.s)
133LINTSRCS=	$(SRCS) ../common/lintsup.c
134
135LINTFLAGS +=	-u -Dsun -D_REENTRANT -erroff=E_EMPTY_TRANSLATION_UNIT \
136		-erroff=E_NAME_DECL_NOT_USED_DEF2
137LINTFLAGS64 +=	-u -D_REENTRANT -erroff=E_CAST_INT_TO_SMALL_INT \
138		-erroff=E_NAME_DECL_NOT_USED_DEF2
139
140CLEANFILES +=	$(LINTOUTS)  $(CRTS)  $(BLTFILES)
141CLOBBERFILES +=	$(RTLD)
142