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