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#
23# Copyright 2016 Gary Mills
24# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25# Copyright 2019 Joyent, Inc.
26# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
27# Copyright 2013 Garrett D'Amore <garrett@damore.org>
28# Copyright 2018 Nexenta Systems, Inc.
29# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
30# Copyright 2019 Peter Tribble.
31#
32
33LIBCDIR=	$(SRC)/lib/libc
34LIB_PIC=	libc_pic.a
35VERS=		.1
36CPP=		/usr/lib/cpp
37TARGET_ARCH=	sparc
38
39# objects are grouped by source directory
40
41# Symbol capabilities objects.
42EXTPICS=			\
43	$(LIBCDIR)/capabilities/sun4u/sparcv9/pics/symcap.o \
44	$(LIBCDIR)/capabilities/sun4u-opl/sparcv9/pics/symcap.o \
45	$(LIBCDIR)/capabilities/sun4u-us3-hwcap1/sparcv9/pics/symcap.o \
46	$(LIBCDIR)/capabilities/sun4u-us3-hwcap2/sparcv9/pics/symcap.o \
47	$(LIBCDIR)/capabilities/sun4v-hwcap1/sparcv9/pics/symcap.o \
48	$(LIBCDIR)/capabilities/sun4v-hwcap2/sparcv9/pics/symcap.o
49
50# local objects
51STRETS=
52
53CRTOBJS=			\
54	__align_cpy_2.o		\
55	__align_cpy_4.o		\
56	__align_cpy_8.o		\
57	_ftou.o			\
58	cerror.o
59
60DYNOBJS=
61
62FPOBJS=				\
63	_D_cplx_div.o		\
64	_D_cplx_div_ix.o	\
65	_D_cplx_div_rx.o	\
66	_D_cplx_mul.o		\
67	_F_cplx_div.o		\
68	_F_cplx_div_ix.o	\
69	_F_cplx_div_rx.o	\
70	_F_cplx_mul.o		\
71	_Q_add.o		\
72	_Q_cmp.o		\
73	_Q_cmpe.o		\
74	_Q_cplx_div.o		\
75	_Q_cplx_div_ix.o	\
76	_Q_cplx_div_rx.o	\
77	_Q_cplx_lr_div.o	\
78	_Q_cplx_lr_div_ix.o	\
79	_Q_cplx_lr_div_rx.o	\
80	_Q_cplx_lr_mul.o	\
81	_Q_cplx_mul.o		\
82	_Q_div.o		\
83	_Q_dtoq.o		\
84	_Q_fcc.o		\
85	_Q_itoq.o		\
86	_Q_mul.o		\
87	_Q_neg.o		\
88	_Q_qtod.o		\
89	_Q_qtoi.o		\
90	_Q_qtos.o		\
91	_Q_qtou.o		\
92	_Q_scl.o		\
93	_Q_sqrt.o		\
94	_Q_stoq.o		\
95	_Q_sub.o		\
96	_Q_utoq.o
97
98FPOBJS64=			\
99	_Qp_qtox.o		\
100	_Qp_qtoux.o		\
101	_Qp_xtoq.o		\
102	_Qp_uxtoq.o		\
103	__dtoul.o		\
104	__ftoul.o
105
106FPASMOBJS=			\
107	_Q_get_rp_rd.o		\
108	__quad_mag64.o		\
109	fpgetmask.o		\
110	fpgetrnd.o		\
111	fpgetsticky.o		\
112	fpsetmask.o		\
113	fpsetrnd.o		\
114	fpsetsticky.o
115
116$(__GNUC)FPASMOBJS +=		\
117	__quad.o
118
119ATOMICOBJS=			\
120	atomic.o
121
122CHACHAOBJS=			\
123	chacha.o
124
125XATTROBJS=			\
126	xattr_common.o
127
128COMOBJS=			\
129	bcmp.o			\
130	bcopy.o			\
131	bsearch.o		\
132	bzero.o			\
133	explicit_bzero.o	\
134	memccpy.o		\
135	memmem.o		\
136	qsort.o			\
137	strtol.o		\
138	strtoul.o		\
139	strtoll.o		\
140	strtoull.o		\
141	multi3.o
142
143GENOBJS=			\
144	_getsp.o		\
145	_xregs_clrptr.o		\
146	abs.o			\
147	alloca.o		\
148	arc4random.o		\
149	arc4random_uniform.o	\
150	ascii_strcasecmp.o	\
151	byteorder.o		\
152	cuexit.o		\
153	ecvt.o			\
154	endian.o		\
155	getctxt.o		\
156	lock.o			\
157	makectxt.o		\
158	memchr.o		\
159	memcmp.o		\
160	new_list.o		\
161	setjmp.o		\
162	siginfolst.o		\
163	siglongjmp.o		\
164	smt_pause.o		\
165	sparc_data.o		\
166	strchr.o		\
167	strcmp.o		\
168	strlcpy.o		\
169	strncmp.o		\
170	strncpy.o		\
171	strnlen.o		\
172	swapctxt.o		\
173	sync_instruction_memory.o
174
175# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
176# This macro should ALWAYS be empty; native APIs are already 'large file'.
177COMSYSOBJS64=
178
179SYSOBJS64=
180
181COMSYSOBJS=			\
182	__clock_timer.o		\
183	__getloadavg.o		\
184	__rusagesys.o		\
185	__signotify.o		\
186	__sigrt.o		\
187	__time.o		\
188	_lgrp_home_fast.o	\
189	_lgrpsys.o		\
190	_nfssys.o		\
191	_portfs.o		\
192	_pset.o			\
193	_rpcsys.o		\
194	_sigaction.o		\
195	_so_accept.o		\
196	_so_bind.o		\
197	_so_connect.o		\
198	_so_getpeername.o	\
199	_so_getsockname.o	\
200	_so_getsockopt.o	\
201	_so_listen.o		\
202	_so_recv.o		\
203	_so_recvfrom.o		\
204	_so_recvmsg.o		\
205	_so_send.o		\
206	_so_sendmsg.o		\
207	_so_sendto.o		\
208	_so_setsockopt.o	\
209	_so_shutdown.o		\
210	_so_socket.o		\
211	_so_socketpair.o	\
212	_sockconfig.o		\
213	acct.o			\
214	acl.o			\
215	adjtime.o		\
216	alarm.o			\
217	brk.o			\
218	chdir.o			\
219	chroot.o		\
220	cladm.o			\
221	close.o			\
222	execve.o		\
223	exit.o			\
224	facl.o			\
225	fchdir.o		\
226	fchroot.o		\
227	fdsync.o		\
228	fpathconf.o		\
229	fstatfs.o		\
230	fstatvfs.o		\
231	getcpuid.o		\
232	getdents.o		\
233	getegid.o		\
234	geteuid.o		\
235	getgid.o		\
236	getgroups.o		\
237	gethrtime.o		\
238	getitimer.o		\
239	getmsg.o		\
240	getpid.o		\
241	getpmsg.o		\
242	getppid.o		\
243	getrandom.o		\
244	getrlimit.o		\
245	getuid.o		\
246	gtty.o			\
247	install_utrap.o		\
248	ioctl.o			\
249	kaio.o			\
250	kill.o			\
251	llseek.o		\
252	lseek.o			\
253	memcntl.o		\
254	mincore.o		\
255	mmap.o			\
256	mmapobjsys.o		\
257	modctl.o		\
258	mount.o			\
259	mprotect.o		\
260	munmap.o		\
261	nice.o			\
262	ntp_adjtime.o		\
263	ntp_gettime.o		\
264	p_online.o		\
265	pathconf.o		\
266	pause.o			\
267	pcsample.o		\
268	pipe2.o			\
269	pollsys.o		\
270	pread.o			\
271	preadv.o		\
272	priocntlset.o		\
273	processor_bind.o	\
274	processor_info.o	\
275	profil.o		\
276	psecflagsset.o		\
277	putmsg.o		\
278	putpmsg.o		\
279	pwrite.o		\
280	pwritev.o		\
281	read.o			\
282	readv.o			\
283	resolvepath.o		\
284	seteguid.o		\
285	setgid.o		\
286	setgroups.o		\
287	setitimer.o		\
288	setreid.o		\
289	setrlimit.o		\
290	setuid.o		\
291	sigaltstk.o		\
292	sigprocmsk.o		\
293	sigsendset.o		\
294	sigsuspend.o		\
295	statfs.o		\
296	statvfs.o		\
297	stty.o			\
298	sync.o			\
299	sysconfig.o		\
300	sysfs.o			\
301	sysinfo.o		\
302	syslwp.o		\
303	times.o			\
304	ulimit.o		\
305	umask.o			\
306	umount2.o		\
307	upanic.o		\
308	utssys.o		\
309	uucopy.o		\
310	vhangup.o		\
311	waitid.o		\
312	write.o			\
313	writev.o		\
314	yield.o
315
316SYSOBJS=			\
317	__clock_gettime.o	\
318	__getcontext.o		\
319	__uadmin.o		\
320	_lwp_mutex_unlock.o	\
321	_stack_grow.o		\
322	door.o			\
323	forkx.o			\
324	forkallx.o		\
325	gettimeofday.o		\
326	sparc_utrap_install.o	\
327	syscall.o		\
328	tls_get_addr.o		\
329	uadmin.o		\
330	umount.o		\
331	uname.o			\
332	vforkx.o
333
334# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
335# This macro should ALWAYS be empty; native APIs are already 'large file'.
336PORTGEN64=
337
338# objects from source under $(LIBCDIR)/port
339PORTFP=				\
340	__flt_decim.o		\
341	__flt_rounds.o		\
342	__tbl_10_b.o		\
343	__tbl_10_h.o		\
344	__tbl_10_s.o		\
345	__tbl_2_b.o		\
346	__tbl_2_h.o		\
347	__tbl_2_s.o		\
348	__tbl_fdq.o		\
349	__tbl_tens.o		\
350	__x_power.o		\
351	_base_sup.o		\
352	aconvert.o		\
353	decimal_bin.o		\
354	double_decim.o		\
355	econvert.o		\
356	fconvert.o		\
357	file_decim.o		\
358	finite.o		\
359	fp_data.o		\
360	func_decim.o		\
361	gconvert.o		\
362	hex_bin.o		\
363	ieee_globals.o		\
364	pack_float.o		\
365	sigfpe.o		\
366	string_decim.o
367
368PORTGEN=			\
369	_env_data.o		\
370	_xftw.o			\
371	a64l.o			\
372	abort.o			\
373	addsev.o		\
374	ascii_strncasecmp.o	\
375	assert.o		\
376	atexit.o		\
377	atfork.o		\
378	atof.o			\
379	atoi.o			\
380	atol.o			\
381	atoll.o			\
382	attrat.o		\
383	attropen.o		\
384	basename.o		\
385	calloc.o		\
386	catgets.o		\
387	catopen.o		\
388	cfgetispeed.o		\
389	cfgetospeed.o		\
390	cfree.o			\
391	cfsetispeed.o		\
392	cfsetospeed.o		\
393	cftime.o		\
394	clock.o			\
395	closedir.o		\
396	closefrom.o		\
397	confstr.o		\
398	crypt.o			\
399	csetlen.o		\
400	ctime.o			\
401	ctime_r.o		\
402	daemon.o		\
403	deflt.o			\
404	directio.o		\
405	dirname.o		\
406	div.o			\
407	drand48.o		\
408	dup.o			\
409	env_data.o		\
410	err.o			\
411	errno.o			\
412	euclen.o		\
413	event_port.o		\
414	execvp.o		\
415	fattach.o		\
416	fdetach.o		\
417	fdopendir.o		\
418	ffs.o			\
419	flock.o			\
420	fls.o			\
421	fmtmsg.o		\
422	freezero.o		\
423	ftime.o			\
424	ftok.o			\
425	fts.o			\
426	ftw.o			\
427	gcvt.o			\
428	get_nprocs.o		\
429	getauxv.o		\
430	getcwd.o		\
431	getdate_err.o		\
432	getdtblsize.o		\
433	getentropy.o		\
434	getenv.o		\
435	getexecname.o		\
436	getgrnam.o		\
437	getgrnam_r.o		\
438	gethostid.o		\
439	gethostname.o		\
440	gethz.o			\
441	getisax.o		\
442	getloadavg.o		\
443	getlogin.o		\
444	getmntent.o		\
445	getnetgrent.o		\
446	getopt.o		\
447	getopt_long.o		\
448	getpagesize.o		\
449	getpw.o			\
450	getpwnam.o		\
451	getpwnam_r.o		\
452	getrusage.o		\
453	getspent.o		\
454	getspent_r.o		\
455	getsubopt.o		\
456	gettxt.o		\
457	getusershell.o		\
458	getut.o			\
459	getutx.o		\
460	getvfsent.o		\
461	getwd.o			\
462	getwidth.o		\
463	getxby_door.o		\
464	gtxt.o			\
465	hsearch.o		\
466	iconv.o			\
467	imaxabs.o		\
468	imaxdiv.o		\
469	index.o			\
470	initgroups.o		\
471	insque.o		\
472	isaexec.o		\
473	isastream.o		\
474	isatty.o		\
475	killpg.o		\
476	klpdlib.o		\
477	l64a.o			\
478	lckpwdf.o		\
479	lconstants.o		\
480	ldivide.o		\
481	lexp10.o		\
482	lfind.o			\
483	lfmt.o			\
484	lfmt_log.o		\
485	lldiv.o			\
486	llog10.o		\
487	lltostr.o		\
488	lmath.o			\
489	localtime.o		\
490	lsearch.o		\
491	madvise.o		\
492	malloc.o		\
493	memalign.o		\
494	memrchr.o		\
495	memset_s.o		\
496	mkdev.o			\
497	mkdtemp.o		\
498	mkfifo.o		\
499	mkstemp.o		\
500	mktemp.o		\
501	mlock.o			\
502	mlockall.o		\
503	mon.o			\
504	msync.o			\
505	munlock.o		\
506	munlockall.o		\
507	ndbm.o			\
508	nftw.o			\
509	nlspath_checks.o	\
510	nsparse.o		\
511	nss_common.o		\
512	nss_dbdefs.o		\
513	nss_deffinder.o		\
514	opendir.o		\
515	opt_data.o		\
516	perror.o		\
517	pfmt.o			\
518	pfmt_data.o		\
519	pfmt_print.o		\
520	pipe.o			\
521	plock.o			\
522	poll.o			\
523	posix_fadvise.o		\
524	posix_fallocate.o	\
525	posix_madvise.o		\
526	posix_memalign.o	\
527	priocntl.o		\
528	priv_str_xlate.o	\
529	privlib.o		\
530	psecflags.o		\
531	psiginfo.o		\
532	psignal.o		\
533	pt.o			\
534	putpwent.o		\
535	putspent.o		\
536	raise.o			\
537	rand.o			\
538	random.o		\
539	rctlops.o		\
540	readdir.o		\
541	readdir_r.o		\
542	reallocarray.o		\
543	reallocf.o		\
544	recallocarray.o		\
545	realpath.o		\
546	reboot.o		\
547	regexpr.o		\
548	remove.o		\
549	rewinddir.o		\
550	rindex.o		\
551	scandir.o		\
552	seekdir.o		\
553	select.o		\
554	set_constraint_handler_s.o \
555	setlabel.o		\
556	setpriority.o		\
557	settimeofday.o		\
558	sh_locks.o		\
559	sigflag.o		\
560	siglist.o		\
561	sigsend.o		\
562	sigsetops.o		\
563	ssignal.o		\
564	ssp.o			\
565	stack.o			\
566	stpcpy.o		\
567	stpncpy.o		\
568	str2sig.o		\
569	strcase_charmap.o	\
570	strcat.o		\
571	strchrnul.o		\
572	strcspn.o		\
573	strdup.o		\
574	strerror.o		\
575	strlcat.o		\
576	strncat.o		\
577	strndup.o		\
578	strpbrk.o		\
579	strrchr.o		\
580	strsep.o		\
581	strsignal.o		\
582	strspn.o		\
583	strstr.o		\
584	strtod.o		\
585	strtoimax.o		\
586	strtok.o		\
587	strtok_r.o		\
588	strtonum.o		\
589	strtoumax.o		\
590	swab.o			\
591	swapctl.o		\
592	sysconf.o		\
593	syslog.o		\
594	tcdrain.o		\
595	tcflow.o		\
596	tcflush.o		\
597	tcgetattr.o		\
598	tcgetpgrp.o		\
599	tcgetsid.o		\
600	tcsendbreak.o		\
601	tcsetattr.o		\
602	tcsetpgrp.o		\
603	tell.o			\
604	telldir.o		\
605	tfind.o			\
606	time_data.o		\
607	time_gdata.o		\
608	timespec_get.o		\
609	tls_data.o		\
610	truncate.o		\
611	tsdalloc.o		\
612	tsearch.o		\
613	ttyname.o		\
614	ttyslot.o		\
615	ualarm.o		\
616	ucred.o			\
617	valloc.o		\
618	vlfmt.o			\
619	vpfmt.o			\
620	waitpid.o		\
621	walkstack.o		\
622	wdata.o			\
623	xgetwidth.o		\
624	xpg4.o			\
625	xpg6.o
626
627PORTINET=			\
628	inet_lnaof.o		\
629	inet_makeaddr.o		\
630	inet_network.o		\
631	inet_ntoa.o		\
632	inet_ntop.o		\
633	inet_pton.o
634
635PORTPRINT_W=			\
636	doprnt_w.o
637
638PORTPRINT=			\
639	asprintf.o		\
640	doprnt.o		\
641	fprintf.o		\
642	printf.o		\
643	snprintf.o		\
644	sprintf.o		\
645	vfprintf.o		\
646	vprintf.o		\
647	vsnprintf.o		\
648	vsprintf.o		\
649	vwprintf.o		\
650	wprintf.o
651
652# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
653# This macro should ALWAYS be empty; native APIs are already 'large file'.
654PORTSTDIO64=
655
656PORTSTDIO_W=			\
657	doscan_w.o
658
659PORTSTDIO=			\
660	__extensions.o		\
661	_endopen.o		\
662	_filbuf.o		\
663	_findbuf.o		\
664	_flsbuf.o		\
665	_stdio_flags.o		\
666	_wrtchk.o		\
667	clearerr.o		\
668	ctermid.o		\
669	ctermid_r.o		\
670	cuserid.o		\
671	data.o			\
672	doscan.o		\
673	fdopen.o		\
674	feof.o			\
675	ferror.o		\
676	fgetc.o			\
677	fgets.o			\
678	fileno.o		\
679	flockf.o		\
680	flush.o			\
681	fmemopen.o		\
682	fopen.o			\
683	fpos.o			\
684	fputc.o			\
685	fputs.o			\
686	fread.o			\
687	fseek.o			\
688	fseeko.o		\
689	ftell.o			\
690	ftello.o		\
691	fwrite.o		\
692	getc.o			\
693	getchar.o		\
694	getline.o		\
695	getpass.o		\
696	gets.o			\
697	getw.o			\
698	mse.o			\
699	open_memstream.o	\
700	open_wmemstream.o	\
701	popen.o			\
702	putc.o			\
703	putchar.o		\
704	puts.o			\
705	putw.o			\
706	rewind.o		\
707	scanf.o			\
708	setbuf.o		\
709	setbuffer.o		\
710	setvbuf.o		\
711	system.o		\
712	tempnam.o		\
713	tmpfile.o		\
714	tmpnam_r.o		\
715	ungetc.o		\
716	vscanf.o		\
717	vwscanf.o		\
718	wscanf.o
719
720PORTI18N=			\
721	getwchar.o		\
722	putwchar.o		\
723	putws.o			\
724	strtows.o		\
725	wcsnlen.o		\
726	wcstoimax.o		\
727	wcstol.o		\
728	wcstoul.o		\
729	wcswcs.o		\
730	wscat.o			\
731	wschr.o			\
732	wscmp.o			\
733	wscpy.o			\
734	wscspn.o		\
735	wsdup.o			\
736	wslen.o			\
737	wsncat.o		\
738	wsncmp.o		\
739	wsncpy.o		\
740	wspbrk.o		\
741	wsprintf.o		\
742	wsrchr.o		\
743	wsscanf.o		\
744	wsspn.o			\
745	wstod.o			\
746	wstok.o			\
747	wstol.o			\
748	wstoll.o		\
749	wsxfrm.o		\
750	wmemchr.o		\
751	wmemcmp.o		\
752	wmemcpy.o		\
753	wmemmove.o		\
754	wmemset.o		\
755	wcsstr.o		\
756	gettext.o		\
757	gettext_real.o		\
758	gettext_util.o		\
759	gettext_gnu.o		\
760	plural_parser.o		\
761	wdresolve.o		\
762	_ctype.o		\
763	isascii.o		\
764	toascii.o
765
766PORTI18N_COND=			\
767	wcstol_longlong.o	\
768	wcstoul_longlong.o
769
770PORTLOCALE=			\
771	big5.o			\
772	btowc.o			\
773	c16rtomb.o		\
774	c32rtomb.o		\
775	collate.o		\
776	collcmp.o		\
777	euc.o			\
778	fnmatch.o		\
779	fgetwc.o		\
780	fgetws.o		\
781	fix_grouping.o		\
782	fputwc.o		\
783	fputws.o		\
784	fwide.o			\
785	gb18030.o		\
786	gb2312.o		\
787	gbk.o			\
788	getdate.o		\
789	isdigit.o		\
790	iswctype.o		\
791	ldpart.o		\
792	lmessages.o		\
793	lnumeric.o		\
794	lmonetary.o		\
795	localeconv.o		\
796	localeimpl.o		\
797	mbftowc.o		\
798	mblen.o			\
799	mbrlen.o		\
800	mbrtoc16.o		\
801	mbrtoc32.o		\
802	mbrtowc.o		\
803	mbsinit.o		\
804	mbsnrtowcs.o		\
805	mbsrtowcs.o		\
806	mbstowcs.o		\
807	mbtowc.o		\
808	mskanji.o		\
809	nextwctype.o		\
810	nl_langinfo.o		\
811	none.o			\
812	rune.o			\
813	runetype.o		\
814	setlocale.o		\
815	setrunelocale.o		\
816	strcasecmp.o		\
817	strcasestr.o		\
818	strcoll.o		\
819	strfmon.o		\
820	strftime.o		\
821	strncasecmp.o		\
822	strptime.o		\
823	strxfrm.o		\
824	table.o			\
825	timelocal.o		\
826	tolower.o		\
827	towlower.o		\
828	ungetwc.o		\
829	utf8.o			\
830	wcrtomb.o		\
831	wcscasecmp.o		\
832	wcscoll.o		\
833	wcsftime.o		\
834	wcsnrtombs.o		\
835	wcsrtombs.o		\
836	wcstombs.o		\
837	wcswidth.o		\
838	wcsxfrm.o		\
839	wctob.o			\
840	wctomb.o		\
841	wctrans.o		\
842	wctype.o		\
843	wcwidth.o		\
844	wscol.o
845
846AIOOBJS=			\
847	aio.o			\
848	aio_alloc.o		\
849	posix_aio.o
850
851RTOBJS=				\
852	clock_timer.o		\
853	mqueue.o		\
854	pos4obj.o		\
855	sched.o			\
856	sem.o			\
857	shm.o			\
858	sigev_thread.o
859
860SECFLAGSOBJS=			\
861	secflags.o
862
863TPOOLOBJS=			\
864	thread_pool.o
865
866THREADSOBJS=			\
867	alloc.o			\
868	assfail.o		\
869	c11_thr.o		\
870	cancel.o		\
871	door_calls.o		\
872	tmem.o			\
873	pthr_attr.o		\
874	pthr_barrier.o		\
875	pthr_cond.o		\
876	pthr_mutex.o		\
877	pthr_rwlock.o		\
878	pthread.o		\
879	rwlock.o		\
880	scalls.o		\
881	sema.o			\
882	sigaction.o		\
883	spawn.o			\
884	synch.o			\
885	tdb_agent.o		\
886	thr.o			\
887	thread_interface.o	\
888	tls.o			\
889	tsd.o
890
891THREADSMACHOBJS=		\
892	machdep.o
893
894THREADSASMOBJS=			\
895	asm_subr.o
896
897UNICODEOBJS=			\
898	u8_textprep.o		\
899	uconv.o
900
901UNWINDMACHOBJS=			\
902	unwind.o
903
904UNWINDASMOBJS=			\
905	unwind_frame.o
906
907# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
908# This macro should ALWAYS be empty; native APIs are already 'large file'.
909PORTSYS64=
910
911PORTSYS=			\
912	_autofssys.o		\
913	access.o		\
914	acctctl.o		\
915	bsd_signal.o		\
916	chmod.o			\
917	chown.o			\
918	corectl.o		\
919	eventfd.o		\
920	epoll.o			\
921	exacctsys.o		\
922	execl.o			\
923	execle.o		\
924	execv.o			\
925	fcntl.o			\
926	getpagesizes.o		\
927	getpeerucred.o		\
928	inst_sync.o		\
929	issetugid.o		\
930	label.o			\
931	link.o			\
932	lockf.o			\
933	lwp.o			\
934	lwp_cond.o		\
935	lwp_rwlock.o		\
936	lwp_sigmask.o		\
937	meminfosys.o		\
938	mkdir.o			\
939	mknod.o			\
940	msgsys.o		\
941	nfssys.o		\
942	open.o			\
943	pgrpsys.o		\
944	posix_sigwait.o		\
945	ppriv.o			\
946	psetsys.o		\
947	rctlsys.o		\
948	readlink.o		\
949	rename.o		\
950	sbrk.o			\
951	semsys.o		\
952	set_errno.o		\
953	sharefs.o		\
954	shmsys.o		\
955	sidsys.o		\
956	siginterrupt.o		\
957	signal.o		\
958	signalfd.o		\
959	sigpending.o		\
960	sigstack.o		\
961	stat.o			\
962	symlink.o		\
963	tasksys.o		\
964	time.o			\
965	time_util.o		\
966	timerfd.o		\
967	ucontext.o		\
968	unlink.o		\
969	ustat.o			\
970	utimesys.o		\
971	zone.o
972
973PORTREGEX=			\
974	glob.o			\
975	regcmp.o		\
976	regcomp.o		\
977	regerror.o		\
978	regex.o			\
979	regexec.o		\
980	regfree.o		\
981	wordexp.o
982
983VALUES=	values-Xa.o
984
985MOSTOBJS=			\
986	$(STRETS)		\
987	$(CRTOBJS)		\
988	$(DYNOBJS)		\
989	$(FPOBJS)		\
990	$(FPOBJS64)		\
991	$(FPASMOBJS)		\
992	$(ATOMICOBJS)		\
993	$(CHACHAOBJS)		\
994	$(XATTROBJS)		\
995	$(COMOBJS)		\
996	$(GENOBJS)		\
997	$(PRFOBJS)		\
998	$(PORTFP)		\
999	$(PORTGEN)		\
1000	$(PORTGEN64)		\
1001	$(PORTI18N)		\
1002	$(PORTI18N_COND)	\
1003	$(PORTINET)		\
1004	$(PORTLOCALE)		\
1005	$(PORTPRINT)		\
1006	$(PORTPRINT_W)		\
1007	$(PORTREGEX)		\
1008	$(PORTSTDIO)		\
1009	$(PORTSTDIO64)		\
1010	$(PORTSTDIO_W)		\
1011	$(PORTSYS)		\
1012	$(PORTSYS64)		\
1013	$(AIOOBJS)		\
1014	$(RTOBJS)		\
1015	$(SECFLAGSOBJS)		\
1016	$(TPOOLOBJS)		\
1017	$(THREADSOBJS)		\
1018	$(THREADSMACHOBJS)	\
1019	$(THREADSASMOBJS)	\
1020	$(UNICODEOBJS)		\
1021	$(UNWINDMACHOBJS)	\
1022	$(UNWINDASMOBJS)	\
1023	$(COMSYSOBJS)		\
1024	$(SYSOBJS)		\
1025	$(COMSYSOBJS64)		\
1026	$(SYSOBJS64)		\
1027	$(VALUES)
1028
1029TRACEOBJS=			\
1030	plockstat.o
1031
1032# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
1033# modules whose source is provided in the $(SRC)/lib/crt directory.
1034# This must be done because otherwise the Sun C compiler would insert
1035# its own versions of these modules and those versions contain code
1036# to call out to C++ initialization functions.  Such C++ initialization
1037# functions can call back into libc before thread initialization is
1038# complete and this leads to segmentation violations and other problems.
1039# Since libc contains no C++ code, linking with the minimal crti.o and
1040# crtn.o modules is safe and avoids the problems described above.
1041OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
1042CRTSRCS= ../../crt/sparc
1043
1044# include common library definitions
1045include $(SRC)/lib/Makefile.lib
1046include $(SRC)/lib/Makefile.lib.64
1047
1048# we need to override the default SONAME here because we might
1049# be building a variant object (still libc.so.1, but different filename)
1050SONAME = libc.so.1
1051
1052CFLAGS64 += $(CCVERBOSE)
1053
1054# This is necessary to avoid problems with calling _ex_unwind().
1055# We probably don't want any inlining anyway.
1056CFLAGS64 += -xinline=
1057
1058CERRWARN += -_gcc=-Wno-parentheses
1059CERRWARN += -_gcc=-Wno-switch
1060CERRWARN += $(CNOWARN_UNINIT)
1061CERRWARN += -_gcc=-Wno-unused-value
1062CERRWARN += -_gcc=-Wno-unused-label
1063CERRWARN += -_gcc=-Wno-unused-variable
1064CERRWARN += -_gcc=-Wno-type-limits
1065CERRWARN += -_gcc=-Wno-char-subscripts
1066CERRWARN += -_gcc=-Wno-clobbered
1067CERRWARN += -_gcc=-Wno-unused-function
1068CERRWARN += -_gcc=-Wno-address
1069
1070# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1071# enables ASSERT() checking in the threads portion of the library.
1072# This is automatically enabled for DEBUG builds, not for non-debug builds.
1073THREAD_DEBUG =
1074$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
1075
1076# Make string literals read-only to save memory.
1077CFLAGS64 += $(XSTRCONST)
1078
1079ALTPICS= $(TRACEOBJS:%=pics/%)
1080
1081$(DYNLIB) := BUILD.SO = $(LD) -o $@ $(GSHARED) $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1082
1083MAPFILES =	$(LIBCDIR)/port/mapfile-vers
1084
1085sparcv9_C_PICFLAGS= $(sparcv9_C_BIGPICFLAGS)
1086CFLAGS64 +=	$(EXTN_CFLAGS)
1087CPPFLAGS=	-D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
1088		-I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1089ASFLAGS=	$(EXTN_ASFLAGS) $(AS_BIGPICFLAGS) -P -D__STDC__ -D_ASM -D__sparcv9 $(CPPFLAGS) \
1090		$(sparcv9_AS_XARCH)
1091
1092# As a favor to the dtrace syscall provider, libc still calls the
1093# old syscall traps that have been obsoleted by the *at() interfaces.
1094# Delete this to compile libc using only the new *at() system call traps
1095CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
1096
1097# Inform the run-time linker about libc specialized initialization
1098RTLDINFO =	-z rtldinfo=tls_rtldinfo
1099DYNFLAGS +=	$(RTLDINFO)
1100
1101# Force libc's internal references to be resolved immediately upon loading
1102# in order to avoid critical region problems.  Since almost all libc symbols
1103# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1104DYNFLAGS +=	-znow
1105
1106DYNFLAGS +=	$(EXTN_DYNFLAGS)
1107
1108BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
1109
1110# Override this top level flag so the compiler builds in its native
1111# C99 mode.  This has been enabled to support the complex arithmetic
1112# added to libc.
1113CSTD=	$(CSTD_GNU99)
1114
1115# libc method of building an archive
1116# The "$(GREP) -v ' L '" part is necessary only until
1117# lorder is fixed to ignore thread-local variables.
1118BUILD.AR= $(RM) $@ ; \
1119	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1120
1121# extra files for the clean target
1122CLEANFILES=			\
1123	$(LIBCDIR)/port/gen/errlst.c	\
1124	$(LIBCDIR)/port/gen/new_list.c	\
1125	assym.h			\
1126	genassym		\
1127	pics/crti.o		\
1128	pics/crtn.o		\
1129	$(ALTPICS)
1130
1131CLOBBERFILES +=	$(LIB_PIC)
1132
1133# conditional assignments
1134$(DYNLIB) := CRTI = crti.o
1135$(DYNLIB) := CRTN = crtn.o
1136
1137# Files which need the threads .il inline template
1138TIL=				\
1139	aio.o			\
1140	alloc.o			\
1141	assfail.o		\
1142	atexit.o		\
1143	atfork.o		\
1144	cancel.o		\
1145	door_calls.o		\
1146	err.o			\
1147	errno.o			\
1148	getctxt.o		\
1149	lwp.o			\
1150	ma.o			\
1151	machdep.o		\
1152	posix_aio.o		\
1153	pthr_attr.o		\
1154	pthr_barrier.o		\
1155	pthr_cond.o		\
1156	pthr_mutex.o		\
1157	pthr_rwlock.o		\
1158	pthread.o		\
1159	rand.o			\
1160	rwlock.o		\
1161	scalls.o		\
1162	sched.o			\
1163	sema.o			\
1164	sigaction.o		\
1165	sigev_thread.o		\
1166	spawn.o			\
1167	stack.o			\
1168	swapctxt.o		\
1169	synch.o			\
1170	tdb_agent.o		\
1171	thr.o			\
1172	thread_interface.o	\
1173	thread_pool.o		\
1174	tls.o			\
1175	tsd.o			\
1176	unwind.o
1177
1178$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/sparcv9.il
1179
1180# Files in fp, port/fp subdirectories that need base.il inline template
1181IL=				\
1182	__flt_decim.o		\
1183	decimal_bin.o
1184
1185$(IL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/fp/base.il
1186
1187# Files in fp subdirectory which need __quad.il inline template
1188QIL=				\
1189	_Q_add.o		\
1190	_Q_cmp.o		\
1191	_Q_cmpe.o		\
1192	_Q_div.o		\
1193	_Q_dtoq.o		\
1194	_Q_fcc.o		\
1195	_Q_mul.o		\
1196	_Q_qtod.o		\
1197	_Q_qtoi.o		\
1198	_Q_qtos.o		\
1199	_Q_qtou.o		\
1200	_Q_sqrt.o		\
1201	_Q_stoq.o		\
1202	_Q_sub.o		\
1203	_Qp_qtox.o		\
1204	_Qp_qtoux.o
1205
1206$(QIL:%=pics/%) := CFLAGS64 += $(LIBCDIR)/$(MACH)/fp/__quad.il
1207pics/_Qp%.o := CFLAGS64 += -I$(LIBCDIR)/$(MACH)/fp
1208pics/_Q%.o := sparcv9_COPTFLAG = -xO4 -xchip=ultra
1209
1210# Files in crt subdirectory which need muldiv64.il inline template
1211#CIL=	mul64.o divrem64.o
1212#$(CIL:%=pics/%) := CFLAGS += $(LIBCBASE)/crt/mul64.il
1213
1214# large-file-aware components that should be built large
1215
1216#$(COMSYSOBJS64:%=pics/%) := \
1217#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1218
1219#$(SYSOBJS64:%=pics/%) := \
1220#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1221
1222#$(PORTGEN64:%=pics/%) := \
1223#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1224
1225#$(PORTSTDIO64:%=pics/%) := \
1226#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1227
1228#$(PORTSYS64:%=pics/%) := \
1229#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1230
1231$(PORTSTDIO_W:%=pics/%) := \
1232	CPPFLAGS += -D_WIDE
1233
1234$(PORTPRINT_W:%=pics/%) := \
1235	CPPFLAGS += -D_WIDE
1236
1237$(PORTI18N_COND:%=pics/%) := \
1238	CPPFLAGS += -D_WCS_LONGLONG
1239
1240pics/arc4random.o :=	CPPFLAGS += -I$(SRC)/common/crypto/chacha
1241
1242# Files which need extra optimization
1243pics/getenv.o := sparcv9_COPTFLAG = -xO4
1244
1245#
1246# Disable the stack protector due to issues with bootstrapping rtld. See
1247# cmd/sgs/rtld/Makefile.com for more information.
1248#
1249STACKPROTECT = none
1250
1251.KEEP_STATE:
1252
1253all: $(LIBS) $(LIB_PIC)
1254
1255# object files that depend on inline template
1256$(TIL:%=pics/%): $(LIBCBASE)/threads/sparcv9.il
1257$(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1258$(QIL:%=pics/%): $(LIBCDIR)/$(MACH)/fp/__quad.il
1259#$(CIL:%=pics/%): $(LIBCBASE)/crt/muldiv64.il
1260
1261# include common libc targets
1262include $(LIBCDIR)/Makefile.targ
1263
1264# We need to strip out all CTF and DOF data from the static library
1265$(LIB_PIC) := DIR = pics
1266$(LIB_PIC): pics $$(PICS)
1267	$(BUILD.AR)
1268	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1269	$(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1270	$(AR) -ts $@ > /dev/null
1271	$(POST_PROCESS_A)
1272
1273# special cases
1274#$(STRETS:%=pics/%): crt/stret.s
1275#	$(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
1276#	$(POST_PROCESS_S_O)
1277
1278#crt/_rtbootld.s:	crt/_rtboot.s crt/_rtld.c
1279#	$(CC) $(CPPFLAGS) -O -S -K pic crt/_rtld.c -o crt/_rtld.s
1280#	$(CAT) crt/_rtboot.s crt/_rtld.s > $@
1281#	$(RM) crt/_rtld.s
1282
1283ASSYMDEP_OBJS=			\
1284	_lwp_mutex_unlock.o	\
1285	_stack_grow.o		\
1286	asm_subr.o		\
1287	setjmp.o		\
1288	smt_pause.o		\
1289	tls_get_addr.o		\
1290	unwind_frame.o		\
1291	vforkx.o
1292
1293$(ASSYMDEP_OBJS:%=pics/%)	:=	CPPFLAGS += -I.
1294
1295$(ASSYMDEP_OBJS:%=pics/%): assym.h
1296
1297# assym.h build rules
1298
1299assym.h := CFLAGS64 += $(CCGDEBUG)
1300
1301GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
1302LDFLAGS.native = $(LDASSERTS) $(BDIRECT)
1303
1304genassym := NATIVE_LIBS += libc.so
1305
1306genassym: $(GENASSYM_C)
1307	$(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
1308		$(CPPFLAGS.native) $(LDFLAGS.native) -o $@ $(GENASSYM_C)
1309
1310OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1311
1312assym.h: $(OFFSETS) genassym
1313	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1314	./genassym >>$@
1315
1316# derived C source and related explicit dependencies
1317$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1318	cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1319
1320pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c
1321