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