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.
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.
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]
22 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2010 Nexenta Systems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 LIBCDIR= $(SRC)/lib/libc
34 # objects are grouped by source directory
36 # Symbol capabilities objects.
38 $(LIBCDIR)/capabilities/sun4u/sparcv9/pics/symcap.o \
39 $(LIBCDIR)/capabilities/sun4u-opl/sparcv9/pics/symcap.o \
40 $(LIBCDIR)/capabilities/sun4u-us3-hwcap1/sparcv9/pics/symcap.o \
41 $(LIBCDIR)/capabilities/sun4u-us3-hwcap2/sparcv9/pics/symcap.o \
42 $(LIBCDIR)/capabilities/sun4v-hwcap1/sparcv9/pics/symcap.o \
43 $(LIBCDIR)/capabilities/sun4v-hwcap2/sparcv9/pics/symcap.o
111 $(__GNUC)FPASMOBJS += \
159 sync_instruction_memory.o
161 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
162 # This macro should ALWAYS be empty; native APIs are already 'large file'.
300 _lwp_mutex_unlock.o \
307 sparc_utrap_install.o \
315 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
316 # This macro should ALWAYS be empty; native APIs are already 'large file'.
319 # objects from source under $(LIBCDIR)/port
355 ascii_strncasecmp.o \
611 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
612 # This macro should ALWAYS be empty; native APIs are already 'large file'.
858 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
859 # This macro should ALWAYS be empty; native APIs are already 'large file'.
972 # NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
973 # modules whose source is provided in the $(SRC)/lib/common directory.
974 # This must be done because otherwise the Sun C compiler would insert
975 # its own versions of these modules and those versions contain code
976 # to call out to C++ initialization functions. Such C++ initialization
977 # functions can call back into libc before thread initialization is
978 # complete and this leads to segmentation violations and other problems.
979 # Since libc contains no C++ code, linking with the minimal crti.o and
980 # crtn.o modules is safe and avoids the problems described above.
981 OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
982 CRTSRCS= ../../common/sparcv9
984 # include common library definitions
985 include $(SRC)/lib/Makefile.lib
986 include $(SRC)/lib/Makefile.lib.64
988 # we need to override the default SONAME here because we might
989 # be building a variant object (still libc.so.1, but different filename)
992 CFLAGS64 += $(CCVERBOSE)
994 # This is necessary to avoid problems with calling _ex_unwind().
995 # We probably don't want any inlining anyway.
996 CFLAGS64 += -xinline=
998 # Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
999 # enables ASSERT() checking in the threads portion of the library.
1000 # This is automatically enabled for DEBUG builds, not for non-debug builds.
1002 $(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
1004 # Make string literals read-only to save memory.
1005 CFLAGS64 += $(XSTRCONST)
1007 ALTPICS= $(TRACEOBJS:%=pics/%)
1009 $(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1011 MAPFILES = $(LIBCDIR)/port/mapfile-vers
1013 sparcv9_C_PICFLAGS= -K PIC
1014 CFLAGS64 += $(EXTN_CFLAGS)
1015 CPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
1016 -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1017 ASFLAGS= $(EXTN_ASFLAGS) -K PIC -P -D__STDC__ -D_ASM -D__sparcv9 $(CPPFLAGS) \
1020 # As a favor to the dtrace syscall provider, libc still calls the
1021 # old syscall traps that have been obsoleted by the *at() interfaces.
1022 # Delete this to compile libc using only the new *at() system call traps
1023 CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
1025 # Inform the run-time linker about libc specialized initialization
1026 RTLDINFO = -z rtldinfo=tls_rtldinfo
1027 DYNFLAGS += $(RTLDINFO)
1029 # Force libc's internal references to be resolved immediately upon loading
1030 # in order to avoid critical region problems. Since almost all libc symbols
1031 # are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1034 DYNFLAGS += $(EXTN_DYNFLAGS)
1036 BUILD.s= $(AS) $(ASFLAGS) $< -o $@
1038 # Override this top level flag so the compiler builds in its native
1039 # C99 mode. This has been enabled to support the complex arithmetic
1041 C99MODE= $(C99_ENABLE)
1043 # libc method of building an archive
1044 # The "$(GREP) -v ' L '" part is necessary only until
1045 # lorder is fixed to ignore thread-local variables.
1046 BUILD.AR= $(RM) $@ ; \
1047 $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1049 # extra files for the clean target
1051 $(LIBCDIR)/port/gen/errlst.c \
1052 $(LIBCDIR)/port/gen/new_list.c \
1059 CLOBBERFILES += $(LIB_PIC)
1061 # list of C source for lint
1063 $(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c) \
1064 $(XATTROBJS:%.o=$(SRC)/common/xattr/%.c) \
1065 $(COMOBJS:%.o=$(SRC)/common/util/%.c) \
1066 $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
1067 $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
1068 $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
1069 $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
1070 $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
1071 $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
1072 $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
1073 $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
1074 $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
1075 $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
1076 $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
1077 $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
1078 $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
1079 $(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
1080 $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
1081 $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
1082 $(FPOBJS64:%.o=$(LIBCBASE)/fp/%.c) \
1083 $(LIBCBASE)/crt/_ftou.c \
1084 $(LIBCBASE)/gen/_xregs_clrptr.c \
1085 $(LIBCBASE)/gen/byteorder.c \
1086 $(LIBCBASE)/gen/ecvt.c \
1087 $(LIBCBASE)/gen/getctxt.c \
1088 $(LIBCBASE)/gen/makectxt.c \
1089 $(LIBCBASE)/gen/siginfolst.c \
1090 $(LIBCBASE)/gen/siglongjmp.c \
1091 $(LIBCBASE)/gen/swapctxt.c
1093 # conditional assignments
1094 $(DYNLIB) := CRTI = crti.o
1095 $(DYNLIB) := CRTN = crtn.o
1097 # Files which need the threads .il inline template
1132 thread_interface.o \
1138 $(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/sparcv9.il
1140 # This hack is needed until the sparc gcc is fixed for TLS
1141 pics/tls_data.o := CC = env 'CW_NO_SHADOW=1' $(ONBLD_TOOLS)/bin/$(MACH)/cw -_cc
1143 # Files in fp, port/fp subdirectories that need base.il inline template
1148 $(IL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/fp/base.il
1150 # Files in fp subdirectory which need __quad.il inline template
1169 $(QIL:%=pics/%) := CFLAGS64 += $(LIBCDIR)/$(MACH)/fp/__quad.il
1170 pics/_Qp%.o := CFLAGS64 += -I$(LIBCDIR)/$(MACH)/fp
1171 pics/_Q%.o := sparcv9_COPTFLAG = -xO4 -xchip=ultra
1173 # Files in crt subdirectory which need muldiv64.il inline template
1174 #CIL= mul64.o divrem64.o
1175 #$(CIL:%=pics/%) := CFLAGS += $(LIBCBASE)/crt/mul64.il
1177 # large-file-aware components that should be built large
1179 #$(COMSYSOBJS64:%=pics/%) := \
1180 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1182 #$(SYSOBJS64:%=pics/%) := \
1183 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1185 #$(PORTGEN64:%=pics/%) := \
1186 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1188 #$(PORTSTDIO64:%=pics/%) := \
1189 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1191 #$(PORTSYS64:%=pics/%) := \
1192 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1194 $(PORTSTDIO_W:%=pics/%) := \
1197 $(PORTPRINT_W:%=pics/%) := \
1200 $(PORTI18N_COND:%=pics/%) := \
1201 CPPFLAGS += -D_WCS_LONGLONG
1203 # Files which need extra optimization
1204 pics/getenv.o := sparcv9_COPTFLAG = -xO4
1208 all: $(LIBS) $(LIB_PIC)
1210 lint := CPPFLAGS += -I$(LIBCDIR)/$(MACH)/fp
1211 lint := CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1212 lint := LINTFLAGS64 += -mn
1215 @echo $(LINT.c) ... $(LDLIBS)
1216 @$(LINT.c) $(SRCS) $(LDLIBS)
1218 $(LINTLIB):= SRCS=$(LIBCDIR)/port/llib-lc
1219 $(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1220 $(LINTLIB):= LINTFLAGS64=-nvx -m64
1222 # object files that depend on inline template
1223 $(TIL:%=pics/%): $(LIBCBASE)/threads/sparcv9.il
1224 $(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1225 $(QIL:%=pics/%): $(LIBCDIR)/$(MACH)/fp/__quad.il
1226 #$(CIL:%=pics/%): $(LIBCBASE)/crt/muldiv64.il
1228 # include common libc targets
1229 include $(LIBCDIR)/Makefile.targ
1231 # We need to strip out all CTF and DOF data from the static library
1232 $(LIB_PIC) := DIR = pics
1233 $(LIB_PIC): pics $$(PICS)
1235 $(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1236 $(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1237 $(AR) -ts $@ > /dev/null
1241 #$(STRETS:%=pics/%): crt/stret.s
1242 # $(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1245 #crt/_rtbootld.s: crt/_rtboot.s crt/_rtld.c
1246 # $(CC) $(CPPFLAGS) -O -S -K pic crt/_rtld.c -o crt/_rtld.s
1247 # $(CAT) crt/_rtboot.s crt/_rtld.s > $@
1251 _lwp_mutex_unlock.o \
1260 $(ASSYMDEP_OBJS:%=pics/%) := CPPFLAGS += -I.
1262 $(ASSYMDEP_OBJS:%=pics/%): assym.h
1264 # assym.h build rules
1266 GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
1268 # XXX A hack. Perhaps this should be 'CPPFLAGS.native' and
1269 # live in Makefile.master
1271 CPPFLAGS.genassym = \
1272 $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1274 genassym: $(GENASSYM_C)
1275 $(NATIVECC) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
1276 $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1278 OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1280 assym.h: $(OFFSETS) genassym
1281 $(OFFSETS_CREATE) <$(OFFSETS) >$@
1284 # derived C source and related explicit dependencies
1285 $(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1286 cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1288 pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c