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