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