xref: /illumos-gate/usr/src/lib/libc/amd64/Makefile (revision a7cee4e9766ebda975dd156d1f10a70f51c242f0)
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	c8rtomb.o		\
756	c16rtomb.o		\
757	c32rtomb.o		\
758	collate.o		\
759	collcmp.o		\
760	euc.o			\
761	fnmatch.o		\
762	fgetwc.o		\
763	fgetws.o		\
764	fix_grouping.o		\
765	fputwc.o		\
766	fputws.o		\
767	fwide.o			\
768	gb18030.o		\
769	gb2312.o		\
770	gbk.o			\
771	getdate.o		\
772	isdigit.o		\
773	iswctype.o		\
774	ldpart.o		\
775	lmessages.o		\
776	lnumeric.o		\
777	lmonetary.o		\
778	localeconv.o		\
779	localeimpl.o		\
780	mbftowc.o		\
781	mblen.o			\
782	mbrlen.o		\
783	mbrtoc8.o		\
784	mbrtoc16.o		\
785	mbrtoc32.o		\
786	mbrtowc.o		\
787	mbsinit.o		\
788	mbsnrtowcs.o		\
789	mbsrtowcs.o		\
790	mbstowcs.o		\
791	mbtowc.o		\
792	mskanji.o		\
793	nextwctype.o		\
794	nl_langinfo.o		\
795	none.o			\
796	rune.o			\
797	runetype.o		\
798	setlocale.o		\
799	setrunelocale.o		\
800	strcasecmp.o		\
801	strcasestr.o		\
802	strcoll.o		\
803	strfmon.o		\
804	strftime.o		\
805	strncasecmp.o		\
806	strptime.o		\
807	strxfrm.o		\
808	table.o			\
809	timelocal.o		\
810	tolower.o		\
811	towlower.o		\
812	ungetwc.o		\
813	utf8.o			\
814	wcrtomb.o		\
815	wcscasecmp.o		\
816	wcscoll.o		\
817	wcsftime.o		\
818	wcsnrtombs.o		\
819	wcsrtombs.o		\
820	wcswidth.o		\
821	wcstombs.o		\
822	wcsxfrm.o		\
823	wctob.o			\
824	wctomb.o		\
825	wctrans.o		\
826	wctype.o		\
827	wcwidth.o		\
828	wscol.o
829
830AIOOBJS=			\
831	aio.o			\
832	aio_alloc.o		\
833	posix_aio.o
834
835RTOBJS=				\
836	clock_timer.o		\
837	mqueue.o		\
838	pos4obj.o		\
839	sched.o			\
840	sem.o			\
841	shm.o			\
842	sigev_thread.o
843
844SECFLAGSOBJS=			\
845	secflags.o
846
847TPOOLOBJS=			\
848	thread_pool.o
849
850THREADSOBJS=			\
851	alloc.o			\
852	assfail.o		\
853	c11_thr.o		\
854	cancel.o		\
855	door_calls.o		\
856	tmem.o			\
857	pthr_attr.o		\
858	pthr_barrier.o		\
859	pthr_cond.o		\
860	pthr_mutex.o		\
861	pthr_rwlock.o		\
862	pthread.o		\
863	rwlock.o		\
864	scalls.o		\
865	sema.o			\
866	sigaction.o		\
867	spawn.o			\
868	synch.o			\
869	tdb_agent.o		\
870	thr.o			\
871	thread_interface.o	\
872	tls.o			\
873	tsd.o
874
875THREADSMACHOBJS=		\
876	machdep.o
877
878THREADSASMOBJS=			\
879	asm_subr.o
880
881UNICODEOBJS=			\
882	u8_textprep.o		\
883	uconv.o
884
885UNWINDMACHOBJS=			\
886	call_frame_inst.o	\
887	eh_frame.o		\
888	thrp_unwind.o		\
889	unwind.o
890
891pics/unwind.o:= COPTFLAG64 =
892
893UNWINDASMOBJS=			\
894	unwind_frame.o		\
895	unwind_wrap.o
896
897# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
898# This macro should ALWAYS be empty; native APIs are already 'large file'.
899PORTSYS64=
900
901PORTSYS=			\
902	_autofssys.o		\
903	access.o		\
904	acctctl.o		\
905	bsd_signal.o		\
906	chmod.o			\
907	chown.o			\
908	corectl.o		\
909	epoll.o			\
910	exacctsys.o		\
911	execl.o			\
912	execle.o		\
913	execv.o			\
914	execve.o		\
915	eventfd.o		\
916	fcntl.o			\
917	fexecve.o		\
918	getpagesizes.o		\
919	getpeerucred.o		\
920	inst_sync.o		\
921	issetugid.o		\
922	label.o			\
923	link.o			\
924	lockf.o			\
925	lwp.o			\
926	lwp_cond.o		\
927	lwp_rwlock.o		\
928	lwp_sigmask.o		\
929	meminfosys.o		\
930	mkdir.o			\
931	mknod.o			\
932	msgsys.o		\
933	nfssys.o		\
934	open.o			\
935	pgrpsys.o		\
936	posix_sigwait.o		\
937	ppriv.o			\
938	psetsys.o		\
939	rctlsys.o		\
940	readlink.o		\
941	rename.o		\
942	sbrk.o			\
943	semsys.o		\
944	set_errno.o		\
945	sharefs.o		\
946	shmsys.o		\
947	sidsys.o		\
948	siginterrupt.o		\
949	signal.o		\
950	signalfd.o		\
951	sigpending.o		\
952	sigstack.o		\
953	stat.o			\
954	symlink.o		\
955	tasksys.o		\
956	time.o			\
957	time_util.o		\
958	timerfd.o		\
959	ucontext.o		\
960	unlink.o		\
961	ustat.o			\
962	utimesys.o		\
963	zone.o
964
965PORTREGEX=			\
966	glob.o			\
967	regcmp.o		\
968	regcomp.o		\
969	regerror.o		\
970	regex.o			\
971	regexec.o		\
972	regfree.o		\
973	wordexp.o
974
975VALUES=				\
976	values-Xa.o
977
978BITOBJS=			\
979	bitext.o		\
980	stdbit.o
981
982MOSTOBJS=			\
983	$(STRETS)		\
984	$(CRTOBJS)		\
985	$(DYNOBJS)		\
986	$(FPOBJS)		\
987	$(I386FPOBJS)		\
988	$(FPASMOBJS)		\
989	$(ATOMICOBJS)		\
990	$(CHACHAOBJS)		\
991	$(XATTROBJS)		\
992	$(COMOBJS)		\
993	$(GENOBJS)		\
994	$(PORTFP)		\
995	$(PORTGEN)		\
996	$(PORTGEN64)		\
997	$(PORTI18N)		\
998	$(PORTI18N_COND)	\
999	$(PORTINET)		\
1000	$(PORTLOCALE)		\
1001	$(PORTPRINT)		\
1002	$(PORTPRINT_W)		\
1003	$(PORTREGEX)		\
1004	$(PORTSTDIO)		\
1005	$(PORTSTDIO64)		\
1006	$(PORTSTDIO_W)		\
1007	$(PORTSYS)		\
1008	$(PORTSYS64)		\
1009	$(AIOOBJS)		\
1010	$(RTOBJS)		\
1011	$(SECFLAGSOBJS)		\
1012	$(TPOOLOBJS)		\
1013	$(THREADSOBJS)		\
1014	$(THREADSMACHOBJS)	\
1015	$(THREADSASMOBJS)	\
1016	$(UNICODEOBJS)		\
1017	$(UNWINDMACHOBJS)	\
1018	$(UNWINDASMOBJS)	\
1019	$(COMSYSOBJS)		\
1020	$(SYSOBJS)		\
1021	$(COMSYSOBJS64)		\
1022	$(SYSOBJS64)		\
1023	$(VALUES)		\
1024	$(BITOBJS)
1025
1026TRACEOBJS=			\
1027	plockstat.o
1028
1029# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
1030# modules whose source is provided in the $(SRC)/lib/crt directory.
1031# This must be done because otherwise the Sun C compiler would insert
1032# its own versions of these modules and those versions contain code
1033# to call out to C++ initialization functions.  Such C++ initialization
1034# functions can call back into libc before thread initialization is
1035# complete and this leads to segmentation violations and other problems.
1036# Since libc contains no C++ code, linking with the minimal crti.o and
1037# crtn.o modules is safe and avoids the problems described above.
1038OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
1039CRTSRCS= ../../crt/amd64
1040
1041# include common library definitions
1042include ../../Makefile.lib
1043include ../../Makefile.lib.64
1044
1045CFLAGS64 += $(CTF_FLAGS)
1046
1047CERRWARN += -_gcc=-Wno-parentheses
1048CERRWARN += -_gcc=-Wno-switch
1049CERRWARN += $(CNOWARN_UNINIT)
1050CERRWARN += -_gcc=-Wno-unused-value
1051CERRWARN += -_gcc=-Wno-unused-variable
1052CERRWARN += -_gcc=-Wno-type-limits
1053CERRWARN += -_gcc=-Wno-char-subscripts
1054CERRWARN += -_gcc=-Wno-clobbered
1055CERRWARN += -_gcc=-Wno-unused-function
1056CERRWARN += -_gcc=-Wno-address
1057
1058$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused
1059
1060# not linted
1061SMATCH=off
1062
1063# Setting THREAD_DEBUG = -DDEBUG (make THREAD_DEBUG=-DDEBUG ...)
1064# enables ASSERT() checking in the library.
1065# This is automatically enabled for DEBUG builds, not for non-debug builds.
1066THREAD_DEBUG =
1067$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DDEBUG
1068
1069ALTPICS= $(TRACEOBJS:%=pics/%)
1070
1071$(DYNLIB) := BUILD.SO = $(LD) -o $@ $(GSHARED) $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1072
1073MAPFILES =	$(LIBCDIR)/port/mapfile-vers
1074
1075CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
1076		-I. -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1077
1078# __XOPEN_OR_POSIX is necessary to avoid implicit _LARGEFILE_SOURCE which
1079# breaks the libc compilation environment.
1080ASFLAGS=	$(AS_PICFLAGS) -D_ASM \
1081		$(CPPFLAGS) $(amd64_XARCH) -D__XOPEN_OR_POSIX=1
1082ASFLAGS64=	$(AS_PICFLAGS) -D_ASM \
1083		$(CPPFLAGS) $(amd64_XARCH) -D__XOPEN_OR_POSIX=1
1084
1085# As a favor to the dtrace syscall provider, libc still calls the
1086# old syscall traps that have been obsoleted by the *at() interfaces.
1087# Delete this to compile libc using only the new *at() system call traps
1088CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
1089
1090# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
1091pics/proc64_id.o	:= CFLAGS64 += -I$(SRC)/uts/intel
1092
1093# Inform the run-time linker about libc specialized initialization
1094RTLDINFO =	-z rtldinfo=tls_rtldinfo
1095DYNFLAGS +=	$(RTLDINFO)
1096
1097# Force libc's internal references to be resolved immediately upon loading
1098# in order to avoid critical region problems.  Since almost all libc symbols
1099# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1100DYNFLAGS +=	-znow
1101
1102BUILD.s=	$(AS) $(ASFLAGS) $< -c -o $@
1103
1104# Override this top level flag so the compiler builds in its native
1105# C99 mode.  This has been enabled to support the complex arithmetic
1106# added to libc.
1107CSTD=	$(CSTD_GNU99)
1108
1109# libc method of building an archive
1110# The "$(GREP) -v ' L '" part is necessary only until
1111# lorder is fixed to ignore thread-local variables.
1112BUILD.AR= $(RM) $@ ; \
1113	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1114
1115# extra files for the clean target
1116CLEANFILES +=			\
1117	$(LIBCDIR)/port/gen/new_list.c	\
1118	assym.h			\
1119	genassym		\
1120	crt/_rtld.s		\
1121	pics/crti.o		\
1122	pics/crtn.o		\
1123	$(ALTPICS)
1124
1125CLOBBERFILES +=	$(LIB_PIC)
1126
1127# conditional assignments
1128# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1129$(DYNLIB) := CRTI = crti.o
1130$(DYNLIB) := CRTN = crtn.o
1131
1132# large-file-aware components that should be built large
1133
1134#$(COMSYSOBJS64:%=pics/%) := \
1135#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1136
1137#$(SYSOBJS64:%=pics/%) := \
1138#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1139
1140#$(PORTGEN64:%=pics/%) := \
1141#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1142
1143#$(PORTSTDIO64:%=pics/%) := \
1144#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1145
1146#$(PORTSYS64:%=pics/%) := \
1147#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1148
1149$(PORTSTDIO_W:%=pics/%) := \
1150	CPPFLAGS += -D_WIDE
1151
1152$(PORTPRINT_W:%=pics/%) := \
1153	CPPFLAGS += -D_WIDE
1154
1155$(PORTPRINT_C89:%=pics/%) := \
1156	CPPFLAGS += -D_C89_INTMAX32
1157
1158$(PORTSTDIO_C89:%=pics/%) := \
1159	CPPFLAGS += -D_C89_INTMAX32
1160
1161$(PORTI18N_COND:%=pics/%) := \
1162	CPPFLAGS += -D_WCS_LONGLONG
1163
1164pics/arc4random.o :=	CPPFLAGS += -I$(SRC)/common/crypto/chacha
1165
1166pics/__clock_gettime.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1167pics/__gethrtime.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1168pics/gettimeofday.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1169
1170# because of char_to_decimal.h
1171pics/file_decim.o := SMOFF += indenting
1172pics/func_decim.o := SMOFF += indenting
1173pics/string_decim.o := SMOFF += indenting
1174
1175#
1176# Disable the stack protector due to issues with bootstrapping rtld. See
1177# cmd/sgs/rtld/Makefile.com for more information.
1178#
1179STACKPROTECT = none
1180
1181.KEEP_STATE:
1182
1183all: $(LIBS) $(LIB_PIC)
1184
1185# include common libc targets
1186include ../Makefile.targ
1187
1188# We need to strip out all CTF data from the static library
1189$(LIB_PIC) := DIR = pics
1190$(LIB_PIC): pics $$(PICS)
1191	$(BUILD.AR)
1192	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1193	$(AR) -ts $@ > /dev/null
1194	$(POST_PROCESS_A)
1195
1196ASSYMDEP_OBJS=			\
1197	_lwp_mutex_unlock.o	\
1198	_stack_grow.o		\
1199	asm_subr.o		\
1200	getcontext.o		\
1201	setjmp.o		\
1202	tls_get_addr.o		\
1203	vforkx.o
1204
1205$(ASSYMDEP_OBJS:%=pics/%): assym.h
1206
1207# assym.h build rules
1208
1209GENASSYM_C = genassym.c
1210LDFLAGS.native = $(LDASSERTS) $(BDIRECT)
1211
1212genassym := NATIVE_LIBS += libc.so
1213
1214genassym: $(GENASSYM_C)
1215	$(NATIVECC) $(NATIVE_CFLAGS) -Iinc -I$(LIBCDIR)/inc $(CPPFLAGS.native) \
1216		$(LDFLAGS.native) -o $@ $(GENASSYM_C)
1217
1218OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1219
1220assym.h: $(OFFSETS) genassym
1221	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1222	./genassym >>$@
1223
1224# derived C source and related explicit dependencies
1225$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1226	cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1227
1228pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c
1229