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