17c478bd9Sstevel@tonic-gate# 27c478bd9Sstevel@tonic-gate# CDDL HEADER START 37c478bd9Sstevel@tonic-gate# 47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 55aefb655Srie# Common Development and Distribution License (the "License"). 65aefb655Srie# You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate# 87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate# and limitations under the License. 127c478bd9Sstevel@tonic-gate# 137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate# 197c478bd9Sstevel@tonic-gate# CDDL HEADER END 207c478bd9Sstevel@tonic-gate# 217c478bd9Sstevel@tonic-gate# 22f6acbf7cSrie# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate# Use is subject to license terms. 247c478bd9Sstevel@tonic-gate# 257c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 267c478bd9Sstevel@tonic-gate# 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gateLIBRARY = libld.a 295aefb655SrieVERS = .4 307c478bd9Sstevel@tonic-gate 315aefb655SrieCOMOBJS = debug.o globals.o util.o 325aefb655Srie 335aefb655SrieCOMOBJS32 = args32.o entry32.o exit32.o groups32.o \ 34*ba2be530Sab196087 ldentry32.o ldlibs32.o ldmachdep32.o ldmain32.o \ 35*ba2be530Sab196087 libs32.o files32.o map32.o order32.o \ 36*ba2be530Sab196087 outfile32.o place32.o relocate32.o resolve32.o \ 37*ba2be530Sab196087 sections32.o sunwmove32.o support32.o syms32.o \ 38*ba2be530Sab196087 update32.o version32.o 395aefb655Srie 405aefb655SrieCOMOBJS64 = args64.o entry64.o exit64.o groups64.o \ 41*ba2be530Sab196087 ldentry64.o ldlibs64.o ldmachdep64.o ldmain64.o \ 42*ba2be530Sab196087 libs64.o files64.o map64.o order64.o \ 43*ba2be530Sab196087 outfile64.o place64.o relocate64.o resolve64.o \ 44*ba2be530Sab196087 sections64.o sunwmove64.o support64.o syms64.o \ 45*ba2be530Sab196087 update64.o version64.o 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gateTOOLOBJS = alist.o assfail.o findprime.o string_table.o \ 487c478bd9Sstevel@tonic-gate strhash.o 497c478bd9Sstevel@tonic-gateAVLOBJ = avl.o 505aefb655Srie 51*ba2be530Sab196087# Relocation engine objects. These are kept separate from the L_XXX_MACHOBJS 52*ba2be530Sab196087# lists below in order to facilitate linting them. 53*ba2be530Sab196087G_MACHOBJS32 = doreloc_sparc_32.o doreloc_x86_32.o 54*ba2be530Sab196087G_MACHOBJS64 = doreloc_sparc_64.o doreloc_x86_64.o 55*ba2be530Sab196087 56*ba2be530Sab196087# Target specific objects (sparc/sparcv9) 57*ba2be530Sab196087L_SPARC_MACHOBJS32 = machrel.sparc32.o machsym.sparc32.o 58*ba2be530Sab196087L_SPARC_MACHOBJS64 = machrel.sparc64.o machsym.sparc64.o 59*ba2be530Sab196087 60*ba2be530Sab196087# Target specific objects (i386/amd64) 61*ba2be530Sab196087E_X86_TOOLOBJS = leb128.o 62*ba2be530Sab196087L_X86_MACHOBJS32 = machrel.intel32.o 63*ba2be530Sab196087L_X86_MACHOBJS64 = machrel.amd64.o unwind.amd64.o 64*ba2be530Sab196087 65*ba2be530Sab196087 66*ba2be530Sab196087# All target specific objects rolled together 67*ba2be530Sab196087E_TOOLOBJS = $(E_SPARC_TOOLOBJS) \ 68*ba2be530Sab196087 $(E_X86_TOOLOBJS) 69*ba2be530Sab196087L_MACHOBJS32 = $(L_SPARC_MACHOBJS32) \ 70*ba2be530Sab196087 $(L_X86_MACHOBJS32) 71*ba2be530Sab196087L_MACHOBJS64 = $(L_SPARC_MACHOBJS64) \ 72*ba2be530Sab196087 $(L_X86_MACHOBJS64) 73*ba2be530Sab196087 74*ba2be530Sab196087 755aefb655Srie 767c478bd9Sstevel@tonic-gateBLTOBJ = msg.o 777c478bd9Sstevel@tonic-gateELFCAPOBJ = elfcap.o 787c478bd9Sstevel@tonic-gate 795aefb655SrieOBJECTS = $(BLTOBJ) $(G_MACHOBJS32) $(G_MACHOBJS64) \ 805aefb655Srie $(L_MACHOBJS32) $(L_MACHOBJS64) \ 815aefb655Srie $(COMOBJS) $(COMOBJS32) $(COMOBJS64) \ 825aefb655Srie $(TOOLOBJS) $(E_TOOLOBJS) $(AVLOBJ) $(ELFCAPOBJ) 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gateinclude $(SRC)/lib/Makefile.lib 857c478bd9Sstevel@tonic-gateinclude $(SRC)/cmd/sgs/Makefile.com 867c478bd9Sstevel@tonic-gate 87f808c858SrafSRCDIR = ../common 887c478bd9Sstevel@tonic-gateELFCAP= $(SRC)/common/elfcap 897c478bd9Sstevel@tonic-gate 90*ba2be530Sab196087 91*ba2be530Sab196087# Location of the shared relocation engines maintained under usr/src/uts. 92*ba2be530Sab196087# 93*ba2be530Sab196087KRTLD_I386 = $(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld 94*ba2be530Sab196087KRTLD_AMD64 = $(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld 95*ba2be530Sab196087KRTLD_SPARC = $(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld 96*ba2be530Sab196087 97*ba2be530Sab196087 987c478bd9Sstevel@tonic-gate# Building SUNWonld results in a call to the `package' target. Requirements 997c478bd9Sstevel@tonic-gate# needed to run this application on older releases are established: 1007c478bd9Sstevel@tonic-gate# dlopen/dlclose requires libdl.so.1 prior to 5.10 1017c478bd9Sstevel@tonic-gate# 1027c478bd9Sstevel@tonic-gateDLLIB = $(VAR_DL_LIB) 1037c478bd9Sstevel@tonic-gatepackage := DLLIB = $(VAR_PKG_DL_LIB) 1047c478bd9Sstevel@tonic-gate 10510a4fa49SrieCPPFLAGS += -DUSE_LIBLD_MALLOC -I$(SRCBASE)/lib/libc/inc \ 10610a4fa49Srie -I$(SRCBASE)/uts/common/krtld -I$(ELFCAP) \ 107986fd29aSsetje -I$(SRCBASE)/uts/sparc \ 108*ba2be530Sab196087 $(VAR_LIBLD_CPPFLAGS) 1095aefb655SrieLDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(LDDBGLIBDIR) $(LDDBG_LIB) \ 1105aefb655Srie $(ELFLIBDIR) -lelf $(DLLIB) -lc 1115aefb655Srie 1125aefb655SrieLINTFLAGS += -u -D_REENTRANT 1135aefb655SrieLINTFLAGS64 += -u -D_REENTRANT 1145aefb655Srie 115f6acbf7cSrieDYNFLAGS += $(VERSREF) $(ZLAZYLOAD) $(USE_PROTO) '-R$$ORIGIN' 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate$(VAR_POUND_3)DEFS= 1187c478bd9Sstevel@tonic-gatenative:= DYNFLAGS += $(CONVLIBDIR) 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gateBLTDEFS = msg.h 1217c478bd9Sstevel@tonic-gateBLTDATA = msg.c 1227c478bd9Sstevel@tonic-gateBLTMESG = $(SGSMSGDIR)/libld 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gateBLTFILES = $(BLTDEFS) $(BLTDATA) $(BLTMESG) 1257c478bd9Sstevel@tonic-gate 126*ba2be530Sab196087# Due to cross linking support, every copy of libld contains every message. 127*ba2be530Sab196087# However, we keep target specific messages in their own separate files for 128*ba2be530Sab196087# organizational reasons. 129*ba2be530Sab196087# 1307c478bd9Sstevel@tonic-gateSGSMSGCOM = ../common/libld.msg 1317c478bd9Sstevel@tonic-gateSGSMSGSPARC = ../common/libld.sparc.msg 1327c478bd9Sstevel@tonic-gateSGSMSGINTEL = ../common/libld.intel.msg 133*ba2be530Sab196087SGSMSGTARG = $(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL) 1347c478bd9Sstevel@tonic-gateSGSMSGALL = $(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL) 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gateSGSMSGFLAGS1 = $(SGSMSGFLAGS) -m $(BLTMESG) 1377c478bd9Sstevel@tonic-gateSGSMSGFLAGS2 = $(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n libld_msg 1387c478bd9Sstevel@tonic-gate 1395aefb655SrieCHKSRCS = $(SRCBASE)/uts/common/krtld/reloc.h \ 1405aefb655Srie $(COMOBJS32:%32.o=../common/%.c) \ 1415aefb655Srie $(L_MACHOBJS32:%32.o=../common/%.c) \ 142*ba2be530Sab196087 $(L_MACHOBJS64:%64.o=../common/%.c) \ 143*ba2be530Sab196087 $(KRTLD_I386)/doreloc.c \ 144*ba2be530Sab196087 $(KRTLD_AMD64)/doreloc.c \ 145*ba2be530Sab196087 $(KRTLD_SPARC)/doreloc.c 1465aefb655Srie 1477c478bd9Sstevel@tonic-gateSRCS = ../common/llib-lld 1487c478bd9Sstevel@tonic-gateLIBSRCS = $(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \ 1495aefb655Srie $(E_TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \ 1505aefb655Srie $(COMOBJS:%.o=../common/%.c) \ 1517c478bd9Sstevel@tonic-gate $(AVLOBJS:%.o=$(VAR_AVLDIR)/%.c) \ 1525aefb655Srie $(BLTDATA) 1537c478bd9Sstevel@tonic-gate 1545aefb655SrieLINTSRCS = $(LIBSRCS) ../common/lintsup.c 1555aefb655SrieLINTSRCS32 = $(COMOBJS32:%32.o=../common/%.c) \ 1565aefb655Srie $(L_MACHOBJS32:%32.o=../common/%.c) 1575aefb655SrieLINTSRCS64 = $(COMOBJS64:%64.o=../common/%.c) \ 1585aefb655Srie $(L_MACHOBJS64:%64.o=../common/%.c) 1597c478bd9Sstevel@tonic-gate 160*ba2be530Sab196087# Add the shared relocation engine source files to the lint 161*ba2be530Sab196087# sources and add the necessary command line options to lint them 162*ba2be530Sab196087# correctly. Make can't derive the files since the source and object 163*ba2be530Sab196087# names are not directly related 164*ba2be530Sab196087$(LINTOUT32) := CPPFLAGS += -DDO_RELOC_LIBLD 165*ba2be530Sab196087$(LINTOUT64) := CPPFLAGS += -DDO_RELOC_LIBLD -D_ELF64 166*ba2be530Sab196087$(LINTLIB32) := CPPFLAGS += -DDO_RELOC_LIBLD 167*ba2be530Sab196087$(LINTLIB64) := CPPFLAGS += -DDO_RELOC_LIBLD -D_ELF64 168*ba2be530Sab196087LINTSRCS32 += $(KRTLD_I386)/doreloc.c \ 169*ba2be530Sab196087 $(KRTLD_SPARC)/doreloc.c 170*ba2be530Sab196087LINTSRCS64 += $(KRTLD_AMD64)/doreloc.c \ 171*ba2be530Sab196087 $(KRTLD_SPARC)/doreloc.c 172*ba2be530Sab196087 1737c478bd9Sstevel@tonic-gateCLEANFILES += $(LINTOUTS) $(BLTFILES) 1747c478bd9Sstevel@tonic-gateCLOBBERFILES += $(DYNLIB) $(LINTLIBS) $(LIBLINKS) 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gateROOTFS_DYNLIB = $(DYNLIB:%=$(ROOTFS_LIBDIR)/%) 177