xref: /titanic_50/usr/src/cmd/sgs/libld/Makefile.com (revision 15db28971f91c98efb449aebf46024ac72779fa3)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26LIBRARY =	libld.a
27VERS =		.4
28
29COMOBJS =	debug.o		globals.o	util.o
30
31COMOBJS32 =	args32.o	entry32.o	exit32.o	groups32.o \
32		ldentry32.o	ldlibs32.o	ldmachdep32.o	ldmain32.o \
33		libs32.o	files32.o	map32.o		order32.o \
34		outfile32.o	place32.o	relocate32.o	resolve32.o \
35		sections32.o	sunwmove32.o	support32.o	syms32.o \
36		update32.o	unwind32.o	version32.o	wrap32.o
37
38COMOBJS64 =	args64.o	entry64.o	exit64.o	groups64.o \
39		ldentry64.o	ldlibs64.o	ldmachdep64.o	ldmain64.o \
40		libs64.o	files64.o	map64.o		order64.o \
41		outfile64.o 	place64.o	relocate64.o	resolve64.o \
42		sections64.o	sunwmove64.o	support64.o	syms64.o \
43		update64.o	unwind64.o	version64.o	wrap64.o
44
45TOOLOBJS =	alist.o		assfail.o	findprime.o	string_table.o \
46		strhash.o
47AVLOBJ =	avl.o
48
49# Relocation engine objects. These are kept separate from the L_XXX_MACHOBJS
50# lists below in order to facilitate linting them.
51G_MACHOBJS32 =	doreloc_sparc_32.o doreloc_x86_32.o
52G_MACHOBJS64 =	doreloc_sparc_64.o doreloc_x86_64.o
53
54# Target specific objects (sparc/sparcv9)
55L_SPARC_MACHOBJS32 =	machrel.sparc32.o	machsym.sparc32.o
56L_SPARC_MACHOBJS64 =	machrel.sparc64.o	machsym.sparc64.o
57
58# Target specific objects (i386/amd64)
59E_X86_TOOLOBJS =	leb128.o
60L_X86_MACHOBJS32 =	machrel.intel32.o
61L_X86_MACHOBJS64 =	machrel.amd64.o
62
63
64# All target specific objects rolled together
65E_TOOLOBJS =	$(E_SPARC_TOOLOBJS) \
66	$(E_X86_TOOLOBJS)
67L_MACHOBJS32 =	$(L_SPARC_MACHOBJS32) \
68	$(L_X86_MACHOBJS32)
69L_MACHOBJS64 =	$(L_SPARC_MACHOBJS64) \
70	$(L_X86_MACHOBJS64)
71
72
73
74BLTOBJ =	msg.o
75ELFCAPOBJ =	elfcap.o
76
77OBJECTS =	$(BLTOBJ) $(G_MACHOBJS32) $(G_MACHOBJS64) \
78		$(L_MACHOBJS32) $(L_MACHOBJS64) \
79		$(COMOBJS) $(COMOBJS32) $(COMOBJS64) \
80		$(TOOLOBJS) $(E_TOOLOBJS) $(AVLOBJ) $(ELFCAPOBJ)
81
82include 	$(SRC)/lib/Makefile.lib
83include 	$(SRC)/cmd/sgs/Makefile.com
84
85SRCDIR =	../common
86ELFCAP=		$(SRC)/common/elfcap
87
88
89# Location of the shared relocation engines maintained under usr/src/uts.
90#
91KRTLD_I386 = $(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld
92KRTLD_AMD64 = $(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld
93KRTLD_SPARC = $(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld
94
95
96CPPFLAGS +=	-DUSE_LIBLD_MALLOC -I$(SRCBASE)/lib/libc/inc \
97		    -I$(SRCBASE)/uts/common/krtld -I$(ELFCAP) \
98		    -I$(SRCBASE)/uts/sparc \
99		    $(VAR_LIBLD_CPPFLAGS)
100LDLIBS +=	$(CONVLIBDIR) $(CONV_LIB) $(LDDBGLIBDIR) $(LDDBG_LIB) \
101		    $(ELFLIBDIR) -lelf $(DLLIB) -lc
102
103LINTFLAGS +=	-u -D_REENTRANT
104LINTFLAGS64 +=	-u -D_REENTRANT
105
106DYNFLAGS +=	$(VERSREF) $(USE_PROTO) '-R$$ORIGIN'
107
108native:=	DYNFLAGS	+= $(CONVLIBDIR)
109
110BLTDEFS =	msg.h
111BLTDATA =	msg.c
112BLTMESG =	$(SGSMSGDIR)/libld
113
114BLTFILES =	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
115
116# Due to cross linking support, every copy of libld contains every message.
117# However, we keep target specific messages in their own separate files for
118# organizational reasons.
119#
120SGSMSGCOM =	../common/libld.msg
121SGSMSGSPARC =	../common/libld.sparc.msg
122SGSMSGINTEL =	../common/libld.intel.msg
123SGSMSGTARG =	$(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL)
124SGSMSGALL =	$(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL)
125
126SGSMSGFLAGS1 =	$(SGSMSGFLAGS) -m $(BLTMESG)
127SGSMSGFLAGS2 =	$(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n libld_msg
128
129CHKSRCS =	$(SRCBASE)/uts/common/krtld/reloc.h \
130		$(COMOBJS32:%32.o=../common/%.c) \
131		$(L_MACHOBJS32:%32.o=../common/%.c) \
132		$(L_MACHOBJS64:%64.o=../common/%.c) \
133		$(KRTLD_I386)/doreloc.c \
134		$(KRTLD_AMD64)/doreloc.c \
135		$(KRTLD_SPARC)/doreloc.c
136
137SRCS =		../common/llib-lld
138LIBSRCS =	$(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
139		$(E_TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \
140		$(COMOBJS:%.o=../common/%.c) \
141		$(AVLOBJS:%.o=$(VAR_AVLDIR)/%.c) \
142		$(BLTDATA)
143
144LINTSRCS =	$(LIBSRCS) ../common/lintsup.c
145LINTSRCS32 =	$(COMOBJS32:%32.o=../common/%.c) \
146		$(L_MACHOBJS32:%32.o=../common/%.c)
147LINTSRCS64 =	$(COMOBJS64:%64.o=../common/%.c) \
148		$(L_MACHOBJS64:%64.o=../common/%.c)
149
150# Add the shared relocation engine source files to the lint
151# sources and add the necessary command line options to lint them
152# correctly. Make can't derive the files since the source and object
153# names are not directly related
154$(LINTOUT32) :=	CPPFLAGS += -DDO_RELOC_LIBLD
155$(LINTOUT64) :=	CPPFLAGS += -DDO_RELOC_LIBLD -D_ELF64
156$(LINTLIB32) :=	CPPFLAGS += -DDO_RELOC_LIBLD
157$(LINTLIB64) :=	CPPFLAGS += -DDO_RELOC_LIBLD -D_ELF64
158LINTSRCS32 +=	$(KRTLD_I386)/doreloc.c	\
159		$(KRTLD_SPARC)/doreloc.c
160LINTSRCS64 +=	$(KRTLD_AMD64)/doreloc.c \
161		$(KRTLD_SPARC)/doreloc.c
162
163CLEANFILES +=	$(LINTOUTS) $(BLTFILES)
164CLOBBERFILES +=	$(DYNLIB) $(LINTLIBS) $(LIBLINKS)
165
166ROOTFS_DYNLIB =	$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
167