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