xref: /illumos-gate/usr/src/cmd/sgs/rtld/Makefile.com (revision 08516594b0e540dc0f415fa7ae31f54d943a0913)
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
31DTROBJ=		dtrace_data.o
32TOOLOBJS=	alist.o strhash.o
33BLTOBJ=		msg.o
34OBJECTS=	$(BLTOBJ) \
35		$(AVLOBJ) \
36		$(DTROBJ) \
37		$(TOOLOBJS) \
38		$(P_ASOBJS)   $(P_COMOBJS)   $(P_MACHOBJS)   $(G_MACHOBJS)  \
39		$(S_ASOBJS)   $(S_COMOBJS)   $(S_MACHOBJS)   $(CP_MACHOBJS)
40
41COMOBJS=	$(P_COMOBJS)  $(S_COMOBJS)
42ASOBJS=		$(P_ASOBJS)   $(S_ASOBJS)
43MACHOBJS=	$(P_MACHOBJS) $(S_MACHOBJS)
44NOCTFOBJS=	$(ASOBJS)
45
46include		$(SRC)/lib/Makefile.lib
47include		$(SRC)/cmd/sgs/Makefile.com
48
49SRCDIR =	../common
50PLAT =		$(VAR_PLAT_$(BASEPLAT))
51
52# DTrace needs an executable data segment.
53NX_MAP=
54
55MAPFILES +=	$(MAPFILE-ORDER) $(MAPFILE-PLAT)
56
57# For the libc/libthread unified world:
58# This library needs to be placed in /lib to allow
59# dlopen() functionality while in single-user mode.
60ROOTFS_DYNLIB=	$(RTLD:%=$(ROOTFS_LIBDIR)/%)
61ROOTFS_DYNLIB64=	$(RTLD:%=$(ROOTFS_LIBDIR64)/%)
62
63# For the libc/libthread separated world:
64# A version of this library needs to be placed in /etc/lib to allow
65# dlopen() functionality while in single-user mode.
66ETCLIBDIR=	$(ROOT)/etc/lib
67ETCDYNLIB=	$(RTLD:%=$(ETCLIBDIR)/%)
68
69ROOTDYNLIB=	$(RTLD:%=$(ROOTFS_LIBDIR)/%)
70ROOTDYNLIB64=	$(RTLD:%=$(ROOTFS_LIBDIR64)/%)
71
72
73FILEMODE =	755
74
75CPPFEATUREMACROS= $(VAR_RTLD_CPPFEATUREMACROS)
76
77CPPFLAGS +=	-I$(SRCBASE)/lib/libc/inc \
78		-I$(SRCBASE)/uts/common/krtld \
79		-I$(SRCBASE)/uts/$(PLAT)/krtld \
80		-I$(SRC)/common/sgsrtcid \
81		 $(CPPFEATUREMACROS)
82
83ASFLAGS=	-P -D_ASM $(CPPFLAGS)
84LDLIB =		-L ../../libld/$(MACH)
85RTLDLIB =	-L ../../librtld/$(MACH)
86
87# These definitions require that libc be built in the same workspace
88# as the run-time linker and before the run-time linker is built.
89# This is required for the system's self-consistency in any case.
90CPICLIB =	$(VAR_RTLD_CPICLIB)
91CPICLIB64 =	$(VAR_RTLD_CPICLIB64)
92CLIB =		-lc_pic
93
94LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) \
95		$(CPICLIB) $(CLIB) \
96		$(LDDBGLIBDIR) $(LDDBG_LIB) \
97		$(RTLDLIB) -lrtld \
98		$(LDLIB) $(LD_LIB)
99
100DYNFLAGS +=	-i -e _rt_boot $(VERSREF) $(ZLAZYLOAD) $(ZNODLOPEN) \
101		$(ZINTERPOSE) -zdtrace=dtrace_data '-R$$ORIGIN'
102
103BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
104
105BLTDEFS=	msg.h
106BLTDATA=	msg.c
107BLTMESG=	$(SGSMSGDIR)/rtld
108
109BLTFILES=	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
110
111SGSMSGCOM=	../common/rtld.msg
112SGSMSG32=	../common/rtld.32.msg
113SGSMSG64=	../common/rtld.64.msg
114SGSMSGSPARC=	../common/rtld.sparc.msg
115SGSMSGSPARC32=	../common/rtld.sparc32.msg
116SGSMSGSPARC64=	../common/rtld.sparc64.msg
117SGSMSGINTEL=	../common/rtld.intel.msg
118SGSMSGINTEL32=	../common/rtld.intel32.msg
119SGSMSGINTEL64=	../common/rtld.intel64.msg
120SGSMSGCHK=	../common/rtld.chk.msg
121SGSMSGTARG=	$(SGSMSGCOM)
122SGSMSGALL=	$(SGSMSGCOM) $(SGSMSG32) $(SGSMSG64) \
123		$(SGSMSGSPARC) $(SGSMSGSPARC32) $(SGSMSGSPARC64) \
124		$(SGSMSGINTEL) $(SGSMSGINTEL32) $(SGSMSGINTEL64)
125
126SGSMSGFLAGS1=	$(SGSMSGFLAGS) -m $(BLTMESG)
127SGSMSGFLAGS2=	$(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n rtld_msg
128
129SRCS=		$(AVLOBJ:%.o=$(VAR_AVLDIR)/%.c) \
130		$(DTROBJ:%.o=$(VAR_DTRDIR)/%.c) \
131		$(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
132		$(COMOBJS:%.o=../common/%.c)  $(MACHOBJS:%.o=%.c) $(BLTDATA) \
133		$(G_MACHOBJS:%.o=$(SRCBASE)/uts/$(PLAT)/krtld/%.c) \
134		$(CP_MACHOBJS:%.o=../$(MACH)/%.c) \
135		$(ASOBJS:%.o=%.s)
136LINTSRCS=	$(SRCS) ../common/lintsup.c
137
138LINTFLAGS +=	-u -Dsun -D_REENTRANT -erroff=E_EMPTY_TRANSLATION_UNIT \
139		-erroff=E_NAME_DECL_NOT_USED_DEF2
140LINTFLAGS64 +=	-u -D_REENTRANT -erroff=E_CAST_INT_TO_SMALL_INT \
141		-erroff=E_NAME_DECL_NOT_USED_DEF2
142
143CLEANFILES +=	$(LINTOUTS)  $(CRTS)  $(BLTFILES)
144CLOBBERFILES +=	$(RTLD)
145