xref: /illumos-gate/usr/src/cmd/sgs/libld/Makefile.com (revision 38aced4fb3d60e34a44207b22d0b0dd4909bf4d1)
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# Copyright 2019 Joyent, Inc.
27# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
28
29LIBRARY =	libld.a
30VERS =		.4
31
32COMOBJS =	debug.o		globals.o	util.o
33
34COMOBJS32 =	args32.o	entry32.o	exit32.o	groups32.o \
35		ldentry32.o	ldlibs32.o	ldmachdep32.o	ldmain32.o \
36		libs32.o	files32.o	map32.o		map_core32.o \
37		map_support32.o	map_v232.o	order32.o	outfile32.o \
38		place32.o	relocate32.o	resolve32.o	sections32.o \
39		sunwmove32.o	support32.o	syms32.o	update32.o \
40		unwind32.o	version32.o	wrap32.o
41
42COMOBJS64 =	args64.o	entry64.o	exit64.o	groups64.o \
43		ldentry64.o	ldlibs64.o	ldmachdep64.o	ldmain64.o \
44		libs64.o	files64.o	map64.o		map_core64.o \
45		map_support64.o	map_v264.o	order64.o	outfile64.o \
46		place64.o	relocate64.o	resolve64.o	sections64.o \
47		sunwmove64.o	support64.o	syms64.o	update64.o \
48		unwind64.o	version64.o	wrap64.o
49
50SGSCOMMONOBJ =	alist.o		assfail.o	findprime.o	string_table.o \
51		strhash.o
52AVLOBJ =	avl.o
53
54# Relocation engine objects.
55G_MACHOBJS32 =	doreloc_sparc_32.o doreloc_x86_32.o
56G_MACHOBJS64 =	doreloc_sparc_64.o doreloc_x86_64.o
57
58# Target specific objects (sparc/sparcv9)
59L_SPARC_MACHOBJS32 =	machrel.sparc32.o	machsym.sparc32.o
60L_SPARC_MACHOBJS64 =	machrel.sparc64.o	machsym.sparc64.o
61
62# Target specific objects (i386/amd64)
63E_X86_COMMONOBJ =	leb128.o
64L_X86_MACHOBJS32 =	machrel.intel32.o
65L_X86_MACHOBJS64 =	machrel.amd64.o
66
67# All target specific objects rolled together
68E_COMMONOBJ =	$(E_SPARC_COMMONOBJ) \
69	$(E_X86_COMMONOBJ)
70L_MACHOBJS32 =	$(L_SPARC_MACHOBJS32) \
71	$(L_X86_MACHOBJS32)
72L_MACHOBJS64 =	$(L_SPARC_MACHOBJS64) \
73	$(L_X86_MACHOBJS64)
74
75
76BLTOBJ =	msg.o
77ELFCAPOBJ =	elfcap.o
78
79OBJECTS =	$(BLTOBJ) $(G_MACHOBJS32) $(G_MACHOBJS64) \
80		$(L_MACHOBJS32) $(L_MACHOBJS64) \
81		$(COMOBJS) $(COMOBJS32) $(COMOBJS64) \
82		$(SGSCOMMONOBJ) $(E_COMMONOBJ) $(AVLOBJ) $(ELFCAPOBJ)
83
84include		$(SRC)/lib/Makefile.lib
85include		$(SRC)/cmd/sgs/Makefile.com
86
87SRCDIR =	$(SGSHOME)/libld
88MAPFILEDIR =	$(SRCDIR)/common
89
90CERRWARN += -_gcc=-Wno-unused-value
91CERRWARN += -_gcc=-Wno-parentheses
92CERRWARN += $(CNOWARN_UNINIT)
93CERRWARN += -_gcc=-Wno-switch
94CERRWARN += -_gcc=-Wno-char-subscripts
95CERRWARN += -_gcc=-Wno-type-limits
96$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused
97
98SMOFF += no_if_block
99
100# Location of the shared relocation engines maintained under usr/src/uts.
101#
102KRTLD_I386 = $(SRC)/uts/intel/ia32/krtld
103KRTLD_AMD64 = $(SRC)/uts/intel/amd64/krtld
104KRTLD_SPARC = $(SRC)/uts/sparc/krtld
105
106
107CPPFLAGS +=	-DUSE_LIBLD_MALLOC -I$(SRC)/lib/libc/inc \
108		    -I$(SRC)/uts/common/krtld -I$(SRC)/uts/sparc \
109		    -I $(SRC)/uts/common
110LDLIBS +=	$(CONVLIBDIR) -lconv $(LDDBGLIBDIR) -llddbg \
111		    $(ELFLIBDIR) -lelf $(DLLIB) -lc
112
113DYNFLAGS +=	$(VERSREF) '-R$$ORIGIN'
114
115# too hairy
116pics/sections32.o :=	SMATCH=off
117pics/sections64.o :=	SMATCH=off
118# confused about our strange allocation choices
119pics/syms32.o :=	SMOFF += check_kmalloc_wrong_size
120pics/syms64.o :=	SMOFF += check_kmalloc_wrong_size
121pics/entry32.o :=	SMOFF += check_kmalloc_wrong_size
122pics/entry64.o :=	SMOFF += check_kmalloc_wrong_size
123pics/relocate32.o :=	SMOFF += check_kmalloc_wrong_size
124pics/relocate64.o :=	SMOFF += check_kmalloc_wrong_size
125
126BLTDEFS =	msg.h
127BLTDATA =	msg.c
128BLTMESG =	$(SGSMSGDIR)/libld
129
130BLTFILES =	$(BLTDEFS) $(BLTDATA) $(BLTMESG)
131
132# Due to cross linking support, every copy of libld contains every message.
133# However, we keep target specific messages in their own separate files for
134# organizational reasons.
135#
136SGSMSGCOM =	$(SRCDIR)/common/libld.msg
137SGSMSGSPARC =	$(SRCDIR)/common/libld.sparc.msg
138SGSMSGINTEL =	$(SRCDIR)/common/libld.intel.msg
139SGSMSGTARG =	$(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL)
140SGSMSGALL =	$(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL)
141
142SGSMSGFLAGS1 =	$(SGSMSGFLAGS) -m $(BLTMESG)
143SGSMSGFLAGS2 =	$(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n libld_msg
144
145CHKSRCS =	$(SRC)/uts/common/krtld/reloc.h \
146		$(COMOBJS32:%32.o=$(SRCDIR)/common/%.c) \
147		$(L_MACHOBJS32:%32.o=$(SRCDIR)/common/%.c) \
148		$(L_MACHOBJS64:%64.o=$(SRCDIR)/common/%.c) \
149		$(KRTLD_I386)/doreloc.c \
150		$(KRTLD_AMD64)/doreloc.c \
151		$(KRTLD_SPARC)/doreloc.c
152
153LIBSRCS =	$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) \
154		$(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) \
155		$(COMOBJS:%.o=$(SRCDIR)/common/%.c) \
156		$(AVLOBJS:%.o=$(SRC)/common/avl/%.c) \
157		$(BLTDATA)
158
159CLEANFILES +=	$(BLTFILES)
160CLOBBERFILES +=	$(DYNLIB) $(LIBLINKS)
161
162ROOTFS_DYNLIB =	$(DYNLIB:%=$(ROOTFS_LIBDIR)/%)
163