xref: /illumos-gate/usr/src/lib/libc/amd64/Makefile (revision 7a6d80f1660abd4755c68cbd094d4a914681d26e)
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
36TARGET_ARCH=	amd64
37
38# include comm page definitions
39include $(SRC)/lib/commpage/Makefile.shared.com
40include $(SRC)/lib/commpage/Makefile.shared.targ
41
42# objects are grouped by source directory
43
44# local objects
45STRETS=
46
47CRTOBJS=			\
48	cerror.o
49
50DYNOBJS=
51
52FPOBJS=				\
53	fpgetmask.o		\
54	fpgetround.o		\
55	fpsetmask.o		\
56	fpsetround.o		\
57	fpstart.o		\
58	ieee.o
59
60I386FPOBJS=			\
61	_D_cplx_div.o		\
62	_D_cplx_div_ix.o	\
63	_D_cplx_div_rx.o	\
64	_D_cplx_lr_div.o	\
65	_D_cplx_lr_div_ix.o	\
66	_D_cplx_lr_div_rx.o	\
67	_D_cplx_mul.o		\
68	_F_cplx_div.o		\
69	_F_cplx_div_ix.o	\
70	_F_cplx_div_rx.o	\
71	_F_cplx_lr_div.o	\
72	_F_cplx_lr_div_ix.o	\
73	_F_cplx_lr_div_rx.o	\
74	_F_cplx_mul.o		\
75	_X_cplx_div.o		\
76	_X_cplx_div_ix.o	\
77	_X_cplx_div_rx.o	\
78	_X_cplx_lr_div.o	\
79	_X_cplx_lr_div_ix.o	\
80	_X_cplx_lr_div_rx.o	\
81	_X_cplx_mul.o
82
83FPASMOBJS=			\
84	__xgetRD.o		\
85	_xtoll.o		\
86	_xtoull.o		\
87	_base_il.o		\
88	fpcw.o			\
89	fpgetsticky.o		\
90	fpsetsticky.o
91
92ATOMICOBJS=			\
93	atomic.o
94
95CHACHAOBJS=			\
96	chacha.o
97
98XATTROBJS=			\
99	xattr_common.o
100COMOBJS=			\
101	bcmp.o			\
102	bcopy.o			\
103	bsearch.o		\
104	bzero.o			\
105	explicit_bzero.o	\
106	memmem.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	ssp.o			\
270	statfs.o		\
271	statvfs.o		\
272	stty.o			\
273	sync.o			\
274	sysconfig.o		\
275	sysfs.o			\
276	sysinfo.o		\
277	syslwp.o		\
278	times.o			\
279	ulimit.o		\
280	umask.o			\
281	umount2.o		\
282	upanic.o		\
283	utssys.o		\
284	uucopy.o		\
285	vhangup.o		\
286	waitid.o		\
287	write.o			\
288	writev.o		\
289	yield.o
290
291SYSOBJS=			\
292	__clock_gettime.o	\
293	__clock_gettime_sys.o	\
294	__getcontext.o		\
295	__uadmin.o		\
296	_lwp_mutex_unlock.o	\
297	_stack_grow.o		\
298	door.o			\
299	forkx.o			\
300	forkallx.o		\
301	getcontext.o		\
302	gettimeofday.o		\
303	lwp_private.o		\
304	nuname.o		\
305	syscall.o		\
306	sysi86.o		\
307	tls_get_addr.o		\
308	uadmin.o		\
309	umount.o		\
310	uname.o			\
311	vforkx.o
312
313# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
314# This macro should ALWAYS be empty; native APIs are already 'large file'.
315PORTGEN64=
316
317# objects from source under $(LIBCDIR)/port
318PORTFP=				\
319	__flt_decim.o		\
320	__flt_rounds.o		\
321	__tbl_10_b.o		\
322	__tbl_10_h.o		\
323	__tbl_10_s.o		\
324	__tbl_2_b.o		\
325	__tbl_2_h.o		\
326	__tbl_2_s.o		\
327	__tbl_fdq.o		\
328	__tbl_tens.o		\
329	__x_power.o		\
330	_base_sup.o		\
331	aconvert.o		\
332	decimal_bin.o		\
333	double_decim.o		\
334	econvert.o		\
335	fconvert.o		\
336	file_decim.o		\
337	finite.o		\
338	fp_data.o		\
339	func_decim.o		\
340	gconvert.o		\
341	hex_bin.o		\
342	ieee_globals.o		\
343	pack_float.o		\
344	sigfpe.o		\
345	string_decim.o
346
347PORTGEN=			\
348	_env_data.o		\
349	_xftw.o			\
350	a64l.o			\
351	abort.o			\
352	addsev.o		\
353	ascii_strcasecmp.o	\
354	ascii_strncasecmp.o	\
355	assert.o		\
356	atexit.o		\
357	atfork.o		\
358	atof.o			\
359	atoi.o			\
360	atol.o			\
361	atoll.o			\
362	attropen.o		\
363	basename.o		\
364	calloc.o		\
365	catgets.o		\
366	catopen.o		\
367	cfgetispeed.o		\
368	cfgetospeed.o		\
369	cfree.o			\
370	cfsetispeed.o		\
371	cfsetospeed.o		\
372	cftime.o		\
373	clock.o			\
374	closedir.o		\
375	closefrom.o		\
376	confstr.o		\
377	crypt.o			\
378	csetlen.o		\
379	ctime.o			\
380	ctime_r.o		\
381	daemon.o		\
382	deflt.o			\
383	directio.o		\
384	dirname.o		\
385	div.o			\
386	drand48.o		\
387	dup.o			\
388	env_data.o		\
389	err.o			\
390	errno.o			\
391	euclen.o		\
392	event_port.o		\
393	execvp.o		\
394	fattach.o		\
395	fdetach.o		\
396	fdopendir.o		\
397	ffs.o			\
398	flock.o			\
399	fls.o			\
400	fmtmsg.o		\
401	freezero.o		\
402	ftime.o			\
403	ftok.o			\
404	fts.o			\
405	ftw.o			\
406	gcvt.o			\
407	get_nprocs.o		\
408	getauxv.o		\
409	getcwd.o		\
410	getdate_err.o		\
411	getdtblsize.o		\
412	getentropy.o		\
413	getenv.o		\
414	getexecname.o		\
415	getgrnam.o		\
416	getgrnam_r.o		\
417	gethostid.o		\
418	gethostname.o		\
419	gethz.o			\
420	getisax.o		\
421	getloadavg.o		\
422	getlogin.o		\
423	getmntent.o		\
424	getnetgrent.o		\
425	getopt.o		\
426	getopt_long.o		\
427	getpagesize.o		\
428	getpw.o			\
429	getpwnam.o		\
430	getpwnam_r.o		\
431	getrusage.o		\
432	getspent.o		\
433	getspent_r.o		\
434	getsubopt.o		\
435	gettxt.o		\
436	getusershell.o		\
437	getut.o			\
438	getutx.o		\
439	getvfsent.o		\
440	getwd.o			\
441	getwidth.o		\
442	getxby_door.o		\
443	gtxt.o			\
444	hsearch.o		\
445	iconv.o			\
446	imaxabs.o		\
447	imaxdiv.o		\
448	index.o			\
449	initgroups.o		\
450	insque.o		\
451	isaexec.o		\
452	isastream.o		\
453	isatty.o		\
454	killpg.o		\
455	klpdlib.o		\
456	l64a.o			\
457	lckpwdf.o		\
458	lconstants.o		\
459	lexp10.o		\
460	lfind.o			\
461	lfmt.o			\
462	lfmt_log.o		\
463	lldiv.o			\
464	llog10.o		\
465	lltostr.o		\
466	lmath.o			\
467	localtime.o		\
468	lsearch.o		\
469	madvise.o		\
470	malloc.o		\
471	memalign.o		\
472	memrchr.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# large-file-aware components that should be built large
1125
1126#$(COMSYSOBJS64:%=pics/%) := \
1127#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1128
1129#$(SYSOBJS64:%=pics/%) := \
1130#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1131
1132#$(PORTGEN64:%=pics/%) := \
1133#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1134
1135#$(PORTSTDIO64:%=pics/%) := \
1136#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1137
1138#$(PORTSYS64:%=pics/%) := \
1139#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1140
1141$(PORTSTDIO_W:%=pics/%) := \
1142	CPPFLAGS += -D_WIDE
1143
1144$(PORTPRINT_W:%=pics/%) := \
1145	CPPFLAGS += -D_WIDE
1146
1147$(PORTPRINT_C89:%=pics/%) := \
1148	CPPFLAGS += -D_C89_INTMAX32
1149
1150$(PORTSTDIO_C89:%=pics/%) := \
1151	CPPFLAGS += -D_C89_INTMAX32
1152
1153$(PORTI18N_COND:%=pics/%) := \
1154	CPPFLAGS += -D_WCS_LONGLONG
1155
1156pics/arc4random.o :=	CPPFLAGS += -I$(SRC)/common/crypto/chacha
1157
1158pics/__clock_gettime.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1159pics/gettimeofday.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1160
1161#
1162# Disable the stack protector due to issues with bootstrapping rtld. See
1163# cmd/sgs/rtld/Makefile.com for more information.
1164#
1165STACKPROTECT = none
1166
1167.KEEP_STATE:
1168
1169all: $(LIBS) $(LIB_PIC)
1170
1171# include common libc targets
1172include ../Makefile.targ
1173
1174# We need to strip out all CTF data from the static library
1175$(LIB_PIC) := DIR = pics
1176$(LIB_PIC): pics $$(PICS)
1177	$(BUILD.AR)
1178	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1179	$(AR) -ts $@ > /dev/null
1180	$(POST_PROCESS_A)
1181
1182ASSYMDEP_OBJS=			\
1183	_lwp_mutex_unlock.o	\
1184	_stack_grow.o		\
1185	asm_subr.o		\
1186	getcontext.o		\
1187	setjmp.o		\
1188	tls_get_addr.o		\
1189	vforkx.o
1190
1191$(ASSYMDEP_OBJS:%=pics/%): assym.h
1192
1193# assym.h build rules
1194
1195GENASSYM_C = genassym.c
1196LDFLAGS.native = $(LDASSERTS) $(BDIRECT)
1197
1198genassym := NATIVE_LIBS += libc.so
1199
1200genassym: $(GENASSYM_C)
1201	$(NATIVECC) $(NATIVE_CFLAGS) -Iinc -I$(LIBCDIR)/inc $(CPPFLAGS.native) \
1202		$(LDFLAGS.native) -o $@ $(GENASSYM_C)
1203
1204OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1205
1206assym.h: $(OFFSETS) genassym
1207	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1208	./genassym >>$@
1209
1210# derived C source and related explicit dependencies
1211$(LIBCDIR)/port/gen/errlst.c + \
1212$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1213	cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1214
1215pics/errlst.o: $(LIBCDIR)/port/gen/errlst.c
1216
1217pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c
1218