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