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