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
38 # objects are grouped by source directory
40 # Symbol capabilities objects.
42 $(LIBCDIR)/capabilities/sun4u/sparcv9/pics/symcap.o \
43 $(LIBCDIR)/capabilities/sun4u-opl/sparcv9/pics/symcap.o \
44 $(LIBCDIR)/capabilities/sun4u-us3-hwcap1/sparcv9/pics/symcap.o \
45 $(LIBCDIR)/capabilities/sun4u-us3-hwcap2/sparcv9/pics/symcap.o \
46 $(LIBCDIR)/capabilities/sun4v-hwcap1/sparcv9/pics/symcap.o \
47 $(LIBCDIR)/capabilities/sun4v-hwcap2/sparcv9/pics/symcap.o
143 arc4random_uniform.o \
167 sync_instruction_memory.o
169 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
170 # This macro should ALWAYS be empty; native APIs are already 'large file'.
313 _lwp_mutex_unlock.o \
319 sparc_utrap_install.o \
327 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
328 # This macro should ALWAYS be empty; native APIs are already 'large file'.
331 # objects from source under $(LIBCDIR)/port
367 ascii_strncasecmp.o \
629 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
630 # This macro should ALWAYS be empty; native APIs are already 'large file'.
880 # Preserved solely to ease maintenance of 32-bit and 64-bit library builds
881 # This macro should ALWAYS be empty; native APIs are already 'large file'.
999 # NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
1000 # modules whose source is provided in the $(SRC)/lib/common directory.
1001 # This must be done because otherwise the Sun C compiler would insert
1002 # its own versions of these modules and those versions contain code
1003 # to call out to C++ initialization functions. Such C++ initialization
1004 # functions can call back into libc before thread initialization is
1005 # complete and this leads to segmentation violations and other problems.
1006 # Since libc contains no C++ code, linking with the minimal crti.o and
1007 # crtn.o modules is safe and avoids the problems described above.
1008 OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
1009 CRTSRCS= ../../common/sparcv9
1011 # include common library definitions
1012 include $(SRC)/lib/Makefile.lib
1013 include $(SRC)/lib/Makefile.lib.64
1015 # we need to override the default SONAME here because we might
1016 # be building a variant object (still libc.so.1, but different filename)
1020 CERRWARN += -Wno-parentheses
1021 CERRWARN += -Wno-switch
1022 CERRWARN += -Wno-uninitialized
1023 CERRWARN += -Wno-unused-value
1024 CERRWARN += -Wno-unused-label
1025 CERRWARN += -Wno-unused-variable
1026 CERRWARN += -Wno-type-limits
1027 CERRWARN += -Wno-char-subscripts
1028 CERRWARN += -Wno-clobbered
1029 CERRWARN += -Wno-unused-function
1030 CERRWARN += -Wno-address
1032 # Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1033 # enables ASSERT() checking in the threads portion of the library.
1034 # This is automatically enabled for DEBUG builds, not for non-debug builds.
1036 $(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
1038 ALTPICS= $(TRACEOBJS:%=pics/%)
1040 $(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1042 MAPFILES = $(LIBCDIR)/port/mapfile-vers
1044 sparcv9_C_PICFLAGS= -fPIC
1045 CFLAGS64 += $(EXTN_CFLAGS)
1046 CPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
1047 -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1048 ASFLAGS= $(EXTN_ASFLAGS) -D_ASM -D__sparcv9 $(CPPFLAGS) \
1051 # As a favor to the dtrace syscall provider, libc still calls the
1052 # old syscall traps that have been obsoleted by the *at() interfaces.
1053 # Delete this to compile libc using only the new *at() system call traps
1054 CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
1056 # Inform the run-time linker about libc specialized initialization
1057 RTLDINFO = -z rtldinfo=tls_rtldinfo
1058 DYNFLAGS += $(RTLDINFO)
1060 # Force libc's internal references to be resolved immediately upon loading
1061 # in order to avoid critical region problems. Since almost all libc symbols
1062 # are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1065 DYNFLAGS += $(EXTN_DYNFLAGS)
1067 BUILD.s= $(AS) $(ASFLAGS) $< -o $@
1069 # Override this top level flag so the compiler builds in its native
1070 # C99 mode. This has been enabled to support the complex arithmetic
1072 C99MODE= $(C99_ENABLE)
1074 # libc method of building an archive
1075 # The "$(GREP) -v ' L '" part is necessary only until
1076 # lorder is fixed to ignore thread-local variables.
1077 BUILD.AR= $(RM) $@ ; \
1078 $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1080 # extra files for the clean target
1082 $(LIBCDIR)/port/gen/errlst.c \
1083 $(LIBCDIR)/port/gen/new_list.c \
1090 CLOBBERFILES += $(LIB_PIC)
1092 # list of C source formerly for lint
1094 $(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c) \
1095 $(XATTROBJS:%.o=$(SRC)/common/xattr/%.c) \
1096 $(COMOBJS:%.o=$(SRC)/common/util/%.c) \
1097 $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
1098 $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
1099 $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
1100 $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
1101 $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
1102 $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
1103 $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
1104 $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
1105 $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
1106 $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
1107 $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
1108 $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
1109 $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
1110 $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
1111 $(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
1112 $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
1113 $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
1114 $(FPOBJS64:%.o=$(LIBCBASE)/fp/%.c) \
1115 $(LIBCBASE)/crt/_ftou.c \
1116 $(LIBCBASE)/gen/_xregs_clrptr.c \
1117 $(LIBCBASE)/gen/byteorder.c \
1118 $(LIBCBASE)/gen/endian.c \
1119 $(LIBCBASE)/gen/ecvt.c \
1120 $(LIBCBASE)/gen/getctxt.c \
1121 $(LIBCBASE)/gen/makectxt.c \
1122 $(LIBCBASE)/gen/siginfolst.c \
1123 $(LIBCBASE)/gen/siglongjmp.c \
1124 $(LIBCBASE)/gen/swapctxt.c
1126 # conditional assignments
1127 $(DYNLIB) := CRTI = crti.o
1128 $(DYNLIB) := CRTN = crtn.o
1130 pics/_Qp%.o := CFLAGS64 += -I$(LIBCDIR)/$(MACH)/fp
1131 pics/_Q%.o := sparcv9_COPTFLAG = -fno-strict-aliasing \
1132 -fno-unit-at-a-time \
1133 -fno-optimize-sibling-calls \
1137 # large-file-aware components that should be built large
1139 #$(COMSYSOBJS64:%=pics/%) := \
1140 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1142 #$(SYSOBJS64:%=pics/%) := \
1143 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1145 #$(PORTGEN64:%=pics/%) := \
1146 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1148 #$(PORTSTDIO64:%=pics/%) := \
1149 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1151 #$(PORTSYS64:%=pics/%) := \
1152 # CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1154 $(PORTSTDIO_W:%=pics/%) := \
1157 $(PORTPRINT_W:%=pics/%) := \
1160 $(PORTI18N_COND:%=pics/%) := \
1161 CPPFLAGS += -D_WCS_LONGLONG
1163 pics/arc4random.o := CPPFLAGS += -I$(SRC)/common/crypto/chacha
1165 # Files which need extra optimization
1166 pics/getenv.o := sparcv9_COPTFLAG = -fno-strict-aliasing \
1167 -fno-unit-at-a-time \
1168 -fno-optimize-sibling-calls \
1173 all: $(LIBS) $(LIB_PIC)
1175 # include common libc targets
1176 include $(LIBCDIR)/Makefile.targ
1178 # We need to strip out all CTF and DOF data from the static library
1179 $(LIB_PIC) := DIR = pics
1180 $(LIB_PIC): pics $$(PICS)
1182 $(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1183 $(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1184 $(AR) -ts $@ > /dev/null
1188 #$(STRETS:%=pics/%): crt/stret.s
1189 # $(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1192 #crt/_rtbootld.s: crt/_rtboot.s crt/_rtld.c
1193 # $(CC) $(CPPFLAGS) -O -S -fpic crt/_rtld.c -o crt/_rtld.s
1194 # $(CAT) crt/_rtboot.s crt/_rtld.s > $@
1198 _lwp_mutex_unlock.o \
1207 $(ASSYMDEP_OBJS:%=pics/%) := CPPFLAGS += -I.
1209 $(ASSYMDEP_OBJS:%=pics/%): assym.h
1211 # assym.h build rules
1213 assym.h := CFLAGS64 += -g
1215 GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
1217 genassym: $(GENASSYM_C)
1218 $(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
1219 $(CPPFLAGS.native) -o $@ $(GENASSYM_C)
1221 OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1223 assym.h: $(OFFSETS) genassym
1224 $(OFFSETS_CREATE) <$(OFFSETS) >$@
1227 # derived C source and related explicit dependencies
1228 $(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1229 cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1231 pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c