1e71ca95cSGerald Jelinek# 2e71ca95cSGerald Jelinek# CDDL HEADER START 3e71ca95cSGerald Jelinek# 4e71ca95cSGerald Jelinek# The contents of this file are subject to the terms of the 5e71ca95cSGerald Jelinek# Common Development and Distribution License (the "License"). 6e71ca95cSGerald Jelinek# You may not use this file except in compliance with the License. 7e71ca95cSGerald Jelinek# 8e71ca95cSGerald Jelinek# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9e71ca95cSGerald Jelinek# or http://www.opensolaris.org/os/licensing. 10e71ca95cSGerald Jelinek# See the License for the specific language governing permissions 11e71ca95cSGerald Jelinek# and limitations under the License. 12e71ca95cSGerald Jelinek# 13e71ca95cSGerald Jelinek# When distributing Covered Code, include this CDDL HEADER in each 14e71ca95cSGerald Jelinek# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15e71ca95cSGerald Jelinek# If applicable, add the following below this CDDL HEADER, with the 16e71ca95cSGerald Jelinek# fields enclosed by brackets "[]" replaced with your own identifying 17e71ca95cSGerald Jelinek# information: Portions Copyright [yyyy] [name of copyright owner] 18e71ca95cSGerald Jelinek# 19e71ca95cSGerald Jelinek# CDDL HEADER END 20e71ca95cSGerald Jelinek# 21e71ca95cSGerald Jelinek# 2280e2ca85S# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 234ba5b961SDan Kimmel# Copyright (c) 2016 by Delphix. All rights reserved. 24f3655454SJohn Levon# Copyright 2020 Joyent, Inc. 25e71ca95cSGerald Jelinek# 26e71ca95cSGerald Jelinek 27e71ca95cSGerald JelinekLIBRARY = s10_brand.a 28e71ca95cSGerald JelinekVERS = .1 29bdf0047cSRoger A. FaulknerCOBJS = s10_brand.o s10_deleted.o s10_signal.o 3080e2ca85SASOBJS = crt.o handler.o runexe.o brand_util.o 3180e2ca85SOBJECTS = $(COBJS) 32e71ca95cSGerald Jelinek 33e71ca95cSGerald Jelinekinclude ../../Makefile.s10 34e71ca95cSGerald Jelinekinclude $(SRC)/lib/Makefile.lib 35e71ca95cSGerald Jelinek 36e71ca95cSGerald JelinekSRCDIR = ../common 37e71ca95cSGerald JelinekUTSBASE = $(SRC)/uts 38e71ca95cSGerald Jelinek 39e71ca95cSGerald JelinekLIBS = $(DYNLIB) 40e71ca95cSGerald JelinekCSRCS = $(COBJS:%o=../common/%c) 4180e2ca85SSHAREDOBJS = $(ASOBJS:%o=$(ISAOBJDIR)/%o) 4280e2ca85SSRCS = $(CSRCS) 43e71ca95cSGerald Jelinek 44e71ca95cSGerald Jelinek# 45e71ca95cSGerald Jelinek# Note that the architecture specific makefiles MUST update DYNFLAGS to 46e71ca95cSGerald Jelinek# explicitly specify an interpreter for the brand emulation library so that we 47e71ca95cSGerald Jelinek# use /lib/ld.so.1 or /lib/64/ld.so.1, which in a s10 zone is the Solaris 10 48e71ca95cSGerald Jelinek# linker. This is different from some other brands where the linker that is 49e71ca95cSGerald Jelinek# used is the native system linker (/.SUNWnative/.../ld.so.1). We have to do 50e71ca95cSGerald Jelinek# this because the linker has a very incestuous relationship with libc and we 51e71ca95cSGerald Jelinek# don't want to use the native linker with the s10 version of libc. (This may 52e71ca95cSGerald Jelinek# come as a surprise to the reader, but when our library is loaded it get's 53e71ca95cSGerald Jelinek# linked against the s10 version of libc.) Although the linker interfaces are 54e71ca95cSGerald Jelinek# normally stable, there are examples, such as with the solaris8 brand, where 55e71ca95cSGerald Jelinek# we could not combine the brand's libc with the native linker. Since we want 56e71ca95cSGerald Jelinek# to run in a known configuration, we use the S10 libc/linker combination. 574ba5b961SDan Kimmel# 58e71ca95cSGerald Jelinek# There is one more non-obvious side effect of using the s10 linker that 59e71ca95cSGerald Jelinek# should be mentioned. Since the linker is used to setup processes before 60e71ca95cSGerald Jelinek# libc is loaded, it makes system calls directly (ie avoiding libc), and 61e71ca95cSGerald Jelinek# it makes these system calls before our library has been initialized. 62e71ca95cSGerald Jelinek# Since our library hasn't been initialized yet, there's no way for us 63e71ca95cSGerald Jelinek# to intercept and emulate any of those system calls. So if any of those 64e71ca95cSGerald Jelinek# system calls ever change in the native code such that they break the s10 65e71ca95cSGerald Jelinek# linker then we're kinda screwed and will need to re-visit the current 66e71ca95cSGerald Jelinek# solution. (The likely solution then will probably be to start using the 67e71ca95cSGerald Jelinek# native linker with our brand emulation library.) 68e71ca95cSGerald Jelinek# 69e71ca95cSGerald Jelinek# Note that we make sure to link our brand emulation library 70e71ca95cSGerald Jelinek# libmapmalloc. This is required because in most cases there will be two 71e71ca95cSGerald Jelinek# copies of libc in the same process and we don't want them to fight over 72e71ca95cSGerald Jelinek# the heap. So for our brand library we link against libmapmalloc so that 73e71ca95cSGerald Jelinek# if we (our or copy of libc) try to allocate any memory it will be done 74e71ca95cSGerald Jelinek# via mmap() instead of brk(). 75e71ca95cSGerald Jelinek# 76e71ca95cSGerald JelinekCPPFLAGS += -D_REENTRANT -U_ASM \ 7780e2ca85S -I. -I$(BRAND_SHARED)/brand/sys -I../sys \ 7880e2ca85S -I$(UTSBASE)/common/brand/solaris10 \ 79e71ca95cSGerald Jelinek -I$(SRC)/uts/common/fs/zfs 80e71ca95cSGerald JelinekCFLAGS += $(CCVERBOSE) 81e71ca95cSGerald Jelinek# Needed to handle zfs include files 82bd0ce624SYuri PankovCSTD= $(CSTD_GNU99) 83e71ca95cSGerald JelinekDYNFLAGS += $(DYNFLAGS_$(CLASS)) 84e71ca95cSGerald JelinekDYNFLAGS += $(BLOCAL) $(ZNOVERSION) -Wl,-e_start 85f3655454SJohn LevonLDLIBS += -lmapmalloc -lc 86e71ca95cSGerald Jelinek 87*ba32d0faSKlaus Ziegler# 88*ba32d0faSKlaus Ziegler# Disable stack protection as we're running in an s10 context. 89*ba32d0faSKlaus Ziegler# 90*ba32d0faSKlaus ZieglerSTACKPROTECT = none 91*ba32d0faSKlaus Ziegler 92d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT) 937014882cSRichard Lowe 9480e2ca85S$(LIBS):= PICS += $(SHAREDOBJS) 9580e2ca85S 96e71ca95cSGerald Jelinek.KEEP_STATE: 97e71ca95cSGerald Jelinek 98e71ca95cSGerald Jelinekall: $(LIBS) 99e71ca95cSGerald Jelinek 100e71ca95cSGerald Jelinekinclude $(SRC)/lib/Makefile.targ 101