Merge commit '00f1a4f432b3d8aad1aa270e91c44c57f03ef407'
[unleashed.git] / usr / src / cmd / sgs / rtld / Makefile.com
blobb2656eaffbe308879031d897d2b5a724d7b159cd
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
23 # Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
26 RTLD=           ld.so.1
28 AVLOBJ=         avl.o
29 DTROBJ=         dtrace_data.o
30 TOOLOBJS=       alist.o strhash.o
31 BLTOBJ=         msg.o
32 ELFCAPOBJ=      elfcap.o
33 OBJECTS=        $(BLTOBJ) \
34                 $(AVLOBJ) \
35                 $(DTROBJ) \
36                 $(TOOLOBJS) \
37                 $(ELFCAPOBJ) \
38                 $(P_ASOBJS)   $(P_COMOBJS)   $(P_MACHOBJS)   $(G_MACHOBJS)  \
39                 $(S_ASOBJS)   $(S_COMOBJS)   $(S_MACHOBJS)   $(CP_MACHOBJS)
41 COMOBJS=        $(P_COMOBJS)  $(S_COMOBJS)
42 ASOBJS=         $(P_ASOBJS)   $(S_ASOBJS)
43 MACHOBJS=       $(P_MACHOBJS) $(S_MACHOBJS)
44 NOCTFOBJS=      $(ASOBJS)
46 include         $(SRC)/lib/Makefile.lib
47 include         $(SRC)/cmd/sgs/Makefile.com
49 SRCDIR =        ../common
50 ELFCAP =        $(SRC)/common/elfcap
51 PLAT =          $(VAR_PLAT_$(BASEPLAT))
53 MAPFILES +=     $(MAPFILE-ORDER)
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.
58 ROOTFS_DYNLIB=  $(RTLD:%=$(ROOTFS_LIBDIR)/%)
59 ROOTFS_DYNLIB64=        $(RTLD:%=$(ROOTFS_LIBDIR64)/%)
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.
64 ETCLIBDIR=      $(ROOT)/etc/lib
65 ETCDYNLIB=      $(RTLD:%=$(ETCLIBDIR)/%)
67 ROOTDYNLIB=     $(RTLD:%=$(ROOTFS_LIBDIR)/%)
68 ROOTDYNLIB64=   $(RTLD:%=$(ROOTFS_LIBDIR64)/%)
71 FILEMODE =      755
73 CPPFLAGS +=     -I$(SRCBASE)/lib/libc/inc \
74                 -I$(SRCTOP)/include \
75                 -I$(SRCBASE)/uts/$(PLAT) \
76                 -I$(SRCBASE)/uts/$(PLAT)/krtld \
77                 -I$(SRC)/common/sgsrtcid \
78                 -I$(ELFCAP) \
79                  $(CPPFEATUREMACROS)
81 ASFLAGS=        -D_ASM $(CPPFLAGS)
82 LDLIB =         -L ../../libld/$(MACH)
83 RTLDLIB =       -L ../../librtld/$(MACH)
85 CERRWARN +=     -Wno-uninitialized
86 CERRWARN +=     -Wno-unused-variable
87 CERRWARN +=     -Wno-switch
89 # These definitions require that libc be built in the same workspace
90 # as the run-time linker and before the run-time linker is built.
91 # This is required for the system's self-consistency in any case.
92 CPICLIB =       $(VAR_RTLD_CPICLIB)
93 CPICLIB64 =     $(VAR_RTLD_CPICLIB64)
94 CLIB =          -lc_pic
96 LDLIBS +=       $(CONVLIBDIR) $(CONV_LIB) \
97                 $(CPICLIB) $(CLIB) \
98                 $(LDDBGLIBDIR) $(LDDBG_LIB) \
99                 $(RTLDLIB) -lrtld \
100                 $(LDLIB) $(LD_LIB) 
102 # The first few lines are essentially duplicating DYNFLAGS, but without the
103 # CW & GCC argument prefixes.
104 DYNFLAGS =      $(HSONAME) $(LD_ZTEXT) $(LD_ZDEFS) $(LD_BDIRECT) \
105                 $(MAPFILES:%=-M%) $(MAPFILE.PGA:%=-M%) $(LD_ZIGNORE) \
106                 -i -e _rt_boot $(VERSREF) $(LD_ZNODLOPEN) \
107                 $(LD_ZINTERPOSE) -zdtrace=dtrace_data '-R$$ORIGIN'
109 # DTrace needs an executable data segment.
110 DYNFLAGS += -M$(SRC)/common/mapfiles/common/map.execdata
112 BUILD.s=        $(AS) $(ASFLAGS) $< -o $@
114 BLTDEFS=        msg.h
115 BLTDATA=        msg.c
116 BLTMESG=        $(SGSMSGDIR)/rtld
118 BLTFILES=       $(BLTDEFS) $(BLTDATA) $(BLTMESG)
120 SGSMSGCOM=      ../common/rtld.msg
121 SGSMSG32=       ../common/rtld.32.msg
122 SGSMSG64=       ../common/rtld.64.msg
123 SGSMSGSPARC=    ../common/rtld.sparc.msg
124 SGSMSGSPARC32=  ../common/rtld.sparc32.msg
125 SGSMSGSPARC64=  ../common/rtld.sparc64.msg
126 SGSMSGINTEL=    ../common/rtld.intel.msg
127 SGSMSGINTEL32=  ../common/rtld.intel32.msg
128 SGSMSGINTEL64=  ../common/rtld.intel64.msg
129 SGSMSGCHK=      ../common/rtld.chk.msg
130 SGSMSGTARG=     $(SGSMSGCOM)
131 SGSMSGALL=      $(SGSMSGCOM) $(SGSMSG32) $(SGSMSG64) \
132                 $(SGSMSGSPARC) $(SGSMSGSPARC32) $(SGSMSGSPARC64) \
133                 $(SGSMSGINTEL) $(SGSMSGINTEL32) $(SGSMSGINTEL64)
135 SGSMSGFLAGS1=   $(SGSMSGFLAGS) -m $(BLTMESG)
136 SGSMSGFLAGS2=   $(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n rtld_msg
138 SRCS=           $(AVLOBJ:%.o=$(VAR_AVLDIR)/%.c) \
139                 $(DTROBJ:%.o=$(VAR_DTRDIR)/%.c) \
140                 $(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
141                 $(COMOBJS:%.o=../common/%.c)  $(MACHOBJS:%.o=%.c) $(BLTDATA) \
142                 $(G_MACHOBJS:%.o=$(SRCTOP)/arch/x86/kernel/krtld/$(BITS)/%.c) \
143                 $(CP_MACHOBJS:%.o=../$(MACH)/%.c) \
144                 $(ASOBJS:%.o=%.s)
146 CLEANFILES +=   $(CRTS)  $(BLTFILES)
147 CLOBBERFILES += $(RTLD)