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# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 23# 24 25LIBRARY = s10_brand.a 26VERS = .1 27COBJS = s10_brand.o s10_deleted.o s10_signal.o 28ASOBJS = crt.o handler.o runexe.o brand_util.o 29OBJECTS = $(COBJS) 30 31include ../../Makefile.s10 32include $(SRC)/lib/Makefile.lib 33 34SRCDIR = ../common 35UTSBASE = $(SRC)/uts 36 37LIBS = $(DYNLIB) 38CSRCS = $(COBJS:%o=../common/%c) 39SHAREDOBJS = $(ASOBJS:%o=$(ISAOBJDIR)/%o) 40SRCS = $(CSRCS) 41 42# 43# Note that the architecture specific makefiles MUST update DYNFLAGS to 44# explicitly specify an interpreter for the brand emulation library so that we 45# use /lib/ld.so.1 or /lib/64/ld.so.1, which in a s10 zone is the Solaris 10 46# linker. This is different from some other brands where the linker that is 47# used is the native system linker (/.SUNWnative/.../ld.so.1). We have to do 48# this because the linker has a very incestuous relationship with libc and we 49# don't want to use the native linker with the s10 version of libc. (This may 50# come as a surprise to the reader, but when our library is loaded it get's 51# linked against the s10 version of libc.) Although the linker interfaces are 52# normally stable, there are examples, such as with the solaris8 brand, where 53# we could not combine the brand's libc with the native linker. Since we want 54# to run in a known configuration, we use the S10 libc/linker combination. 55# 56# There is one more non-obvious side effect of using the s10 linker that 57# should be mentioned. Since the linker is used to setup processes before 58# libc is loaded, it makes system calls directly (ie avoiding libc), and 59# it makes these system calls before our library has been initialized. 60# Since our library hasn't been initialized yet, there's no way for us 61# to intercept and emulate any of those system calls. So if any of those 62# system calls ever change in the native code such that they break the s10 63# linker then we're kinda screwed and will need to re-visit the current 64# solution. (The likely solution then will probably be to start using the 65# native linker with our brand emulation library.) 66# 67# Note that we make sure to link our brand emulation library 68# libmapmalloc. This is required because in most cases there will be two 69# copies of libc in the same process and we don't want them to fight over 70# the heap. So for our brand library we link against libmapmalloc so that 71# if we (our or copy of libc) try to allocate any memory it will be done 72# via mmap() instead of brk(). 73# 74CPPFLAGS += -D_REENTRANT -U_ASM \ 75 -I. -I$(BRAND_SHARED)/brand/sys -I../sys \ 76 -I$(UTSBASE)/common/brand/solaris10 \ 77 -I$(SRC)/uts/common/fs/zfs 78CFLAGS += $(CCVERBOSE) 79# Needed to handle zfs include files 80C99MODE= -xc99=%all 81C99LMODE= -Xc99=%all 82DYNFLAGS += $(DYNFLAGS_$(CLASS)) 83DYNFLAGS += $(BLOCAL) $(ZNOVERSION) -Wl,-e_start 84LDLIBS += -lc -lmapmalloc 85 86CERRWARN += -_gcc=-Wno-uninitialized 87 88$(LIBS):= PICS += $(SHAREDOBJS) 89 90.KEEP_STATE: 91 92all: $(LIBS) 93 94lint: lintcheck 95 96include $(SRC)/lib/Makefile.targ 97