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