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 2016 Gary Mills
23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2015, Joyent, Inc. All rights reserved.
25 # Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
26 # Copyright 2013 Garrett D'Amore <garrett@damore.org>
28 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
29 # Use is subject to license terms.
32 LIBCDIR= $(SRC)/lib/libc
37 # objects are grouped by source directory
39 # Symbol capabilities objects.
41 $(LIBCDIR)/capabilities/sun4u/sparcv9/pics/symcap.o \
42 $(LIBCDIR)/capabilities/sun4u-opl/sparcv9/pics/symcap.o \
43 $(LIBCDIR)/capabilities/sun4u-us3-hwcap1/sparcv9/pics/symcap.o \
44 $(LIBCDIR)/capabilities/sun4u-us3-hwcap2/sparcv9/pics/symcap.o \
45 $(LIBCDIR)/capabilities/sun4v-hwcap1/sparcv9/pics/symcap.o \
46 $(LIBCDIR)/capabilities/sun4v-hwcap2/sparcv9/pics/symcap.o
142 arc4random_uniform.o \
169 sync_instruction_memory.o\
173 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
174 # This macro should ALWAYS be empty; native APIs are already 'large file'.
317 _lwp_mutex_unlock.o \
323 sparc_utrap_install.o \
330 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
331 # This macro should ALWAYS be empty; native APIs are already 'large file'.
334 # objects from source under $(LIBCDIR)/port
370 ascii_strncasecmp.o \
631 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
632 # This macro should ALWAYS be empty; native APIs are already 'large file'.
882 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
883 # This macro should ALWAYS be empty; native APIs are already 'large file'.
1001 # NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
1002 # modules whose source is provided in the $(SRC)/lib/crt directory.
1003 # This must be done because otherwise the Sun C compiler would insert
1004 # its own versions of these modules and those versions contain code
1005 # to call out to C++ initialization functions. Such C++ initialization
1006 # functions can call back into libc before thread initialization is
1007 # complete and this leads to segmentation violations and other problems.
1008 # Since libc contains no C++ code, linking with the minimal crti.o and
1009 # crtn.o modules is safe and avoids the problems described above.
1010 OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
1011 CRTSRCS= ../../crt/sparcv9
1013 # include common library definitions
1014 include $(SRC)/lib/Makefile.lib
1015 include $(SRC)/lib/Makefile.lib.64
1017 # we need to override the default SONAME here because we might
1018 # be building a variant object (still libc.so.1, but different filename)
1022 CERRWARN += -Wno-parentheses
1023 CERRWARN += -Wno-switch
1024 CERRWARN += -Wno-uninitialized
1025 CERRWARN += -Wno-unused-value
1026 CERRWARN += -Wno-unused-label
1027 CERRWARN += -Wno-unused-variable
1028 CERRWARN += -Wno-type-limits
1029 CERRWARN += -Wno-char-subscripts
1030 CERRWARN += -Wno-clobbered
1031 CERRWARN += -Wno-unused-function
1032 CERRWARN += -Wno-address
1034 # Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1035 # enables ASSERT() checking in the threads portion of the library.
1036 # This is automatically enabled for DEBUG builds, not for non-debug builds.
1038 $(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
1040 ALTPICS= $(TRACEOBJS:%=pics/%)
1042 $(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1044 MAPFILES = $(LIBCDIR)/port/mapfile-vers
1046 sparcv9_C_PICFLAGS= -fPIC
1047 CFLAGS64 += $(EXTN_CFLAGS)
1048 CPPFLAGS= -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
1049 -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1050 ASFLAGS= $(EXTN_ASFLAGS) -D_ASM -D__sparcv9 $(CPPFLAGS) \
1053 # Inform the run-time linker about libc specialized initialization
1054 RTLDINFO = -z rtldinfo=tls_rtldinfo
1055 DYNFLAGS += $(RTLDINFO)
1057 # Force libc's internal references to be resolved immediately upon loading
1058 # in order to avoid critical region problems. Since almost all libc symbols
1059 # are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1062 DYNFLAGS += $(EXTN_DYNFLAGS)
1064 BUILD.s= $(AS) $(ASFLAGS) $< -o $@
1066 # Override this top level flag so the compiler builds in its native
1067 # C99 mode. This has been enabled to support the complex arithmetic
1069 C99MODE= $(C99_ENABLE)
1071 # libc method of building an archive
1072 # The "$(GREP) -v ' L '" part is necessary only until
1073 # lorder is fixed to ignore thread-local variables.
1074 BUILD.AR= $(RM) $@ ; \
1075 $(AR) qc $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1077 # extra files for the clean target
1079 $(LIBCDIR)/port/gen/errlst.c \
1080 $(LIBCDIR)/port/gen/new_list.c \
1087 CLOBBERFILES += $(LIB_PIC)
1089 # list of C source formerly for lint
1091 $(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c) \
1092 $(XATTROBJS:%.o=$(SRC)/common/xattr/%.c) \
1093 $(COMOBJS:%.o=$(SRC)/common/util/%.c) \
1094 $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
1095 $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
1096 $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
1097 $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
1098 $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
1099 $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
1100 $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
1101 $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
1102 $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
1103 $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
1104 $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
1105 $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
1106 $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
1107 $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
1108 $(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
1109 $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
1110 $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
1111 $(FPOBJS64:%.o=$(LIBCBASE)/fp/%.c) \
1112 $(LIBCBASE)/crt/_ftou.c \
1113 $(LIBCBASE)/gen/_xregs_clrptr.c \
1114 $(LIBCBASE)/gen/byteorder.c \
1115 $(LIBCBASE)/gen/endian.c \
1116 $(LIBCBASE)/gen/ecvt.c \
1117 $(LIBCBASE)/gen/getctxt.c \
1118 $(LIBCBASE)/gen/makectxt.c \
1119 $(LIBCBASE)/gen/siginfolst.c \
1120 $(LIBCBASE)/gen/siglongjmp.c \
1121 $(LIBCBASE)/gen/swapctxt.c
1123 # conditional assignments
1124 $(DYNLIB) := CRTI = crti.o
1125 $(DYNLIB) := CRTN = crtn.o
1127 pics/_Qp%.o := CFLAGS64 += -I$(LIBCDIR)/$(MACH)/fp
1128 pics/_Q%.o := sparcv9_COPTFLAG = -fno-strict-aliasing \
1129 -fno-unit-at-a-time \
1130 -fno-optimize-sibling-calls \
1134 # large-file-aware components that should be built large
1136 #$(COMSYSOBJS64:%=pics/%) := \
1137 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1139 #$(SYSOBJS64:%=pics/%) := \
1140 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1142 #$(PORTGEN64:%=pics/%) := \
1143 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1145 #$(PORTSTDIO64:%=pics/%) := \
1146 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1148 #$(PORTSYS64:%=pics/%) := \
1149 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1151 $(PORTSTDIO_W:%=pics/%) := \
1154 $(PORTPRINT_W:%=pics/%) := \
1157 $(PORTI18N_COND:%=pics/%) := \
1158 CPPFLAGS += -D_WCS_LONGLONG
1160 pics/arc4random.o := CPPFLAGS += -I$(SRC)/common/crypto/chacha
1162 # Files which need extra optimization
1163 pics/getenv.o := sparcv9_COPTFLAG = -fno-strict-aliasing \
1164 -fno-unit-at-a-time \
1165 -fno-optimize-sibling-calls \
1170 all: $(LIBS) $(LIB_PIC)
1172 # include common libc targets
1173 include $(LIBCDIR)/Makefile.targ
1175 # We need to strip out all CTF and DOF data from the static library
1176 $(LIB_PIC) := DIR = pics
1177 $(LIB_PIC): pics $$(PICS)
1179 $(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1180 $(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1181 $(AR) -ts $@ > /dev/null
1185 #$(STRETS:%=pics/%): crt/stret.s
1186 # $(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1189 #crt/_rtbootld.s: crt/_rtboot.s crt/_rtld.c
1190 # $(CC) $(CPPFLAGS) -O -S -fpic crt/_rtld.c -o crt/_rtld.s
1191 # $(CAT) crt/_rtboot.s crt/_rtld.s > $@
1195 _lwp_mutex_unlock.o \
1204 $(ASSYMDEP_OBJS:%=pics/%) := CPPFLAGS += -I.
1206 $(ASSYMDEP_OBJS:%=pics/%): assym.h
1208 # assym.h build rules
1210 assym.h := CFLAGS64 += -g
1212 GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
1214 genassym: $(GENASSYM_C)
1215 $(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
1216 $(CPPFLAGS.native) -o $@ $(GENASSYM_C)
1218 OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1220 assym.h: $(OFFSETS) genassym
1221 $(OFFSETS_CREATE) <$(OFFSETS) >$@
1224 # derived C source and related explicit dependencies
1225 $(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1226 cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1228 pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c