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