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]
23 # Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
25 # Copyright (c) 2018, Joyent, Inc.
31 TOOLOBJS= alist.o strhash.o
39 $(P_ASOBJS) $(P_COMOBJS) $(P_MACHOBJS) $(G_MACHOBJS) \
40 $(S_ASOBJS) $(S_COMOBJS) $(S_MACHOBJS) $(CP_MACHOBJS)
42 COMOBJS= $(P_COMOBJS) $(S_COMOBJS)
43 ASOBJS= $(P_ASOBJS) $(S_ASOBJS)
44 MACHOBJS= $(P_MACHOBJS) $(S_MACHOBJS)
47 include $(SRC)/lib/Makefile.lib
48 include $(SRC)/cmd/sgs/Makefile.com
51 ELFCAP = $(SRC)/common/elfcap
52 PLAT = $(VAR_PLAT_$(BASEPLAT))
54 MAPFILES += $(MAPFILE-ORDER)
56 # For the libc/libthread unified world:
57 # This library needs to be placed in /lib to allow
58 # dlopen() functionality while in single-user mode.
59 ROOTFS_DYNLIB= $(RTLD:%=$(ROOTFS_LIBDIR)/%)
60 ROOTFS_DYNLIB64= $(RTLD:%=$(ROOTFS_LIBDIR64)/%)
62 # For the libc/libthread separated world:
63 # A version of this library needs to be placed in /etc/lib to allow
64 # dlopen() functionality while in single-user mode.
65 ETCLIBDIR= $(ROOT)/etc/lib
66 ETCDYNLIB= $(RTLD:%=$(ETCLIBDIR)/%)
68 ROOTLIBEXEC= $(ROOT)/usr/libexec
69 ROOTLIBEXEC32= $(ROOT)/usr/libexec/$(MACH32)
71 ROOTDYNLIB= $(RTLD:%=$(ROOTLIBEXEC32)/%)
72 ROOTDYNLIB64= $(RTLD:%=$(ROOTLIBEXEC)/%)
77 CPPFLAGS += -I$(SRCBASE)/lib/libc/inc \
79 -I$(SRCBASE)/uts/$(PLAT) \
80 -I$(SRCBASE)/uts/$(PLAT)/krtld \
81 -I$(SRC)/common/sgsrtcid \
85 ASFLAGS= -D_ASM $(CPPFLAGS)
86 LDLIB = -L ../../libld/$(MACH)
87 RTLDLIB = -L ../../librtld/$(MACH)
89 CERRWARN += -Wno-uninitialized
90 CERRWARN += -Wno-unused-variable
91 CERRWARN += -Wno-switch
96 # These definitions require that libc be built in the same workspace
97 # as the run-time linker and before the run-time linker is built.
98 # This is required for the system's self-consistency in any case.
99 CPICLIB = $(VAR_RTLD_CPICLIB)
100 CPICLIB64 = $(VAR_RTLD_CPICLIB64)
103 LDLIBS += $(CONVLIBDIR) $(CONV_LIB) \
105 $(LDDBGLIBDIR) $(LDDBG_LIB) \
109 # The first few lines are essentially duplicating DYNFLAGS, but without the
110 # CW & GCC argument prefixes.
111 DYNFLAGS = $(HSONAME) $(LD_ZTEXT) $(LD_ZDEFS) $(LD_BDIRECT) \
112 $(MAPFILES:%=-M%) $(MAPFILE.PGA:%=-M%) $(LD_ZIGNORE) \
113 -i -e _rt_boot $(VERSREF) $(LD_ZNODLOPEN) \
114 $(LD_ZINTERPOSE) -zdtrace=dtrace_data '-R$$ORIGIN'
116 # DTrace needs an executable data segment.
117 DYNFLAGS += -M$(SRC)/common/mapfiles/common/map.execdata
119 BUILD.s= $(AS) $(ASFLAGS) $< -o $@
123 BLTMESG= $(SGSMSGDIR)/rtld
125 BLTFILES= $(BLTDEFS) $(BLTDATA) $(BLTMESG)
127 SGSMSGCOM= ../common/rtld.msg
128 SGSMSG32= ../common/rtld.32.msg
129 SGSMSG64= ../common/rtld.64.msg
130 SGSMSGSPARC= ../common/rtld.sparc.msg
131 SGSMSGSPARC32= ../common/rtld.sparc32.msg
132 SGSMSGSPARC64= ../common/rtld.sparc64.msg
133 SGSMSGINTEL= ../common/rtld.intel.msg
134 SGSMSGINTEL32= ../common/rtld.intel32.msg
135 SGSMSGINTEL64= ../common/rtld.intel64.msg
136 SGSMSGCHK= ../common/rtld.chk.msg
137 SGSMSGTARG= $(SGSMSGCOM)
138 SGSMSGALL= $(SGSMSGCOM) $(SGSMSG32) $(SGSMSG64) \
139 $(SGSMSGSPARC) $(SGSMSGSPARC32) $(SGSMSGSPARC64) \
140 $(SGSMSGINTEL) $(SGSMSGINTEL32) $(SGSMSGINTEL64)
142 SGSMSGFLAGS1= $(SGSMSGFLAGS) -m $(BLTMESG)
143 SGSMSGFLAGS2= $(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n rtld_msg
145 SRCS= $(AVLOBJ:%.o=$(VAR_AVLDIR)/%.c) \
146 $(DTROBJ:%.o=$(VAR_DTRDIR)/%.c) \
147 $(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
148 $(COMOBJS:%.o=../common/%.c) $(MACHOBJS:%.o=%.c) $(BLTDATA) \
149 $(G_MACHOBJS:%.o=$(SRCTOP)/arch/x86/kernel/krtld/$(BITS)/%.c) \
150 $(CP_MACHOBJS:%.o=../$(MACH)/%.c) \
153 CLEANFILES += $(CRTS) $(BLTFILES)
154 CLOBBERFILES += $(RTLD)