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 (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. 24# Copyright (c) 2018, Joyent, Inc. 25# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. 26# 27 28RTLD= ld.so.1 29 30AVLOBJ= avl.o 31DTROBJ= dtrace_data.o 32SGSCOMMONOBJ= alist.o strhash.o 33BLTOBJ= msg.o 34ELFCAPOBJ= elfcap.o 35OBJECTS= $(BLTOBJ) \ 36 $(AVLOBJ) \ 37 $(DTROBJ) \ 38 $(SGSCOMMONOBJ) \ 39 $(ELFCAPOBJ) \ 40 $(P_ASOBJS) $(P_COMOBJS) $(P_MACHOBJS) $(G_MACHOBJS) \ 41 $(S_ASOBJS) $(S_COMOBJS) $(S_MACHOBJS) $(CP_MACHOBJS) 42 43COMOBJS= $(P_COMOBJS) $(S_COMOBJS) 44ASOBJS= $(P_ASOBJS) $(S_ASOBJS) 45MACHOBJS= $(P_MACHOBJS) $(S_MACHOBJS) 46NOCTFOBJS= $(ASOBJS) 47 48include $(SRC)/lib/Makefile.lib 49include $(SRC)/cmd/sgs/Makefile.com 50 51SRCDIR = ../common 52ELFCAP = $(SRC)/common/elfcap 53PLAT = $(VAR_PLAT_$(BASEPLAT)) 54 55# DTrace needs an executable data segment. 56MAPFILE.NED= 57 58MAPFILES += $(MAPFILE-ORDER) 59 60# For the libc/libthread unified world: 61# This library needs to be placed in /lib to allow 62# dlopen() functionality while in single-user mode. 63ROOTFS_DYNLIB= $(RTLD:%=$(ROOTFS_LIBDIR)/%) 64ROOTFS_DYNLIB64= $(RTLD:%=$(ROOTFS_LIBDIR64)/%) 65 66# For the libc/libthread separated world: 67# A version of this library needs to be placed in /etc/lib to allow 68# dlopen() functionality while in single-user mode. 69ETCLIBDIR= $(ROOT)/etc/lib 70ETCDYNLIB= $(RTLD:%=$(ETCLIBDIR)/%) 71 72ROOTDYNLIB= $(RTLD:%=$(ROOTFS_LIBDIR)/%) 73ROOTDYNLIB64= $(RTLD:%=$(ROOTFS_LIBDIR64)/%) 74 75COMPATLINKS= etc/lib/ld.so.1 \ 76 usr/lib/ld.so.1 77COMPATLINKS64= usr/lib/$(MACH64)/ld.so.1 78 79$(ROOT)/etc/lib/ld.so.1 := COMPATLINKTARGET= ../../lib/ld.so.1 80$(ROOT)/usr/lib/ld.so.1 := COMPATLINKTARGET= ../../lib/ld.so.1 81$(ROOT)/usr/lib/$(MACH64)/ld.so.1 := \ 82 COMPATLINKTARGET= ../../../lib/$(MACH64)/ld.so.1 83 84FILEMODE = 755 85 86CPPFLAGS += -I$(SRC)/lib/libc/inc \ 87 -I$(SRC)/uts/common/krtld \ 88 -I$(SRC)/uts/$(PLAT) \ 89 -I$(SRC)/uts/$(PLAT)/krtld \ 90 -I$(SRC)/common/sgsrtcid \ 91 -I$(ELFCAP) \ 92 $(CPPFEATUREMACROS) 93 94ASFLAGS= -P -D_ASM $(CPPFLAGS) 95LDLIB = -L ../../libld/$(MACH) 96RTLDLIB = -L ../../librtld/$(MACH) 97 98CERRWARN += $(CNOWARN_UNINIT) 99CERRWARN += -_gcc=-Wno-unused-variable 100CERRWARN += -_gcc=-Wno-switch 101 102# not linted 103SMATCH=off 104 105# These definitions require that libc be built in the same workspace 106# as the run-time linker and before the run-time linker is built. 107# This is required for the system's self-consistency in any case. 108CPICLIB = $(VAR_RTLD_CPICLIB) 109CPICLIB64 = $(VAR_RTLD_CPICLIB64) 110CLIB = -lc_pic 111 112LDLIBS += $(CONVLIBDIR) -lconv \ 113 $(CPICLIB) $(CLIB) \ 114 $(LDDBGLIBDIR) -llddbg \ 115 $(RTLDLIB) -lrtld \ 116 $(LDLIB) -lld 117 118DYNFLAGS += -i -e _rt_boot $(VERSREF) $(ZNODLOPEN) \ 119 $(ZINTERPOSE) -zdtrace=dtrace_data '-R$$ORIGIN' 120 121BUILD.s= $(AS) $(ASFLAGS) $< -o $@ 122 123BLTDEFS= msg.h 124BLTDATA= msg.c 125BLTMESG= $(SGSMSGDIR)/rtld 126 127BLTFILES= $(BLTDEFS) $(BLTDATA) $(BLTMESG) 128 129SGSMSGCOM= ../common/rtld.msg 130SGSMSG32= ../common/rtld.32.msg 131SGSMSG64= ../common/rtld.64.msg 132SGSMSGSPARC= ../common/rtld.sparc.msg 133SGSMSGSPARC32= ../common/rtld.sparc32.msg 134SGSMSGSPARC64= ../common/rtld.sparc64.msg 135SGSMSGINTEL= ../common/rtld.intel.msg 136SGSMSGINTEL32= ../common/rtld.intel32.msg 137SGSMSGINTEL64= ../common/rtld.intel64.msg 138SGSMSGCHK= ../common/rtld.chk.msg 139SGSMSGTARG= $(SGSMSGCOM) 140SGSMSGALL= $(SGSMSGCOM) $(SGSMSG32) $(SGSMSG64) \ 141 $(SGSMSGSPARC) $(SGSMSGSPARC32) $(SGSMSGSPARC64) \ 142 $(SGSMSGINTEL) $(SGSMSGINTEL32) $(SGSMSGINTEL64) 143 144SGSMSGFLAGS1= $(SGSMSGFLAGS) -m $(BLTMESG) 145SGSMSGFLAGS2= $(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n rtld_msg 146 147SRCS= $(AVLOBJ:%.o=$(VAR_AVLDIR)/%.c) \ 148 $(DTROBJ:%.o=$(VAR_DTRDIR)/%.c) \ 149 $(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) \ 150 $(COMOBJS:%.o=../common/%.c) $(MACHOBJS:%.o=%.c) $(BLTDATA) \ 151 $(G_MACHOBJS:%.o=$(SRC)/uts/$(PLAT)/krtld/%.c) \ 152 $(CP_MACHOBJS:%.o=../$(MACH)/%.c) \ 153 $(ASOBJS:%.o=%.s) 154 155CLEANFILES += $(CRTS) $(BLTFILES) 156CLOBBERFILES += $(RTLD) 157