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# 2108278a5eSRod Evans 227c478bd9Sstevel@tonic-gate# 23cd3e9333SAli Bahrami# Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. 245661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc. 25cf9a187cSAndy Fiddaman# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. 26cf9a187cSAndy Fiddaman# 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gateRTLD= ld.so.1 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gateAVLOBJ= avl.o 31e127a3e7SrafDTROBJ= dtrace_data.o 3269b1fd3fSRichard LoweSGSCOMMONOBJ= alist.o strhash.o 337c478bd9Sstevel@tonic-gateBLTOBJ= msg.o 3408278a5eSRod EvansELFCAPOBJ= elfcap.o 357c478bd9Sstevel@tonic-gateOBJECTS= $(BLTOBJ) \ 367c478bd9Sstevel@tonic-gate $(AVLOBJ) \ 37e127a3e7Sraf $(DTROBJ) \ 3869b1fd3fSRichard Lowe $(SGSCOMMONOBJ) \ 3908278a5eSRod Evans $(ELFCAPOBJ) \ 407c478bd9Sstevel@tonic-gate $(P_ASOBJS) $(P_COMOBJS) $(P_MACHOBJS) $(G_MACHOBJS) \ 417c478bd9Sstevel@tonic-gate $(S_ASOBJS) $(S_COMOBJS) $(S_MACHOBJS) $(CP_MACHOBJS) 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gateCOMOBJS= $(P_COMOBJS) $(S_COMOBJS) 447c478bd9Sstevel@tonic-gateASOBJS= $(P_ASOBJS) $(S_ASOBJS) 457c478bd9Sstevel@tonic-gateMACHOBJS= $(P_MACHOBJS) $(S_MACHOBJS) 467c478bd9Sstevel@tonic-gateNOCTFOBJS= $(ASOBJS) 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gateinclude $(SRC)/lib/Makefile.lib 497c478bd9Sstevel@tonic-gateinclude $(SRC)/cmd/sgs/Makefile.com 505aefb655Srie 51f808c858SrafSRCDIR = ../common 5208278a5eSRod EvansELFCAP = $(SRC)/common/elfcap 53e9db39ceSRichard Lowe 54e9db39ceSRichard LowePLAT_i386 = intel/ia32 55e9db39ceSRichard LowePLAT_amd64 = intel/amd64 56e9db39ceSRichard LowePLAT_sparc = sparc 57e9db39ceSRichard LowePLAT = $(PLAT_$(BASEPLAT)) 587c478bd9Sstevel@tonic-gate 59e127a3e7Sraf# DTrace needs an executable data segment. 6024da5b34SrieMAPFILE.NED= 617c478bd9Sstevel@tonic-gate 62cd3e9333SAli BahramiMAPFILES += $(MAPFILE-ORDER) 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate# For the libc/libthread unified world: 657c478bd9Sstevel@tonic-gate# This library needs to be placed in /lib to allow 667c478bd9Sstevel@tonic-gate# dlopen() functionality while in single-user mode. 677c478bd9Sstevel@tonic-gateROOTFS_DYNLIB= $(RTLD:%=$(ROOTFS_LIBDIR)/%) 687c478bd9Sstevel@tonic-gateROOTFS_DYNLIB64= $(RTLD:%=$(ROOTFS_LIBDIR64)/%) 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate# For the libc/libthread separated world: 717c478bd9Sstevel@tonic-gate# A version of this library needs to be placed in /etc/lib to allow 727c478bd9Sstevel@tonic-gate# dlopen() functionality while in single-user mode. 737c478bd9Sstevel@tonic-gateETCLIBDIR= $(ROOT)/etc/lib 747c478bd9Sstevel@tonic-gateETCDYNLIB= $(RTLD:%=$(ETCLIBDIR)/%) 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gateROOTDYNLIB= $(RTLD:%=$(ROOTFS_LIBDIR)/%) 777c478bd9Sstevel@tonic-gateROOTDYNLIB64= $(RTLD:%=$(ROOTFS_LIBDIR64)/%) 787c478bd9Sstevel@tonic-gate 79cd61ae21SRichard LoweCOMPATLINKS= etc/lib/ld.so.1 \ 80cd61ae21SRichard Lowe usr/lib/ld.so.1 81cd61ae21SRichard LoweCOMPATLINKS64= usr/lib/$(MACH64)/ld.so.1 82cd61ae21SRichard Lowe 83cd61ae21SRichard Lowe$(ROOT)/etc/lib/ld.so.1 := COMPATLINKTARGET= ../../lib/ld.so.1 84cd61ae21SRichard Lowe$(ROOT)/usr/lib/ld.so.1 := COMPATLINKTARGET= ../../lib/ld.so.1 85cd61ae21SRichard Lowe$(ROOT)/usr/lib/$(MACH64)/ld.so.1 := \ 86cd61ae21SRichard Lowe COMPATLINKTARGET= ../../../lib/$(MACH64)/ld.so.1 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gateFILEMODE = 755 897c478bd9Sstevel@tonic-gate 9069b1fd3fSRichard LoweCPPFLAGS += -I$(SRC)/lib/libc/inc \ 9169b1fd3fSRichard Lowe -I$(SRC)/uts/common/krtld \ 9269b1fd3fSRichard Lowe -I$(SRC)/uts/$(PLAT) \ 9369b1fd3fSRichard Lowe -I$(SRC)/uts/$(PLAT)/krtld \ 94c13de8f6Sab -I$(SRC)/common/sgsrtcid \ 9508278a5eSRod Evans -I$(ELFCAP) \ 96c13de8f6Sab $(CPPFEATUREMACROS) 97c13de8f6Sab 98*5d9d9091SRichard LoweASFLAGS += -D_ASM $(CPPFLAGS) 99*5d9d9091SRichard LoweASFLAGS64 += -D_ASM $(CPPFLAGS) 1007c478bd9Sstevel@tonic-gateLDLIB = -L ../../libld/$(MACH) 1017c478bd9Sstevel@tonic-gateRTLDLIB = -L ../../librtld/$(MACH) 1027c478bd9Sstevel@tonic-gate 103d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT) 1047014882cSRichard Lowe 1055661bb76SJohn Levon# not linted 1065661bb76SJohn LevonSMATCH=off 1075661bb76SJohn Levon 1087c478bd9Sstevel@tonic-gate# These definitions require that libc be built in the same workspace 1097c478bd9Sstevel@tonic-gate# as the run-time linker and before the run-time linker is built. 1107c478bd9Sstevel@tonic-gate# This is required for the system's self-consistency in any case. 111e9db39ceSRichard LoweCPICLIB = -L $(SRC)/lib/libc/$(MACH) 112e9db39ceSRichard LoweCPICLIB64 = -L $(SRC)/lib/libc/$(MACH64) 1137c478bd9Sstevel@tonic-gateCLIB = -lc_pic 1147c478bd9Sstevel@tonic-gate 11569b1fd3fSRichard LoweLDLIBS += $(CONVLIBDIR) -lconv \ 1167c478bd9Sstevel@tonic-gate $(CPICLIB) $(CLIB) \ 11769b1fd3fSRichard Lowe $(LDDBGLIBDIR) -llddbg \ 1185aefb655Srie $(RTLDLIB) -lrtld \ 11969b1fd3fSRichard Lowe $(LDLIB) -lld 1207c478bd9Sstevel@tonic-gate 12167e3a03eSrieDYNFLAGS += -i -e _rt_boot $(VERSREF) $(ZNODLOPEN) \ 1229a411307Srie $(ZINTERPOSE) -zdtrace=dtrace_data '-R$$ORIGIN' 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gateBLTDEFS= msg.h 1257c478bd9Sstevel@tonic-gateBLTDATA= msg.c 1267c478bd9Sstevel@tonic-gateBLTMESG= $(SGSMSGDIR)/rtld 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gateBLTFILES= $(BLTDEFS) $(BLTDATA) $(BLTMESG) 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gateSGSMSGCOM= ../common/rtld.msg 1317c478bd9Sstevel@tonic-gateSGSMSG32= ../common/rtld.32.msg 1327c478bd9Sstevel@tonic-gateSGSMSG64= ../common/rtld.64.msg 1337c478bd9Sstevel@tonic-gateSGSMSGSPARC= ../common/rtld.sparc.msg 1347c478bd9Sstevel@tonic-gateSGSMSGSPARC32= ../common/rtld.sparc32.msg 1357c478bd9Sstevel@tonic-gateSGSMSGSPARC64= ../common/rtld.sparc64.msg 1367c478bd9Sstevel@tonic-gateSGSMSGINTEL= ../common/rtld.intel.msg 1377c478bd9Sstevel@tonic-gateSGSMSGINTEL32= ../common/rtld.intel32.msg 1387c478bd9Sstevel@tonic-gateSGSMSGINTEL64= ../common/rtld.intel64.msg 1397c478bd9Sstevel@tonic-gateSGSMSGCHK= ../common/rtld.chk.msg 1407c478bd9Sstevel@tonic-gateSGSMSGTARG= $(SGSMSGCOM) 1417c478bd9Sstevel@tonic-gateSGSMSGALL= $(SGSMSGCOM) $(SGSMSG32) $(SGSMSG64) \ 1427c478bd9Sstevel@tonic-gate $(SGSMSGSPARC) $(SGSMSGSPARC32) $(SGSMSGSPARC64) \ 1437c478bd9Sstevel@tonic-gate $(SGSMSGINTEL) $(SGSMSGINTEL32) $(SGSMSGINTEL64) 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gateSGSMSGFLAGS1= $(SGSMSGFLAGS) -m $(BLTMESG) 1467c478bd9Sstevel@tonic-gateSGSMSGFLAGS2= $(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n rtld_msg 1477c478bd9Sstevel@tonic-gate 148e9db39ceSRichard LoweSRCS= $(AVLOBJ:%.o=$(SRC)/common/avl/%.c) \ 149e9db39ceSRichard Lowe $(DTROBJ:%.o=$(SRC)/common/dtrace/%.c) \ 15069b1fd3fSRichard Lowe $(SGSCOMMONOBJ:%.o=$(SGSCOMMON)/%.c) \ 1517c478bd9Sstevel@tonic-gate $(COMOBJS:%.o=../common/%.c) $(MACHOBJS:%.o=%.c) $(BLTDATA) \ 15269b1fd3fSRichard Lowe $(G_MACHOBJS:%.o=$(SRC)/uts/$(PLAT)/krtld/%.c) \ 1537c478bd9Sstevel@tonic-gate $(CP_MACHOBJS:%.o=../$(MACH)/%.c) \ 154*5d9d9091SRichard Lowe $(ASOBJS:%.o=%.S) 1557c478bd9Sstevel@tonic-gate 156cf9a187cSAndy FiddamanCLEANFILES += $(CRTS) $(BLTFILES) 1577c478bd9Sstevel@tonic-gateCLOBBERFILES += $(RTLD) 1585a0af816SRobert Mustacchi 1595a0af816SRobert Mustacchi# 1605a0af816SRobert Mustacchi# We cannot currently enable the stack protector for rtld as it runs 1615a0af816SRobert Mustacchi# before libc initializes, which is where we always enable the stack 1625a0af816SRobert Mustacchi# protector values. Because rtld is likely on an alternate link map and 1635a0af816SRobert Mustacchi# links in the relevant portions of libc through libc_pic.a, there is 1645a0af816SRobert Mustacchi# probably a path to enabling an rtld specific version of the stack 1655a0af816SRobert Mustacchi# protector. 1665a0af816SRobert Mustacchi# 1675a0af816SRobert Mustacchi# As a result, this currently disables the stack protector in two 1685a0af816SRobert Mustacchi# related targets which really could use it. These are libconv and libc. 1695a0af816SRobert Mustacchi# Both of these end up building position-independent archive libraries 1705a0af816SRobert Mustacchi# that are directly linked into rtld. This situation can and should be 1715a0af816SRobert Mustacchi# improved. 1725a0af816SRobert Mustacchi# 1735a0af816SRobert MustacchiSTACKPROTECT = none 174