xref: /illumos-gate/usr/src/lib/libc/amd64/Makefile (revision d6bf1708)
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 2013 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#
30
31LIBCBASE=	.
32LIBCDIR=	$(SRC)/lib/libc
33LIBRARY=	libc.a
34LIB_PIC=	libc_pic.a
35VERS=		.1
36CPP=		/usr/lib/cpp
37TARGET_ARCH=	amd64
38
39# include comm page definitions
40include $(SRC)/lib/commpage/Makefile.shared.com
41include $(SRC)/lib/commpage/Makefile.shared.targ
42
43# objects are grouped by source directory
44
45# local objects
46STRETS=
47
48CRTOBJS=			\
49	cerror.o
50
51DYNOBJS=
52
53FPOBJS=				\
54	fpgetmask.o		\
55	fpgetround.o		\
56	fpsetmask.o		\
57	fpsetround.o		\
58	fpstart.o		\
59	ieee.o
60
61I386FPOBJS=			\
62	_D_cplx_div.o		\
63	_D_cplx_div_ix.o	\
64	_D_cplx_div_rx.o	\
65	_D_cplx_lr_div.o	\
66	_D_cplx_lr_div_ix.o	\
67	_D_cplx_lr_div_rx.o	\
68	_D_cplx_mul.o		\
69	_F_cplx_div.o		\
70	_F_cplx_div_ix.o	\
71	_F_cplx_div_rx.o	\
72	_F_cplx_lr_div.o	\
73	_F_cplx_lr_div_ix.o	\
74	_F_cplx_lr_div_rx.o	\
75	_F_cplx_mul.o		\
76	_X_cplx_div.o		\
77	_X_cplx_div_ix.o	\
78	_X_cplx_div_rx.o	\
79	_X_cplx_lr_div.o	\
80	_X_cplx_lr_div_ix.o	\
81	_X_cplx_lr_div_rx.o	\
82	_X_cplx_mul.o
83
84FPASMOBJS=			\
85	__xgetRD.o		\
86	_xtoll.o		\
87	_xtoull.o		\
88	_base_il.o		\
89	fpcw.o			\
90	fpgetsticky.o		\
91	fpsetsticky.o
92
93ATOMICOBJS=			\
94	atomic.o
95
96CHACHAOBJS=			\
97	chacha.o
98
99XATTROBJS=			\
100	xattr_common.o
101COMOBJS=			\
102	bcmp.o			\
103	bcopy.o			\
104	bsearch.o		\
105	bzero.o			\
106	explicit_bzero.o	\
107	memmem.o		\
108	qsort.o			\
109	strtol.o		\
110	strtoul.o		\
111	strtoll.o		\
112	strtoull.o
113
114GENOBJS=			\
115	$(COMMPAGE_OBJS)	\
116	_getsp.o		\
117	abs.o			\
118	alloca.o		\
119	arc4random.o		\
120	arc4random_uniform.o	\
121	attrat.o		\
122	byteorder.o		\
123	cuexit.o		\
124	ecvt.o			\
125	endian.o		\
126	errlst.o		\
127	amd64_data.o		\
128	ldivide.o		\
129	lock.o			\
130	makectxt.o		\
131	memccpy.o		\
132	memchr.o		\
133	memcmp.o		\
134	memcpy.o		\
135	memset.o		\
136	new_list.o		\
137	proc64_id.o		\
138	proc64_support.o	\
139	setjmp.o		\
140	siginfolst.o		\
141	siglongjmp.o		\
142	strcmp.o		\
143	strcpy.o		\
144	strlen.o		\
145	strncmp.o		\
146	strncpy.o		\
147	strnlen.o		\
148	sync_instruction_memory.o
149
150# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
151# This macro should ALWAYS be empty; native APIs are already 'large file'.
152COMSYSOBJS64=
153
154SYSOBJS64=
155
156COMSYSOBJS=			\
157	__clock_timer.o		\
158	__getloadavg.o		\
159	__rusagesys.o		\
160	__signotify.o		\
161	__sigrt.o		\
162	__time.o		\
163	_lgrp_home_fast.o	\
164	_lgrpsys.o		\
165	_nfssys.o		\
166	_portfs.o		\
167	_pset.o			\
168	_rpcsys.o		\
169	_sigaction.o		\
170	_so_accept.o		\
171	_so_bind.o		\
172	_so_connect.o		\
173	_so_getpeername.o	\
174	_so_getsockname.o	\
175	_so_getsockopt.o	\
176	_so_listen.o		\
177	_so_recv.o		\
178	_so_recvfrom.o		\
179	_so_recvmsg.o		\
180	_so_send.o		\
181	_so_sendmsg.o		\
182	_so_sendto.o		\
183	_so_setsockopt.o	\
184	_so_shutdown.o		\
185	_so_socket.o		\
186	_so_socketpair.o	\
187	_sockconfig.o		\
188	acct.o			\
189	acl.o			\
190	adjtime.o		\
191	alarm.o			\
192	brk.o			\
193	chdir.o			\
194	chroot.o		\
195	cladm.o			\
196	close.o			\
197	execve.o		\
198	exit.o			\
199	facl.o			\
200	fchdir.o		\
201	fchroot.o		\
202	fdsync.o		\
203	fpathconf.o		\
204	fstatfs.o		\
205	fstatvfs.o		\
206	getcpuid.o		\
207	getdents.o		\
208	getegid.o		\
209	geteuid.o		\
210	getgid.o		\
211	getgroups.o		\
212	gethrtime.o		\
213	getitimer.o		\
214	getmsg.o		\
215	getpid.o		\
216	getpmsg.o		\
217	getppid.o		\
218	getrandom.o		\
219	getrlimit.o		\
220	getuid.o		\
221	gtty.o			\
222	install_utrap.o		\
223	ioctl.o			\
224	kaio.o			\
225	kill.o			\
226	llseek.o		\
227	lseek.o			\
228	mmapobjsys.o		\
229	memcntl.o		\
230	mincore.o		\
231	mmap.o			\
232	modctl.o		\
233	mount.o			\
234	mprotect.o		\
235	munmap.o		\
236	nice.o			\
237	ntp_adjtime.o		\
238	ntp_gettime.o		\
239	p_online.o		\
240	pathconf.o		\
241	pause.o			\
242	pcsample.o		\
243	pipe2.o			\
244	pollsys.o		\
245	pread.o			\
246	preadv.o		\
247	priocntlset.o		\
248	processor_bind.o	\
249	processor_info.o	\
250	profil.o		\
251	psecflagsset.o		\
252	putmsg.o		\
253	putpmsg.o		\
254	pwrite.o		\
255	pwritev.o		\
256	read.o			\
257	readv.o			\
258	resolvepath.o		\
259	seteguid.o		\
260	setgid.o		\
261	setgroups.o		\
262	setitimer.o		\
263	setreid.o		\
264	setrlimit.o		\
265	setuid.o		\
266	sigaltstk.o		\
267	sigprocmsk.o		\
268	sigsendset.o		\
269	sigsuspend.o		\
270	ssp.o			\
271	statfs.o		\
272	statvfs.o		\
273	stty.o			\
274	sync.o			\
275	sysconfig.o		\
276	sysfs.o			\
277	sysinfo.o		\
278	syslwp.o		\
279	times.o			\
280	ulimit.o		\
281	umask.o			\
282	umount2.o		\
283	upanic.o		\
284	utssys.o		\
285	uucopy.o		\
286	vhangup.o		\
287	waitid.o		\
288	write.o			\
289	writev.o		\
290	yield.o
291
292SYSOBJS=			\
293	__clock_gettime.o	\
294	__clock_gettime_sys.o	\
295	__getcontext.o		\
296	__uadmin.o		\
297	_lwp_mutex_unlock.o	\
298	_stack_grow.o		\
299	door.o			\
300	forkx.o			\
301	forkallx.o		\
302	getcontext.o		\
303	gettimeofday.o		\
304	lwp_private.o		\
305	nuname.o		\
306	syscall.o		\
307	sysi86.o		\
308	tls_get_addr.o		\
309	uadmin.o		\
310	umount.o		\
311	uname.o			\
312	vforkx.o
313
314# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
315# This macro should ALWAYS be empty; native APIs are already 'large file'.
316PORTGEN64=
317
318# objects from source under $(LIBCDIR)/port
319PORTFP=				\
320	__flt_decim.o		\
321	__flt_rounds.o		\
322	__tbl_10_b.o		\
323	__tbl_10_h.o		\
324	__tbl_10_s.o		\
325	__tbl_2_b.o		\
326	__tbl_2_h.o		\
327	__tbl_2_s.o		\
328	__tbl_fdq.o		\
329	__tbl_tens.o		\
330	__x_power.o		\
331	_base_sup.o		\
332	aconvert.o		\
333	decimal_bin.o		\
334	double_decim.o		\
335	econvert.o		\
336	fconvert.o		\
337	file_decim.o		\
338	finite.o		\
339	fp_data.o		\
340	func_decim.o		\
341	gconvert.o		\
342	hex_bin.o		\
343	ieee_globals.o		\
344	pack_float.o		\
345	sigfpe.o		\
346	string_decim.o
347
348PORTGEN=			\
349	_env_data.o		\
350	_xftw.o			\
351	a64l.o			\
352	abort.o			\
353	addsev.o		\
354	ascii_strcasecmp.o	\
355	ascii_strncasecmp.o	\
356	assert.o		\
357	atexit.o		\
358	atfork.o		\
359	atof.o			\
360	atoi.o			\
361	atol.o			\
362	atoll.o			\
363	attropen.o		\
364	basename.o		\
365	calloc.o		\
366	catgets.o		\
367	catopen.o		\
368	cfgetispeed.o		\
369	cfgetospeed.o		\
370	cfree.o			\
371	cfsetispeed.o		\
372	cfsetospeed.o		\
373	cftime.o		\
374	clock.o			\
375	closedir.o		\
376	closefrom.o		\
377	confstr.o		\
378	crypt.o			\
379	csetlen.o		\
380	ctime.o			\
381	ctime_r.o		\
382	daemon.o		\
383	deflt.o			\
384	directio.o		\
385	dirname.o		\
386	div.o			\
387	drand48.o		\
388	dup.o			\
389	env_data.o		\
390	err.o			\
391	errno.o			\
392	euclen.o		\
393	event_port.o		\
394	execvp.o		\
395	fattach.o		\
396	fdetach.o		\
397	fdopendir.o		\
398	ffs.o			\
399	flock.o			\
400	fls.o			\
401	fmtmsg.o		\
402	freezero.o		\
403	ftime.o			\
404	ftok.o			\
405	fts.o			\
406	ftw.o			\
407	gcvt.o			\
408	get_nprocs.o		\
409	getauxv.o		\
410	getcwd.o		\
411	getdate_err.o		\
412	getdtblsize.o		\
413	getentropy.o		\
414	getenv.o		\
415	getexecname.o		\
416	getgrnam.o		\
417	getgrnam_r.o		\
418	gethostid.o		\
419	gethostname.o		\
420	gethz.o			\
421	getisax.o		\
422	getloadavg.o		\
423	getlogin.o		\
424	getmntent.o		\
425	getnetgrent.o		\
426	getopt.o		\
427	getopt_long.o		\
428	getpagesize.o		\
429	getpw.o			\
430	getpwnam.o		\
431	getpwnam_r.o		\
432	getrusage.o		\
433	getspent.o		\
434	getspent_r.o		\
435	getsubopt.o		\
436	gettxt.o		\
437	getusershell.o		\
438	getut.o			\
439	getutx.o		\
440	getvfsent.o		\
441	getwd.o			\
442	getwidth.o		\
443	getxby_door.o		\
444	gtxt.o			\
445	hsearch.o		\
446	iconv.o			\
447	imaxabs.o		\
448	imaxdiv.o		\
449	index.o			\
450	initgroups.o		\
451	insque.o		\
452	isaexec.o		\
453	isastream.o		\
454	isatty.o		\
455	killpg.o		\
456	klpdlib.o		\
457	l64a.o			\
458	lckpwdf.o		\
459	lconstants.o		\
460	lexp10.o		\
461	lfind.o			\
462	lfmt.o			\
463	lfmt_log.o		\
464	lldiv.o			\
465	llog10.o		\
466	lltostr.o		\
467	lmath.o			\
468	localtime.o		\
469	lsearch.o		\
470	madvise.o		\
471	malloc.o		\
472	memalign.o		\
473	memrchr.o		\
474	memset_s.o		\
475	mkdev.o			\
476	mkdtemp.o		\
477	mkfifo.o		\
478	mkstemp.o		\
479	mktemp.o		\
480	mlock.o			\
481	mlockall.o		\
482	mon.o			\
483	msync.o			\
484	munlock.o		\
485	munlockall.o		\
486	ndbm.o			\
487	nftw.o			\
488	nlspath_checks.o	\
489	nsparse.o		\
490	nss_common.o		\
491	nss_dbdefs.o		\
492	nss_deffinder.o		\
493	opendir.o		\
494	opt_data.o		\
495	perror.o		\
496	pfmt.o			\
497	pfmt_data.o		\
498	pfmt_print.o		\
499	pipe.o			\
500	plock.o			\
501	poll.o			\
502	posix_fadvise.o		\
503	posix_fallocate.o	\
504	posix_madvise.o		\
505	posix_memalign.o	\
506	priocntl.o		\
507	priv_str_xlate.o	\
508	privlib.o		\
509	psecflags.o		\
510	psiginfo.o		\
511	psignal.o		\
512	pt.o			\
513	putpwent.o		\
514	putspent.o		\
515	raise.o			\
516	rand.o			\
517	random.o		\
518	rctlops.o		\
519	readdir.o		\
520	readdir_r.o		\
521	reallocarray.o		\
522	reallocf.o		\
523	recallocarray.o		\
524	realpath.o		\
525	reboot.o		\
526	regexpr.o		\
527	remove.o		\
528	rewinddir.o		\
529	rindex.o		\
530	scandir.o		\
531	seekdir.o		\
532	select.o		\
533	set_constraint_handler_s.o \
534	setlabel.o		\
535	setpriority.o		\
536	settimeofday.o		\
537	sh_locks.o		\
538	sigflag.o		\
539	siglist.o		\
540	sigsend.o		\
541	sigsetops.o		\
542	ssignal.o		\
543	stack.o			\
544	stpcpy.o		\
545	stpncpy.o		\
546	str2sig.o		\
547	strcase_charmap.o	\
548	strcat.o		\
549	strchr.o		\
550	strchrnul.o		\
551	strcspn.o		\
552	strdup.o		\
553	strerror.o		\
554	strlcat.o		\
555	strlcpy.o		\
556	strncat.o		\
557	strndup.o		\
558	strpbrk.o		\
559	strrchr.o		\
560	strsep.o		\
561	strsignal.o		\
562	strspn.o		\
563	strstr.o		\
564	strtod.o		\
565	strtoimax.o		\
566	strtok.o		\
567	strtok_r.o		\
568	strtonum.o		\
569	strtoumax.o		\
570	swab.o			\
571	swapctl.o		\
572	sysconf.o		\
573	syslog.o		\
574	tcdrain.o		\
575	tcflow.o		\
576	tcflush.o		\
577	tcgetattr.o		\
578	tcgetpgrp.o		\
579	tcgetsid.o		\
580	tcsendbreak.o		\
581	tcsetattr.o		\
582	tcsetpgrp.o		\
583	tell.o			\
584	telldir.o		\
585	tfind.o			\
586	time_data.o		\
587	time_gdata.o		\
588	timespec_get.o		\
589	tls_data.o		\
590	truncate.o		\
591	tsdalloc.o		\
592	tsearch.o		\
593	ttyname.o		\
594	ttyslot.o		\
595	ualarm.o		\
596	ucred.o			\
597	valloc.o		\
598	vlfmt.o			\
599	vpfmt.o			\
600	waitpid.o		\
601	walkstack.o		\
602	wdata.o			\
603	xgetwidth.o		\
604	xpg4.o			\
605	xpg6.o
606
607PORTINET=			\
608	inet_lnaof.o		\
609	inet_makeaddr.o		\
610	inet_network.o		\
611	inet_ntoa.o		\
612	inet_ntop.o		\
613	inet_pton.o
614
615PORTPRINT_W=			\
616	doprnt_w.o
617
618PORTPRINT=			\
619	asprintf.o		\
620	doprnt.o		\
621	fprintf.o		\
622	printf.o		\
623	snprintf.o		\
624	sprintf.o		\
625	vfprintf.o		\
626	vprintf.o		\
627	vsnprintf.o		\
628	vsprintf.o		\
629	vwprintf.o		\
630	wprintf.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	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	eventfd.o		\
911	fcntl.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
972MOSTOBJS=			\
973	$(STRETS)		\
974	$(CRTOBJS)		\
975	$(DYNOBJS)		\
976	$(FPOBJS)		\
977	$(I386FPOBJS)		\
978	$(FPASMOBJS)		\
979	$(ATOMICOBJS)		\
980	$(CHACHAOBJS)		\
981	$(XATTROBJS)		\
982	$(COMOBJS)		\
983	$(GENOBJS)		\
984	$(PORTFP)		\
985	$(PORTGEN)		\
986	$(PORTGEN64)		\
987	$(PORTI18N)		\
988	$(PORTI18N_COND)	\
989	$(PORTINET)		\
990	$(PORTLOCALE)		\
991	$(PORTPRINT)		\
992	$(PORTPRINT_W)		\
993	$(PORTREGEX)		\
994	$(PORTSTDIO)		\
995	$(PORTSTDIO64)		\
996	$(PORTSTDIO_W)		\
997	$(PORTSYS)		\
998	$(PORTSYS64)		\
999	$(AIOOBJS)		\
1000	$(RTOBJS)		\
1001	$(SECFLAGSOBJS)		\
1002	$(TPOOLOBJS)		\
1003	$(THREADSOBJS)		\
1004	$(THREADSMACHOBJS)	\
1005	$(THREADSASMOBJS)	\
1006	$(UNICODEOBJS)		\
1007	$(UNWINDMACHOBJS)	\
1008	$(UNWINDASMOBJS)	\
1009	$(COMSYSOBJS)		\
1010	$(SYSOBJS)		\
1011	$(COMSYSOBJS64)		\
1012	$(SYSOBJS64)		\
1013	$(VALUES)
1014
1015TRACEOBJS=			\
1016	plockstat.o
1017
1018# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
1019# modules whose source is provided in the $(SRC)/lib/crt directory.
1020# This must be done because otherwise the Sun C compiler would insert
1021# its own versions of these modules and those versions contain code
1022# to call out to C++ initialization functions.  Such C++ initialization
1023# functions can call back into libc before thread initialization is
1024# complete and this leads to segmentation violations and other problems.
1025# Since libc contains no C++ code, linking with the minimal crti.o and
1026# crtn.o modules is safe and avoids the problems described above.
1027OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
1028CRTSRCS= ../../crt/amd64
1029
1030# include common library definitions
1031include ../../Makefile.lib
1032include ../../Makefile.lib.64
1033
1034CFLAGS64 += $(CTF_FLAGS)
1035
1036# This is necessary to avoid problems with calling _ex_unwind().
1037# We probably don't want any inlining anyway.
1038CFLAGS64 += -xinline=
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 = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
1058# enables ASSERT() checking in the threads portion of the library.
1059# This is automatically enabled for DEBUG builds, not for non-debug builds.
1060THREAD_DEBUG =
1061$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
1062
1063# Make string literals read-only to save memory
1064CFLAGS64 += $(XSTRCONST)
1065
1066ALTPICS= $(TRACEOBJS:%=pics/%)
1067
1068$(DYNLIB) := BUILD.SO = $(LD) -o $@ $(GSHARED) $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
1069
1070MAPFILES =	$(LIBCDIR)/port/mapfile-vers
1071
1072CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
1073		-I. -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
1074ASFLAGS=	$(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
1075		$(amd64_AS_XARCH)
1076
1077# As a favor to the dtrace syscall provider, libc still calls the
1078# old syscall traps that have been obsoleted by the *at() interfaces.
1079# Delete this to compile libc using only the new *at() system call traps
1080CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
1081
1082# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
1083pics/proc64_id.o	:= CFLAGS64 += -I$(SRC)/uts/intel
1084
1085# Inform the run-time linker about libc specialized initialization
1086RTLDINFO =	-z rtldinfo=tls_rtldinfo
1087DYNFLAGS +=	$(RTLDINFO)
1088
1089# Force libc's internal references to be resolved immediately upon loading
1090# in order to avoid critical region problems.  Since almost all libc symbols
1091# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
1092DYNFLAGS +=	-znow
1093
1094BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
1095
1096# Override this top level flag so the compiler builds in its native
1097# C99 mode.  This has been enabled to support the complex arithmetic
1098# added to libc.
1099CSTD=	$(CSTD_GNU99)
1100
1101# libc method of building an archive
1102# The "$(GREP) -v ' L '" part is necessary only until
1103# lorder is fixed to ignore thread-local variables.
1104BUILD.AR= $(RM) $@ ; \
1105	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
1106
1107# extra files for the clean target
1108CLEANFILES +=			\
1109	$(LIBCDIR)/port/gen/errlst.c	\
1110	$(LIBCDIR)/port/gen/new_list.c	\
1111	assym.h			\
1112	genassym		\
1113	crt/_rtld.s		\
1114	pics/crti.o		\
1115	pics/crtn.o		\
1116	$(ALTPICS)
1117
1118CLOBBERFILES +=	$(LIB_PIC)
1119
1120# conditional assignments
1121# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1122$(DYNLIB) := CRTI = crti.o
1123$(DYNLIB) := CRTN = crtn.o
1124
1125# Files which need the threads .il inline template
1126TIL=				\
1127	aio.o			\
1128	alloc.o			\
1129	assfail.o		\
1130	atexit.o		\
1131	atfork.o		\
1132	cancel.o		\
1133	door_calls.o		\
1134	err.o			\
1135	errno.o			\
1136	lwp.o			\
1137	ma.o			\
1138	machdep.o		\
1139	posix_aio.o		\
1140	pthr_attr.o		\
1141	pthr_barrier.o		\
1142	pthr_cond.o		\
1143	pthr_mutex.o		\
1144	pthr_rwlock.o		\
1145	pthread.o		\
1146	rand.o			\
1147	rwlock.o		\
1148	scalls.o		\
1149	sched.o			\
1150	sema.o			\
1151	sigaction.o		\
1152	sigev_thread.o		\
1153	spawn.o			\
1154	stack.o			\
1155	synch.o			\
1156	tdb_agent.o		\
1157	thr.o			\
1158	thread_interface.o	\
1159	thread_pool.o		\
1160	thrp_unwind.o		\
1161	tls.o			\
1162	tmem.o			\
1163	tsd.o
1164
1165$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1166
1167# pics/mul64.o := CFLAGS64 += crt/mul64.il
1168
1169# large-file-aware components that should be built large
1170
1171#$(COMSYSOBJS64:%=pics/%) := \
1172#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1173
1174#$(SYSOBJS64:%=pics/%) := \
1175#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1176
1177#$(PORTGEN64:%=pics/%) := \
1178#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1179
1180#$(PORTSTDIO64:%=pics/%) := \
1181#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1182
1183#$(PORTSYS64:%=pics/%) := \
1184#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1185
1186$(PORTSTDIO_W:%=pics/%) := \
1187	CPPFLAGS += -D_WIDE
1188
1189$(PORTPRINT_W:%=pics/%) := \
1190	CPPFLAGS += -D_WIDE
1191
1192$(PORTPRINT_C89:%=pics/%) := \
1193	CPPFLAGS += -D_C89_INTMAX32
1194
1195$(PORTSTDIO_C89:%=pics/%) := \
1196	CPPFLAGS += -D_C89_INTMAX32
1197
1198$(PORTI18N_COND:%=pics/%) := \
1199	CPPFLAGS += -D_WCS_LONGLONG
1200
1201pics/arc4random.o :=	CPPFLAGS += -I$(SRC)/common/crypto/chacha
1202
1203pics/__clock_gettime.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1204pics/gettimeofday.o := CPPFLAGS += $(COMMPAGE_CPPFLAGS)
1205
1206#
1207# Disable the stack protector due to issues with bootstrapping rtld. See
1208# cmd/sgs/rtld/Makefile.com for more information.
1209#
1210STACKPROTECT = none
1211
1212.KEEP_STATE:
1213
1214all: $(LIBS) $(LIB_PIC)
1215
1216# object files that depend on inline template
1217$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1218# pics/mul64.o: crt/mul64.il
1219
1220# include common libc targets
1221include ../Makefile.targ
1222
1223# We need to strip out all CTF data from the static library
1224$(LIB_PIC) := DIR = pics
1225$(LIB_PIC): pics $$(PICS)
1226	$(BUILD.AR)
1227	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1228	$(AR) -ts $@ > /dev/null
1229	$(POST_PROCESS_A)
1230
1231ASSYMDEP_OBJS=			\
1232	_lwp_mutex_unlock.o	\
1233	_stack_grow.o		\
1234	asm_subr.o		\
1235	getcontext.o		\
1236	setjmp.o		\
1237	tls_get_addr.o		\
1238	vforkx.o
1239
1240$(ASSYMDEP_OBJS:%=pics/%): assym.h
1241
1242# assym.h build rules
1243
1244GENASSYM_C = genassym.c
1245LDFLAGS.native = $(LDASSERTS) $(BDIRECT)
1246
1247genassym := NATIVE_LIBS += libc.so
1248
1249genassym: $(GENASSYM_C)
1250	$(NATIVECC) $(NATIVE_CFLAGS) -Iinc -I$(LIBCDIR)/inc $(CPPFLAGS.native) \
1251		$(LDFLAGS.native) -o $@ $(GENASSYM_C)
1252
1253OFFSETS = $(LIBCDIR)/$(MACH)/offsets.in
1254
1255assym.h: $(OFFSETS) genassym
1256	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1257	./genassym >>$@
1258
1259# derived C source and related explicit dependencies
1260$(LIBCDIR)/port/gen/errlst.c + \
1261$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
1262	cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist
1263
1264pics/errlst.o: $(LIBCDIR)/port/gen/errlst.c
1265
1266pics/new_list.o: $(LIBCDIR)/port/gen/new_list.c
1267