xref: /illumos-gate/usr/src/lib/libc/sparc/Makefile.com (revision a92282e44f968185a6bba094d1e5fece2da819cf)
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
35CPP=		/usr/lib/cpp
36TARGET_ARCH=	sparc
37
38# objects are grouped by source directory
39
40# Symbol capabilities objects.
41EXTPICS=			\
42	$(LIBCDIR)/capabilities/sun4u/sparc/pics/symcap.o \
43	$(LIBCDIR)/capabilities/sun4u-opl/sparc/pics/symcap.o \
44	$(LIBCDIR)/capabilities/sun4u-us3-hwcap1/sparc/pics/symcap.o \
45	$(LIBCDIR)/capabilities/sun4u-us3-hwcap2/sparc/pics/symcap.o \
46	$(LIBCDIR)/capabilities/sun4v-hwcap1/sparc/pics/symcap.o \
47	$(LIBCDIR)/capabilities/sun4v-hwcap2/sparc/pics/symcap.o
48
49# local objects
50STRETS=				\
51	stret1.o		\
52	stret2.o		\
53	stret4.o
54
55CRTOBJS=			\
56	_ftou.o			\
57	cerror.o		\
58	cerror64.o		\
59	hwmuldiv.o
60
61DYNOBJS=			\
62	_rtbootld.o
63
64FPOBJS=				\
65	_D_cplx_div.o		\
66	_D_cplx_div_ix.o	\
67	_D_cplx_div_rx.o	\
68	_D_cplx_mul.o		\
69	_F_cplx_div.o		\
70	_F_cplx_div_ix.o	\
71	_F_cplx_div_rx.o	\
72	_F_cplx_mul.o		\
73	_Q_add.o		\
74	_Q_cmp.o		\
75	_Q_cmpe.o		\
76	_Q_cplx_div.o		\
77	_Q_cplx_div_ix.o	\
78	_Q_cplx_div_rx.o	\
79	_Q_cplx_lr_div.o	\
80	_Q_cplx_lr_div_ix.o	\
81	_Q_cplx_lr_div_rx.o	\
82	_Q_cplx_lr_mul.o	\
83	_Q_cplx_mul.o		\
84	_Q_div.o		\
85	_Q_dtoq.o		\
86	_Q_fcc.o		\
87	_Q_itoq.o		\
88	_Q_lltoq.o		\
89	_Q_mul.o		\
90	_Q_neg.o		\
91	_Q_qtod.o		\
92	_Q_qtoi.o		\
93	_Q_qtos.o		\
94	_Q_qtou.o		\
95	_Q_scl.o		\
96	_Q_set_except.o		\
97	_Q_sqrt.o		\
98	_Q_stoq.o		\
99	_Q_sub.o		\
100	_Q_ulltoq.o		\
101	_Q_utoq.o		\
102	__quad_mag.o
103
104FPASMOBJS=			\
105	_Q_get_rp_rd.o		\
106	fpgetmask.o		\
107	fpgetrnd.o		\
108	fpgetsticky.o		\
109	fpsetmask.o		\
110	fpsetrnd.o		\
111	fpsetsticky.o
112
113$(__GNUC)FPASMOBJS +=		\
114	__quad.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	bzero.o			\
129	bsearch.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
139DTRACEOBJS=			\
140	dtrace_data.o
141
142SECFLAGSOBJS=			\
143	secflags.o
144
145GENOBJS=			\
146	_getsp.o		\
147	_xregs_clrptr.o		\
148	abs.o			\
149	alloca.o		\
150	arc4random.o		\
151	arc4random_uniform.o	\
152	ascii_strcasecmp.o	\
153	byteorder.o		\
154	cuexit.o		\
155	ecvt.o			\
156	endian.o		\
157	errlst.o		\
158	getctxt.o		\
159	ladd.o			\
160	lmul.o			\
161	lock.o			\
162	lshiftl.o		\
163	lsign.o			\
164	lsub.o			\
165	makectxt.o		\
166	memchr.o		\
167	memcmp.o		\
168	new_list.o		\
169	setjmp.o		\
170	siginfolst.o		\
171	siglongjmp.o		\
172	smt_pause.o		\
173	sparc_data.o		\
174	strchr.o		\
175	strcmp.o		\
176	strlcpy.o		\
177	strncmp.o		\
178	strncpy.o		\
179	strnlen.o		\
180	swapctxt.o		\
181	sync_instruction_memory.o
182
183# sysobjs that contain large-file interfaces
184COMSYSOBJS64=			\
185	fstatvfs64.o		\
186	getdents64.o		\
187	getrlimit64.o		\
188	lseek64.o		\
189	mmap64.o		\
190	pread64.o		\
191	preadv64.o		\
192	pwrite64.o		\
193	pwritev64.o		\
194	setrlimit64.o		\
195	statvfs64.o
196
197SYSOBJS64=
198
199COMSYSOBJS=			\
200	__clock_timer.o		\
201	__getloadavg.o		\
202	__rusagesys.o		\
203	__signotify.o		\
204	__sigrt.o		\
205	__time.o		\
206	_lgrp_home_fast.o	\
207	_lgrpsys.o		\
208	_nfssys.o		\
209	_portfs.o		\
210	_pset.o			\
211	_rpcsys.o		\
212	_sigaction.o		\
213	_so_accept.o		\
214	_so_bind.o		\
215	_so_connect.o		\
216	_so_getpeername.o	\
217	_so_getsockname.o	\
218	_so_getsockopt.o	\
219	_so_listen.o		\
220	_so_recv.o		\
221	_so_recvfrom.o		\
222	_so_recvmsg.o		\
223	_so_send.o		\
224	_so_sendmsg.o		\
225	_so_sendto.o		\
226	_so_setsockopt.o	\
227	_so_shutdown.o		\
228	_so_socket.o		\
229	_so_socketpair.o	\
230	_sockconfig.o		\
231	acct.o			\
232	acl.o			\
233	adjtime.o		\
234	alarm.o			\
235	brk.o			\
236	chdir.o			\
237	chroot.o		\
238	cladm.o			\
239	close.o			\
240	execve.o		\
241	exit.o			\
242	facl.o			\
243	fchdir.o		\
244	fchroot.o		\
245	fdsync.o		\
246	fpathconf.o		\
247	fstatfs.o		\
248	fstatvfs.o		\
249	getcpuid.o		\
250	getdents.o		\
251	getegid.o		\
252	geteuid.o		\
253	getgid.o		\
254	getgroups.o		\
255	gethrtime.o		\
256	getitimer.o		\
257	getmsg.o		\
258	getpid.o		\
259	getpmsg.o		\
260	getppid.o		\
261	getrandom.o		\
262	getrlimit.o		\
263	getuid.o		\
264	gtty.o			\
265	install_utrap.o		\
266	ioctl.o			\
267	kaio.o			\
268	kill.o			\
269	llseek.o		\
270	lseek.o			\
271	memcntl.o		\
272	mincore.o		\
273	mmap.o			\
274	mmapobjsys.o		\
275	modctl.o		\
276	mount.o			\
277	mprotect.o		\
278	munmap.o		\
279	nice.o			\
280	ntp_adjtime.o		\
281	ntp_gettime.o		\
282	p_online.o		\
283	pathconf.o		\
284	pause.o			\
285	pcsample.o		\
286	pipe2.o			\
287	pollsys.o		\
288	pread.o			\
289	preadv.o		\
290	priocntlset.o		\
291	processor_bind.o	\
292	processor_info.o	\
293	profil.o		\
294	psecflagsset.o		\
295	putmsg.o		\
296	putpmsg.o		\
297	pwrite.o		\
298	pwritev.o		\
299	read.o			\
300	readv.o			\
301	resolvepath.o		\
302	seteguid.o		\
303	setgid.o		\
304	setgroups.o		\
305	setitimer.o		\
306	setreid.o		\
307	setrlimit.o		\
308	setuid.o		\
309	sigaltstk.o		\
310	sigprocmsk.o		\
311	sigsendset.o		\
312	sigsuspend.o		\
313	statfs.o		\
314	statvfs.o		\
315	stty.o			\
316	sync.o			\
317	sysconfig.o		\
318	sysfs.o			\
319	sysinfo.o		\
320	syslwp.o		\
321	times.o			\
322	ulimit.o		\
323	umask.o			\
324	umount2.o		\
325	upanic.o		\
326	utssys.o		\
327	uucopy.o		\
328	vhangup.o		\
329	waitid.o		\
330	write.o			\
331	writev.o		\
332	yield.o
333
334SYSOBJS=			\
335	__clock_gettime.o	\
336	__getcontext.o		\
337	_lwp_mutex_unlock.o	\
338	_stack_grow.o		\
339	__uadmin.o		\
340	door.o			\
341	forkx.o			\
342	forkallx.o		\
343	gettimeofday.o		\
344	ptrace.o		\
345	syscall.o		\
346	tls_get_addr.o		\
347	uadmin.o		\
348	umount.o		\
349	uname.o			\
350	vforkx.o
351
352# objects under $(LIBCDIR)/port which contain transitional large file interfaces
353PORTGEN64=			\
354	_xftw64.o		\
355	attropen64.o		\
356	fts64.o			\
357	ftw64.o			\
358	mkstemp64.o		\
359	nftw64.o		\
360	tell64.o		\
361	truncate64.o
362
363# objects from source under $(LIBCDIR)/port
364PORTFP=				\
365	__flt_decim.o		\
366	__flt_rounds.o		\
367	__tbl_10_b.o		\
368	__tbl_10_h.o		\
369	__tbl_10_s.o		\
370	__tbl_2_b.o		\
371	__tbl_2_h.o		\
372	__tbl_2_s.o		\
373	__tbl_fdq.o		\
374	__tbl_tens.o		\
375	__x_power.o		\
376	_base_sup.o		\
377	aconvert.o		\
378	decimal_bin.o		\
379	double_decim.o		\
380	econvert.o		\
381	fconvert.o		\
382	file_decim.o		\
383	finite.o		\
384	fp_data.o		\
385	func_decim.o		\
386	gconvert.o		\
387	hex_bin.o		\
388	ieee_globals.o		\
389	pack_float.o		\
390	sigfpe.o		\
391	string_decim.o		\
392	ashldi3.o		\
393	ashrdi3.o		\
394	cmpdi2.o		\
395	divdi3.o		\
396	floatdidf.o		\
397	floatdisf.o		\
398	floatundidf.o		\
399	floatundisf.o		\
400	lshrdi3.o		\
401	moddi3.o		\
402	muldi3.o		\
403	qdivrem.o		\
404	ucmpdi2.o		\
405	udivdi3.o		\
406	umoddi3.o
407
408PORTGEN=			\
409	_env_data.o		\
410	_ftoll.o		\
411	_ftoull.o		\
412	_xftw.o			\
413	a64l.o			\
414	abort.o			\
415	addsev.o		\
416	ascii_strncasecmp.o	\
417	assert.o		\
418	atexit.o		\
419	atfork.o		\
420	atof.o			\
421	atoi.o			\
422	atol.o			\
423	atoll.o			\
424	attrat.o		\
425	attropen.o		\
426	basename.o		\
427	calloc.o		\
428	catgets.o		\
429	catopen.o		\
430	cfgetispeed.o		\
431	cfgetospeed.o		\
432	cfree.o			\
433	cfsetispeed.o		\
434	cfsetospeed.o		\
435	cftime.o		\
436	clock.o			\
437	closedir.o		\
438	closefrom.o		\
439	confstr.o		\
440	crypt.o			\
441	csetlen.o		\
442	ctime.o			\
443	ctime_r.o		\
444	daemon.o		\
445	deflt.o			\
446	directio.o		\
447	dirname.o		\
448	div.o			\
449	drand48.o		\
450	dup.o			\
451	env_data.o		\
452	err.o			\
453	errno.o			\
454	euclen.o		\
455	event_port.o		\
456	execvp.o		\
457	fattach.o		\
458	fdetach.o		\
459	fdopendir.o		\
460	ffs.o			\
461	flock.o			\
462	fls.o			\
463	fmtmsg.o		\
464	freezero.o		\
465	ftime.o			\
466	ftok.o			\
467	fts.o			\
468	ftw.o			\
469	gcvt.o			\
470	get_nprocs.o		\
471	getauxv.o		\
472	getcwd.o		\
473	getdate_err.o		\
474	getdtblsize.o		\
475	getentropy.o		\
476	getenv.o		\
477	getexecname.o		\
478	getgrnam.o		\
479	getgrnam_r.o		\
480	gethostid.o		\
481	gethostname.o		\
482	gethz.o			\
483	getisax.o		\
484	getloadavg.o		\
485	getlogin.o		\
486	getmntent.o		\
487	getnetgrent.o		\
488	getopt.o		\
489	getopt_long.o		\
490	getpagesize.o		\
491	getpw.o			\
492	getpwnam.o		\
493	getpwnam_r.o		\
494	getrusage.o		\
495	getspent.o		\
496	getspent_r.o		\
497	getsubopt.o		\
498	gettxt.o		\
499	getusershell.o		\
500	getut.o			\
501	getutx.o		\
502	getvfsent.o		\
503	getwd.o			\
504	getwidth.o		\
505	getxby_door.o		\
506	gtxt.o			\
507	hsearch.o		\
508	iconv.o			\
509	imaxabs.o		\
510	imaxdiv.o		\
511	index.o			\
512	initgroups.o		\
513	insque.o		\
514	isaexec.o		\
515	isastream.o		\
516	isatty.o		\
517	killpg.o		\
518	klpdlib.o		\
519	l64a.o			\
520	lckpwdf.o		\
521	lconstants.o		\
522	ldivide.o		\
523	lexp10.o		\
524	lfind.o			\
525	lfmt.o			\
526	lfmt_log.o		\
527	llabs.o			\
528	lldiv.o			\
529	llog10.o		\
530	lltostr.o		\
531	localtime.o		\
532	lsearch.o		\
533	madvise.o		\
534	malloc.o		\
535	memalign.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# Files which need the threads .il inline template
1206TIL=				\
1207	aio.o			\
1208	alloc.o			\
1209	assfail.o		\
1210	atexit.o		\
1211	atfork.o		\
1212	cancel.o		\
1213	door_calls.o		\
1214	err.o			\
1215	errno.o			\
1216	getctxt.o		\
1217	lwp.o			\
1218	ma.o			\
1219	machdep.o		\
1220	posix_aio.o		\
1221	pthr_attr.o		\
1222	pthr_barrier.o		\
1223	pthr_cond.o		\
1224	pthr_mutex.o		\
1225	pthr_rwlock.o		\
1226	pthread.o		\
1227	rand.o			\
1228	rwlock.o		\
1229	scalls.o		\
1230	sched.o			\
1231	sema.o			\
1232	sigaction.o		\
1233	sigev_thread.o		\
1234	spawn.o			\
1235	stack.o			\
1236	swapctxt.o		\
1237	synch.o			\
1238	tdb_agent.o		\
1239	thr.o			\
1240	thread_interface.o	\
1241	thread_pool.o		\
1242	tls.o			\
1243	tsd.o			\
1244	unwind.o
1245
1246$(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il
1247
1248# special kludge for inlines with 'cas':
1249pics/rwlock.o pics/synch.o pics/lwp.o pics/door_calls.o := \
1250	sparc_CFLAGS += -_gcc=-Wa,-xarch=v8plus
1251
1252# Files in port/fp subdirectory that need base.il inline template
1253IL=				\
1254	__flt_decim.o		\
1255	decimal_bin.o
1256
1257$(IL:%=pics/%) := CFLAGS += $(LIBCBASE)/fp/base.il
1258
1259# Files in fp subdirectory which need __quad.il inline template
1260QIL=				\
1261	_Q_add.o		\
1262	_Q_cmp.o		\
1263	_Q_cmpe.o		\
1264	_Q_div.o		\
1265	_Q_dtoq.o		\
1266	_Q_fcc.o		\
1267	_Q_mul.o		\
1268	_Q_qtod.o		\
1269	_Q_qtoi.o		\
1270	_Q_qtos.o		\
1271	_Q_qtou.o		\
1272	_Q_sqrt.o		\
1273	_Q_stoq.o		\
1274	_Q_sub.o
1275
1276$(QIL:%=pics/%) := CFLAGS += $(LIBCDIR)/$(MACH)/fp/__quad.il
1277pics/_Q%.o := sparc_COPTFLAG = -xO4 -dalign
1278pics/__quad%.o := sparc_COPTFLAG = -xO4 -dalign
1279
1280# large-file-aware components that should be built large
1281
1282$(COMSYSOBJS64:%=pics/%) := \
1283	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1284
1285$(SYSOBJS64:%=pics/%) := \
1286	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1287
1288$(PORTGEN64:%=pics/%) := \
1289	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1290
1291$(PORTREGEX64:%=pics/%) := \
1292	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1293
1294$(PORTSTDIO64:%=pics/%) := \
1295	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1296
1297$(PORTSYS64:%=pics/%) := \
1298	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1299
1300$(PORTSTDIO_W:%=pics/%) := \
1301	CPPFLAGS += -D_WIDE
1302
1303$(PORTPRINT_W:%=pics/%) := \
1304	CPPFLAGS += -D_WIDE
1305
1306# printf/scanf functions to support c89-sized intmax_t variables
1307$(PORTPRINT_C89:%=pics/%) := \
1308	CPPFLAGS += -D_C89_INTMAX32
1309
1310$(PORTSTDIO_C89:%=pics/%) := \
1311	CPPFLAGS += -D_C89_INTMAX32
1312
1313$(PORTI18N_COND:%=pics/%) := \
1314	CPPFLAGS += -D_WCS_LONGLONG
1315
1316pics/arc4random.o :=	CPPFLAGS += -I$(SRC)/common/crypto/chacha
1317
1318# Files which need extra optimization
1319pics/getenv.o := sparc_COPTFLAG = -xO4
1320
1321#
1322# Disable the stack protector due to issues with bootstrapping rtld. See
1323# cmd/sgs/rtld/Makefile.com for more information.
1324#
1325STACKPROTECT = none
1326
1327.KEEP_STATE:
1328
1329all: $(LIBS) $(LIB_PIC)
1330
1331# object files that depend on inline template
1332$(TIL:%=pics/%): $(LIBCBASE)/threads/sparc.il
1333$(IL:%=pics/%): $(LIBCBASE)/fp/base.il
1334$(QIL:%=pics/%): $(LIBCDIR)/$(MACH)/fp/__quad.il
1335
1336# include common libc targets
1337include $(LIBCDIR)/Makefile.targ
1338
1339# We need to strip out all CTF and DOF data from the static library
1340$(LIB_PIC) := DIR = pics
1341$(LIB_PIC): pics $$(PICS)
1342	$(BUILD.AR)
1343	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1344	$(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
1345	$(AR) -ts $@ > /dev/null
1346	$(POST_PROCESS_A)
1347
1348# special cases
1349$(STRETS:%=pics/%): $(LIBCBASE)/crt/stret.s
1350	$(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) $(LIBCBASE)/crt/stret.s -o $@
1351	$(POST_PROCESS_S_O)
1352
1353$(LIBCBASE)/crt/_rtbootld.s:	$(LIBCBASE)/crt/_rtboot.s $(LIBCBASE)/crt/_rtld.c
1354	$(CC) $(CPPFLAGS) $(CTF_FLAGS) -O -S $(C_PICFLAGS) \
1355	    $(LIBCBASE)/crt/_rtld.c -o $(LIBCBASE)/crt/_rtld.s
1356	$(CAT) $(LIBCBASE)/crt/_rtboot.s $(LIBCBASE)/crt/_rtld.s > $@
1357	$(RM) $(LIBCBASE)/crt/_rtld.s
1358
1359# partially built from C source
1360pics/_rtbootld.o: $(LIBCBASE)/crt/_rtbootld.s
1361	$(AS) $(ASFLAGS) $(LIBCBASE)/crt/_rtbootld.s -o $@
1362	$(CTFCONVERT_O)
1363
1364ASSYMDEP_OBJS=			\
1365	_lwp_mutex_unlock.o	\
1366	_stack_grow.o		\
1367	asm_subr.o		\
1368	setjmp.o		\
1369	smt_pause.o		\
1370	tls_get_addr.o		\
1371	unwind_frame.o		\
1372	vforkx.o
1373
1374$(ASSYMDEP_OBJS:%=pics/%)	:=	CPPFLAGS += -I.
1375
1376$(ASSYMDEP_OBJS:%=pics/%): assym.h
1377
1378# assym.h build rules
1379
1380assym.h := CFLAGS += $(CCGDEBUG)
1381
1382GENASSYM_C = $(LIBCDIR)/$(MACH)/genassym.c
1383LDFLAGS.native = $(LDASSERTS) $(ZASSERTDEFLIB)=libc.so $(BDIRECT)
1384
1385genassym: $(GENASSYM_C)
1386	$(NATIVECC) $(NATIVE_CFLAGS) -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc \
1387		$(CPPFLAGS.native) $(LDFLAGS.native) -o $@ $(GENASSYM_C)
1388
1389OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1390
1391assym.h: $(OFFSETS) genassym
1392	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1393	./genassym >>$@
1394
1395# derived C source and related explicit dependencies
1396$(LIBCDIR)/port/gen/errlst.c + \
1397$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1398	cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1399
1400pics/errlst.o: $(LIBCDIR)/port/gen/errlst.c
1401
1402pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c
1403