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