1628e3cbeSEdward Pilatowicz# 2628e3cbeSEdward Pilatowicz# CDDL HEADER START 3628e3cbeSEdward Pilatowicz# 4628e3cbeSEdward Pilatowicz# The contents of this file are subject to the terms of the 5628e3cbeSEdward Pilatowicz# Common Development and Distribution License (the "License"). 6628e3cbeSEdward Pilatowicz# You may not use this file except in compliance with the License. 7628e3cbeSEdward Pilatowicz# 8628e3cbeSEdward Pilatowicz# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9628e3cbeSEdward Pilatowicz# or http://www.opensolaris.org/os/licensing. 10628e3cbeSEdward Pilatowicz# See the License for the specific language governing permissions 11628e3cbeSEdward Pilatowicz# and limitations under the License. 12628e3cbeSEdward Pilatowicz# 13628e3cbeSEdward Pilatowicz# When distributing Covered Code, include this CDDL HEADER in each 14628e3cbeSEdward Pilatowicz# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15628e3cbeSEdward Pilatowicz# If applicable, add the following below this CDDL HEADER, with the 16628e3cbeSEdward Pilatowicz# fields enclosed by brackets "[]" replaced with your own identifying 17628e3cbeSEdward Pilatowicz# information: Portions Copyright [yyyy] [name of copyright owner] 18628e3cbeSEdward Pilatowicz# 19628e3cbeSEdward Pilatowicz# CDDL HEADER END 20628e3cbeSEdward Pilatowicz# 21628e3cbeSEdward Pilatowicz# 2280e2ca85S# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 23f3655454SJohn Levon# Copyright 2020 Joyent, Inc. 24628e3cbeSEdward Pilatowicz# 25628e3cbeSEdward Pilatowicz 26628e3cbeSEdward PilatowiczLIBRARY = sn1_brand.a 27628e3cbeSEdward PilatowiczVERS = .1 28628e3cbeSEdward PilatowiczCOBJS = sn1_brand.o 2980e2ca85SASOBJS = crt.o handler.o runexe.o brand_util.o 3080e2ca85SOBJECTS = $(COBJS) 31628e3cbeSEdward Pilatowicz 32628e3cbeSEdward Pilatowiczinclude ../../Makefile.sn1 33628e3cbeSEdward Pilatowiczinclude $(SRC)/lib/Makefile.lib 34628e3cbeSEdward Pilatowicz 35628e3cbeSEdward PilatowiczSRCDIR = ../common 36628e3cbeSEdward PilatowiczUTSBASE = $(SRC)/uts 37628e3cbeSEdward Pilatowicz 38628e3cbeSEdward PilatowiczLIBS = $(DYNLIB) 39628e3cbeSEdward PilatowiczCSRCS = $(COBJS:%o=../common/%c) 4080e2ca85SSHAREDOBJS = $(ASOBJS:%o=$(ISAOBJDIR)/%o) 4180e2ca85SSRCS = $(CSRCS) 42628e3cbeSEdward Pilatowicz 43628e3cbeSEdward Pilatowicz# 44628e3cbeSEdward Pilatowicz# Note that the architecture specific makefiles MUST update DYNFLAGS to 45628e3cbeSEdward Pilatowicz# explicily specify an interpreter for the brand emulation library. 46628e3cbeSEdward Pilatowicz# Normally this would be the native linker, /.SUNWnative/usr/lib/ld.so.1 47628e3cbeSEdward Pilatowicz# or /.SUNWnative/usr/lib/64/ld.so.1. 48628e3cbeSEdward Pilatowicz# 49628e3cbeSEdward Pilatowicz# Note that we make sure to link our brand emulation library 50628e3cbeSEdward Pilatowicz# libmapmalloc. This is required because in most cases there will be two 51628e3cbeSEdward Pilatowicz# copies of libc in the same process and we don't want them to fight over 52628e3cbeSEdward Pilatowicz# the heap. So for our brand library we link against libmapmalloc so that 53628e3cbeSEdward Pilatowicz# if we (our or copy of libc) try to allocate any memory it will be done 54628e3cbeSEdward Pilatowicz# via mmap() instead of brk(). 55628e3cbeSEdward Pilatowicz# 56628e3cbeSEdward Pilatowicz# XXX: Note that we also set the runtime path for the emulation library to 57628e3cbeSEdward Pilatowicz# point into /.SUNWnative/. This ensures that our brand library get's the 58628e3cbeSEdward Pilatowicz# native versions of any libraries it needs. Unfortunatly this is a total 59628e3cbeSEdward Pilatowicz# hack since it doesn't work for suid binaries. What we really need to do 60628e3cbeSEdward Pilatowicz# is enhance the linker so that when it's running on a brand linkmap it 61628e3cbeSEdward Pilatowicz# looks for all libraries in the brands "native" directory (for both 62628e3cbeSEdward Pilatowicz# regular and suid binaries). 63628e3cbeSEdward Pilatowicz# 64628e3cbeSEdward PilatowiczNATIVE_DIR = /.SUNWnative 6580e2ca85SCPPFLAGS += -D_REENTRANT -U_ASM \ 6680e2ca85S -I. -I$(BRAND_SHARED)/brand/sys -I$(UTSBASE)/common/brand/sn1 67628e3cbeSEdward PilatowiczCFLAGS += $(CCVERBOSE) 68628e3cbeSEdward PilatowiczDYNFLAGS += $(DYNFLAGS_$(CLASS)) 69628e3cbeSEdward PilatowiczDYNFLAGS += $(BLOCAL) $(ZNOVERSION) -Wl,-e_start 70628e3cbeSEdward Pilatowicz#DYNFLAGS += -R$(NATIVE_DIR)/lib -R$(NATIVE_DIR)/usr/lib 71f3655454SJohn LevonLDLIBS += -lmapmalloc -lc 72628e3cbeSEdward Pilatowicz 73*85f4cb87SRichard LoweZGUIDANCE = -Wl,-zguidance=nounused 7480e2ca85S$(LIBS):= PICS += $(SHAREDOBJS) 7580e2ca85S 76628e3cbeSEdward Pilatowicz.KEEP_STATE: 77628e3cbeSEdward Pilatowicz 78628e3cbeSEdward Pilatowiczall: $(LIBS) 79628e3cbeSEdward Pilatowicz 80628e3cbeSEdward Pilatowicz 81628e3cbeSEdward Pilatowiczinclude $(SRC)/lib/Makefile.targ 82