b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# CDDL HEADER START
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# The contents of this file are subject to the terms of the
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Common Development and Distribution License (the "License").
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# You may not use this file except in compliance with the License.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# See the License for the specific language governing permissions
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# and limitations under the License.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# When distributing Covered Code, include this CDDL HEADER in each
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# If applicable, add the following below this CDDL HEADER, with the
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# fields enclosed by brackets "[]" replaced with your own identifying
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# information: Portions Copyright [yyyy] [name of copyright owner]
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# CDDL HEADER END
696be233fd50b992c5f28974cd022f078f832272Gary Mills# Copyright 2016 Gary Mills
794f0adb050e571bbfde4d2a19b9f88b852079ddRoger A. Faulkner# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
fca543ca45b12c44a243625bce68b645ba8ed791DJ Hoffman# Copyright (c) 2015, Joyent, Inc. All rights reserved.
5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4eTheo Schlossnagle# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore# Copyright 2013 Garrett D'Amore <garrett@damore.org>
475b496bc008381e64c802250441cc256622ce91Garrett D'Amore# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore# Use is subject to license terms.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# objects are grouped by source directory
1e49577a7fcde812700ded04431b49d67cc57d6dRod Evans# Symbol capabilities objects.
1e49577a7fcde812700ded04431b49d67cc57d6dRod Evans $(LIBCDIR)/capabilities/sun4u/sparcv9/pics/symcap.o \
1e49577a7fcde812700ded04431b49d67cc57d6dRod Evans $(LIBCDIR)/capabilities/sun4u-opl/sparcv9/pics/symcap.o \
1e49577a7fcde812700ded04431b49d67cc57d6dRod Evans $(LIBCDIR)/capabilities/sun4u-us3-hwcap1/sparcv9/pics/symcap.o \
1e49577a7fcde812700ded04431b49d67cc57d6dRod Evans $(LIBCDIR)/capabilities/sun4u-us3-hwcap2/sparcv9/pics/symcap.o \
1e49577a7fcde812700ded04431b49d67cc57d6dRod Evans $(LIBCDIR)/capabilities/sun4v-hwcap1/sparcv9/pics/symcap.o \
1e49577a7fcde812700ded04431b49d67cc57d6dRod Evans $(LIBCDIR)/capabilities/sun4v-hwcap2/sparcv9/pics/symcap.o
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# local objects
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# This macro should ALWAYS be empty; native APIs are already 'large file'.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# This macro should ALWAYS be empty; native APIs are already 'large file'.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# objects from source under $(LIBCDIR)/port
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# This macro should ALWAYS be empty; native APIs are already 'large file'.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# This macro should ALWAYS be empty; native APIs are already 'large file'.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# modules whose source is provided in the $(SRC)/lib/common directory.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# This must be done because otherwise the Sun C compiler would insert
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# its own versions of these modules and those versions contain code
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# to call out to C++ initialization functions. Such C++ initialization
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# functions can call back into libc before thread initialization is
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# complete and this leads to segmentation violations and other problems.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Since libc contains no C++ code, linking with the minimal crti.o and
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# crtn.o modules is safe and avoids the problems described above.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# include common library definitions
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# we need to override the default SONAME here because we might
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# be building a variant object (still libc.so.1, but different filename)
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# This is necessary to avoid problems with calling _ex_unwind().
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# We probably don't want any inlining anyway.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# enables ASSERT() checking in the threads portion of the library.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# This is automatically enabled for DEBUG builds, not for non-debug builds.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Make string literals read-only to save memory.
1e49577a7fcde812700ded04431b49d67cc57d6dRod Evans$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
b1593d50e783f7d66722dde093752b74ffa95176Jason BeloroCPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
b1593d50e783f7d66722dde093752b74ffa95176Jason BeloroASFLAGS= $(EXTN_ASFLAGS) -K PIC -P -D__STDC__ -D_ASM -D__sparcv9 $(CPPFLAGS) \
8fd04b8338ed5093ec2d1e668fa620b7de44c177Roger A. Faulkner# As a favor to the dtrace syscall provider, libc still calls the
8fd04b8338ed5093ec2d1e668fa620b7de44c177Roger A. Faulkner# old syscall traps that have been obsoleted by the *at() interfaces.
8fd04b8338ed5093ec2d1e668fa620b7de44c177Roger A. Faulkner# Delete this to compile libc using only the new *at() system call traps
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Inform the run-time linker about libc specialized initialization
32a6953793c636df949ca1ae3555438159bda3f6Roger A. Faulkner# Force libc's internal references to be resolved immediately upon loading
32a6953793c636df949ca1ae3555438159bda3f6Roger A. Faulkner# in order to avoid critical region problems. Since almost all libc symbols
32a6953793c636df949ca1ae3555438159bda3f6Roger A. Faulkner# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Override this top level flag so the compiler builds in its native
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# C99 mode. This has been enabled to support the complex arithmetic
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# added to libc.
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# libc method of building an archive
23a1ccea6aac035f084a7a4cdc968687d1b02dafRoger A. Faulkner# The "$(GREP) -v ' L '" part is necessary only until
23a1ccea6aac035f084a7a4cdc968687d1b02dafRoger A. Faulkner# lorder is fixed to ignore thread-local variables.
23a1ccea6aac035f084a7a4cdc968687d1b02dafRoger A. Faulkner $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# extra files for the clean target
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# list of C source for lint
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# conditional assignments
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Files which need the threads .il inline template
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/sparcv9.il
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Files in fp, port/fp subdirectories that need base.il inline template
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro$(IL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/fp/base.il
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Files in fp subdirectory which need __quad.il inline template
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro$(QIL:%=pics/%) := CFLAGS64 += $(LIBCDIR)/$(MACH)/fp/__quad.il
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloropics/_Qp%.o := CFLAGS64 += -I$(LIBCDIR)/$(MACH)/fp
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloropics/_Q%.o := sparcv9_COPTFLAG = -xO4 -xchip=ultra
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Files in crt subdirectory which need muldiv64.il inline template
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro#$(CIL:%=pics/%) := CFLAGS += $(LIBCBASE)/crt/mul64.il
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# large-file-aware components that should be built large
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro#$(COMSYSOBJS64:%=pics/%) := \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro#$(SYSOBJS64:%=pics/%) := \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro#$(PORTGEN64:%=pics/%) := \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro#$(PORTSTDIO64:%=pics/%) := \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro#$(PORTSYS64:%=pics/%) := \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
9d12795f87b63c2e39e87bff369182edd34677d3Robert Mustacchipics/arc4random.o := CPPFLAGS += -I$(SRC)/common/crypto/chacha
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# Files which need extra optimization
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# object files that depend on inline template
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro$(QIL:%=pics/%): $(LIBCDIR)/$(MACH)/fp/__quad.il
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro#$(CIL:%=pics/%): $(LIBCBASE)/crt/muldiv64.il
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# include common libc targets
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# We need to strip out all CTF and DOF data from the static library
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# special cases
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro#$(STRETS:%=pics/%): crt/stret.s
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# $(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# $(POST_PROCESS_O)
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# $(CC) $(CPPFLAGS) -O -S -K pic crt/_rtld.c -o crt/_rtld.s
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# $(CAT) crt/_rtboot.s crt/_rtld.s > $@
7f11fd00fc23e2af7ae21cc8837a2b86380dcfa7Richard Lowe $(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro# derived C source and related explicit dependencies
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
b1593d50e783f7d66722dde093752b74ffa95176Jason Beloro cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist