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