xref: /titanic_51/usr/src/lib/libc/amd64/Makefile (revision 3929e1952bab7b01feb2d352f78fc6ebeda2d052)
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 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27LIBCBASE=.
28
29LIBRARY= libc.a
30LIB_PIC= libc_pic.a
31VERS=	.1
32CPP=	/usr/lib/cpp
33TARGET_ARCH=	amd64
34
35# objects are grouped by source directory
36
37# local objects
38STRETS=
39
40CRTOBJS=			\
41	cerror.o
42
43DYNOBJS=
44
45FPOBJS=				\
46	_base_il.o		\
47	fpgetmask.o		\
48	fpgetround.o		\
49	fpsetmask.o		\
50	fpsetround.o		\
51	fpstart.o
52
53I386FPOBJS=			\
54	_D_cplx_div.o		\
55	_D_cplx_div_ix.o	\
56	_D_cplx_div_rx.o	\
57	_D_cplx_lr_div.o	\
58	_D_cplx_lr_div_ix.o	\
59	_D_cplx_lr_div_rx.o	\
60	_D_cplx_mul.o		\
61	_F_cplx_div.o		\
62	_F_cplx_div_ix.o	\
63	_F_cplx_div_rx.o	\
64	_F_cplx_lr_div.o	\
65	_F_cplx_lr_div_ix.o	\
66	_F_cplx_lr_div_rx.o	\
67	_F_cplx_mul.o		\
68	_X_cplx_div.o		\
69	_X_cplx_div_ix.o	\
70	_X_cplx_div_rx.o	\
71	_X_cplx_lr_div.o	\
72	_X_cplx_lr_div_ix.o	\
73	_X_cplx_lr_div_rx.o	\
74	_X_cplx_mul.o
75
76FPASMOBJS=			\
77	__xgetRD.o		\
78	_xtoll.o		\
79	_xtoull.o		\
80	fpcw.o			\
81	fpgetsticky.o		\
82	fpsetsticky.o
83
84ATOMICOBJS=			\
85	atomic.o
86
87XATTROBJS=			\
88	xattr_common.o
89COMOBJS=			\
90	bcmp.o			\
91	bcopy.o			\
92	bsearch.o		\
93	bzero.o			\
94	ffs.o			\
95	qsort.o			\
96	strtol.o		\
97	strtoul.o		\
98	strtoll.o		\
99	strtoull.o
100
101GENOBJS=			\
102	_getsp.o		\
103	abs.o			\
104	alloca.o		\
105	attrat.o		\
106	byteorder.o		\
107	cuexit.o		\
108	ecvt.o			\
109	errlst.o		\
110	amd64_data.o		\
111	ldivide.o		\
112	lock.o			\
113	makectxt.o		\
114	memccpy.o		\
115	memchr.o		\
116	memcmp.o		\
117	memcpy.o		\
118	memset.o		\
119	new_list.o		\
120	proc64_id.o		\
121	proc64_support.o	\
122	setjmp.o		\
123	siginfolst.o		\
124	siglongjmp.o		\
125	strcmp.o		\
126	strcpy.o		\
127	strlen.o		\
128	strncmp.o		\
129	strncpy.o		\
130	strnlen.o		\
131	sync_instruction_memory.o
132
133# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
134# This macro should ALWAYS be empty; native APIs are already 'large file'.
135COMSYSOBJS64=
136
137SYSOBJS64=
138
139COMSYSOBJS=			\
140	__clock_timer.o		\
141	__getloadavg.o		\
142	__rusagesys.o		\
143	__signotify.o		\
144	__sigrt.o		\
145	__time.o		\
146	_lgrp_home_fast.o	\
147	_lgrpsys.o		\
148	_nfssys.o		\
149	_portfs.o		\
150	_pset.o			\
151	_rpcsys.o		\
152	_sigaction.o		\
153	_so_accept.o		\
154	_so_bind.o		\
155	_so_connect.o		\
156	_so_getpeername.o	\
157	_so_getsockname.o	\
158	_so_getsockopt.o	\
159	_so_listen.o		\
160	_so_recv.o		\
161	_so_recvfrom.o		\
162	_so_recvmsg.o		\
163	_so_send.o		\
164	_so_sendmsg.o		\
165	_so_sendto.o		\
166	_so_setsockopt.o	\
167	_so_shutdown.o		\
168	_so_socket.o		\
169	_so_socketpair.o	\
170	_sockconfig.o		\
171	access.o		\
172	acct.o			\
173	acl.o			\
174	adjtime.o		\
175	alarm.o			\
176	brk.o			\
177	chdir.o			\
178	chmod.o			\
179	chown.o			\
180	chroot.o		\
181	cladm.o			\
182	close.o			\
183	creat.o			\
184	dup.o			\
185	execve.o		\
186	exit.o			\
187	facl.o			\
188	fchdir.o		\
189	fchmod.o		\
190	fchown.o		\
191	fchroot.o		\
192	fcntl.o			\
193	fdsync.o		\
194	fpathconf.o		\
195	fstat.o			\
196	fstatfs.o		\
197	fstatvfs.o		\
198	getcpuid.o		\
199	getdents.o		\
200	getegid.o		\
201	geteuid.o		\
202	getgid.o		\
203	getgroups.o		\
204	gethrtime.o		\
205	getitimer.o		\
206	getmsg.o		\
207	getpid.o		\
208	getpmsg.o		\
209	getppid.o		\
210	getrlimit.o		\
211	getuid.o		\
212	gtty.o			\
213	install_utrap.o		\
214	ioctl.o			\
215	kaio.o			\
216	kill.o			\
217	lchown.o		\
218	link.o			\
219	llseek.o		\
220	lseek.o			\
221	lstat.o			\
222	mmapobjsys.o		\
223	memcntl.o		\
224	mincore.o		\
225	mkdir.o			\
226	mknod.o			\
227	mmap.o			\
228	modctl.o		\
229	mount.o			\
230	mprotect.o		\
231	munmap.o		\
232	nice.o			\
233	ntp_adjtime.o		\
234	ntp_gettime.o		\
235	open.o			\
236	p_online.o		\
237	pathconf.o		\
238	pause.o			\
239	pcsample.o		\
240	pollsys.o		\
241	pread.o			\
242	priocntlset.o		\
243	processor_bind.o	\
244	processor_info.o	\
245	profil.o		\
246	putmsg.o		\
247	putpmsg.o		\
248	pwrite.o		\
249	read.o			\
250	readlink.o		\
251	readv.o			\
252	rename.o		\
253	resolvepath.o		\
254	rmdir.o			\
255	seteguid.o		\
256	setgid.o		\
257	setgroups.o		\
258	setitimer.o		\
259	setreid.o		\
260	setrlimit.o		\
261	setuid.o		\
262	sigaltstk.o		\
263	sigprocmsk.o		\
264	sigsendset.o		\
265	sigsuspend.o		\
266	stat.o			\
267	statfs.o		\
268	statvfs.o		\
269	stty.o			\
270	symlink.o		\
271	sync.o			\
272	sysconfig.o		\
273	sysfs.o			\
274	sysinfo.o		\
275	syslwp.o		\
276	times.o			\
277	ulimit.o		\
278	umask.o			\
279	umount2.o		\
280	unlink.o		\
281	utssys.o		\
282	uucopy.o		\
283	vhangup.o		\
284	waitid.o		\
285	write.o			\
286	writev.o		\
287	yield.o
288
289SYSOBJS=			\
290	__clock_gettime.o	\
291	__getcontext.o		\
292	__uadmin.o		\
293	_lwp_mutex_unlock.o	\
294	_stack_grow.o		\
295	door.o			\
296	forkx.o			\
297	forkallx.o		\
298	fxstat.o		\
299	getcontext.o		\
300	gettimeofday.o		\
301	lwp_private.o		\
302	lxstat.o		\
303	nuname.o		\
304	pipe.o			\
305	syscall.o		\
306	sysi86.o		\
307	tls_get_addr.o		\
308	uadmin.o		\
309	umount.o		\
310	uname.o			\
311	vforkx.o		\
312	xmknod.o		\
313	xstat.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 ../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	assert.o		\
356	atof.o			\
357	atoi.o			\
358	atol.o			\
359	atoll.o			\
360	attropen.o		\
361	atexit.o		\
362	atfork.o		\
363	basename.o		\
364	calloc.o		\
365	catgets.o		\
366	catopen.o		\
367	cfgetispeed.o		\
368	cfgetospeed.o		\
369	cfree.o			\
370	cfsetispeed.o		\
371	cfsetospeed.o		\
372	cftime.o		\
373	clock.o			\
374	closedir.o		\
375	closefrom.o		\
376	confstr.o		\
377	crypt.o			\
378	csetlen.o		\
379	ctime.o			\
380	ctime_r.o		\
381	daemon.o		\
382	deflt.o			\
383	directio.o		\
384	dirname.o		\
385	div.o			\
386	drand48.o		\
387	dup2.o			\
388	env_data.o		\
389	err.o			\
390	errno.o			\
391	euclen.o		\
392	event_port.o		\
393	execvp.o		\
394	fattach.o		\
395	fdetach.o		\
396	fdopendir.o		\
397	fmtmsg.o		\
398	ftime.o			\
399	ftok.o			\
400	ftw.o			\
401	gcvt.o			\
402	getauxv.o		\
403	getcwd.o		\
404	getdate_err.o		\
405	getdtblsize.o		\
406	getenv.o		\
407	getexecname.o		\
408	getgrnam.o		\
409	getgrnam_r.o		\
410	gethostid.o		\
411	gethostname.o		\
412	gethz.o			\
413	getisax.o		\
414	getloadavg.o		\
415	getlogin.o		\
416	getmntent.o		\
417	getnetgrent.o		\
418	getopt.o		\
419	getopt_long.o		\
420	getpagesize.o		\
421	getpw.o			\
422	getpwnam.o		\
423	getpwnam_r.o		\
424	getrusage.o		\
425	getspent.o		\
426	getspent_r.o		\
427	getsubopt.o		\
428	gettxt.o		\
429	getusershell.o		\
430	getut.o			\
431	getutx.o		\
432	getvfsent.o		\
433	getwd.o			\
434	getwidth.o		\
435	getxby_door.o		\
436	gtxt.o			\
437	hsearch.o		\
438	iconv.o			\
439	imaxabs.o		\
440	imaxdiv.o		\
441	index.o			\
442	initgroups.o		\
443	insque.o		\
444	isaexec.o		\
445	isastream.o		\
446	isatty.o		\
447	killpg.o		\
448	klpdlib.o		\
449	l64a.o			\
450	lckpwdf.o		\
451	lconstants.o		\
452	lexp10.o		\
453	lfind.o			\
454	lfmt.o			\
455	lfmt_log.o		\
456	lldiv.o			\
457	llog10.o		\
458	lltostr.o		\
459	lmath.o			\
460	localtime.o		\
461	lsearch.o		\
462	madvise.o		\
463	malloc.o		\
464	memalign.o		\
465	mkdev.o			\
466	mkdtemp.o		\
467	mkfifo.o		\
468	mkstemp.o		\
469	mktemp.o		\
470	mlock.o			\
471	mlockall.o		\
472	mon.o			\
473	msync.o			\
474	munlock.o		\
475	munlockall.o		\
476	ndbm.o			\
477	nftw.o			\
478	nlspath_checks.o	\
479	nsparse.o		\
480	nss_common.o		\
481	nss_dbdefs.o		\
482	nss_deffinder.o		\
483	opendir.o		\
484	opt_data.o		\
485	perror.o		\
486	pfmt.o			\
487	pfmt_data.o		\
488	pfmt_print.o		\
489	plock.o			\
490	poll.o			\
491	posix_fadvise.o		\
492	posix_fallocate.o	\
493	posix_madvise.o		\
494	posix_memalign.o	\
495	priocntl.o		\
496	privlib.o		\
497	priv_str_xlate.o	\
498	psiginfo.o		\
499	psignal.o		\
500	pt.o			\
501	putpwent.o		\
502	putspent.o		\
503	raise.o			\
504	rand.o			\
505	random.o		\
506	rctlops.o		\
507	readdir.o		\
508	readdir_r.o		\
509	realpath.o		\
510	reboot.o		\
511	regexpr.o		\
512	remove.o		\
513	rewinddir.o		\
514	rindex.o		\
515	scandir.o		\
516	seekdir.o		\
517	select.o		\
518	setlabel.o		\
519	setpriority.o		\
520	settimeofday.o		\
521	sh_locks.o		\
522	sigflag.o		\
523	siglist.o		\
524	sigsend.o		\
525	sigsetops.o		\
526	ssignal.o		\
527	stack.o			\
528	str2sig.o		\
529	strcase_charmap.o	\
530	strcasecmp.o		\
531	strcat.o		\
532	strchr.o		\
533	strcspn.o		\
534	strdup.o		\
535	strerror.o		\
536	strlcat.o		\
537	strlcpy.o		\
538	strncasecmp.o		\
539	strncat.o		\
540	strpbrk.o		\
541	strrchr.o		\
542	strsep.o		\
543	strsignal.o		\
544	strspn.o		\
545	strstr.o		\
546	strtod.o		\
547	strtoimax.o		\
548	strtok.o		\
549	strtok_r.o		\
550	strtoumax.o		\
551	swab.o			\
552	swapctl.o		\
553	sysconf.o		\
554	syslog.o		\
555	tcdrain.o		\
556	tcflow.o		\
557	tcflush.o		\
558	tcgetattr.o		\
559	tcgetpgrp.o		\
560	tcgetsid.o		\
561	tcsendbreak.o		\
562	tcsetattr.o		\
563	tcsetpgrp.o		\
564	tell.o			\
565	telldir.o		\
566	tfind.o			\
567	time_data.o		\
568	time_gdata.o		\
569	truncate.o		\
570	tsdalloc.o		\
571	tsearch.o		\
572	ttyname.o		\
573	ttyslot.o		\
574	ualarm.o		\
575	ucred.o			\
576	valloc.o		\
577	vlfmt.o			\
578	vpfmt.o			\
579	waitpid.o		\
580	walkstack.o		\
581	wdata.o			\
582	xgetwidth.o		\
583	xpg4.o			\
584	xpg6.o
585
586PORTPRINT_W=			\
587	doprnt_w.o
588
589PORTPRINT=			\
590	asprintf.o		\
591	doprnt.o		\
592	fprintf.o		\
593	printf.o		\
594	snprintf.o		\
595	sprintf.o		\
596	vfprintf.o		\
597	vprintf.o		\
598	vsnprintf.o		\
599	vsprintf.o		\
600	vwprintf.o		\
601	wprintf.o
602
603# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
604# This macro should ALWAYS be empty; native APIs are already 'large file'.
605PORTSTDIO64=
606
607PORTSTDIO_W=			\
608	doscan_w.o
609
610PORTSTDIO=			\
611	__extensions.o		\
612	_endopen.o		\
613	_filbuf.o		\
614	_findbuf.o		\
615	_flsbuf.o		\
616	_wrtchk.o		\
617	clearerr.o		\
618	ctermid.o		\
619	ctermid_r.o		\
620	cuserid.o		\
621	data.o			\
622	doscan.o		\
623	fdopen.o		\
624	feof.o			\
625	ferror.o		\
626	fgetc.o			\
627	fgets.o			\
628	fileno.o		\
629	flockf.o		\
630	flush.o			\
631	fopen.o			\
632	fpos.o			\
633	fputc.o			\
634	fputs.o			\
635	fread.o			\
636	fseek.o			\
637	fseeko.o		\
638	ftell.o			\
639	ftello.o		\
640	fwrite.o		\
641	getc.o			\
642	getchar.o		\
643	getpass.o		\
644	gets.o			\
645	getw.o			\
646	mse.o			\
647	popen.o			\
648	putc.o			\
649	putchar.o		\
650	puts.o			\
651	putw.o			\
652	rewind.o		\
653	scanf.o			\
654	setbuf.o		\
655	setbuffer.o		\
656	setvbuf.o		\
657	system.o		\
658	tempnam.o		\
659	tmpfile.o		\
660	tmpnam_r.o		\
661	ungetc.o		\
662	vscanf.o		\
663	vwscanf.o		\
664	wscanf.o
665
666PORTI18N=			\
667	__fgetwc_xpg5.o		\
668	__fgetws_xpg5.o		\
669	__fputwc_xpg5.o		\
670	__fputws_xpg5.o		\
671	__ungetwc_xpg5.o	\
672	getwchar.o		\
673	putwchar.o		\
674	putws.o			\
675	strtows.o		\
676	wcsstr.o		\
677	wcstoimax.o		\
678	wcstol.o		\
679	wcstoul.o		\
680	wcswcs.o		\
681	wmemchr.o		\
682	wmemcmp.o		\
683	wmemcpy.o		\
684	wmemmove.o		\
685	wmemset.o		\
686	wscasecmp.o		\
687	wscat.o			\
688	wschr.o			\
689	wscmp.o			\
690	wscpy.o			\
691	wscspn.o		\
692	wsdup.o			\
693	wslen.o			\
694	wsncasecmp.o		\
695	wsncat.o		\
696	wsncmp.o		\
697	wsncpy.o		\
698	wspbrk.o		\
699	wsprintf.o		\
700	wsrchr.o		\
701	wsscanf.o		\
702	wsspn.o			\
703	wstod.o			\
704	wstok.o			\
705	wstol.o			\
706	wstoll.o		\
707	wsxfrm.o		\
708	gettext.o		\
709	gettext_gnu.o		\
710	gettext_real.o		\
711	gettext_util.o		\
712	plural_parser.o		\
713	wdresolve.o		\
714	_ctype.o		\
715	isascii.o		\
716	toascii.o
717
718PORTI18N_COND=			\
719	wcstol_longlong.o	\
720	wcstoul_longlong.o
721
722AIOOBJS=			\
723	aio.o			\
724	aio_alloc.o		\
725	posix_aio.o
726
727RTOBJS=				\
728	clock_timer.o		\
729	mqueue.o		\
730	pos4obj.o		\
731	sched.o			\
732	sem.o			\
733	shm.o			\
734	sigev_thread.o
735
736TPOOLOBJS=			\
737	thread_pool.o
738
739THREADSOBJS=			\
740	alloc.o			\
741	assfail.o		\
742	cancel.o		\
743	door_calls.o		\
744	pthr_attr.o		\
745	pthr_barrier.o		\
746	pthr_cond.o		\
747	pthr_mutex.o		\
748	pthr_rwlock.o		\
749	pthread.o		\
750	rwlock.o		\
751	scalls.o		\
752	sema.o			\
753	sigaction.o		\
754	spawn.o			\
755	synch.o			\
756	tdb_agent.o		\
757	thr.o			\
758	thread_interface.o	\
759	tls.o			\
760	tsd.o
761
762THREADSMACHOBJS=		\
763	machdep.o
764
765THREADSASMOBJS=			\
766	asm_subr.o
767
768UNICODEOBJS=			\
769	u8_textprep.o		\
770	uconv.o
771
772UNWINDMACHOBJS=			\
773	call_frame_inst.o	\
774	eh_frame.o		\
775	thrp_unwind.o		\
776	unwind.o
777
778pics/unwind.o:= COPTFLAG64 =
779
780UNWINDASMOBJS=			\
781	unwind_frame.o
782
783# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
784# This macro should ALWAYS be empty; native APIs are already 'large file'.
785PORTSYS64=
786
787PORTSYS=			\
788	_autofssys.o		\
789	acctctl.o		\
790	bsd_signal.o		\
791	corectl.o		\
792	exacctsys.o		\
793	execl.o			\
794	execle.o		\
795	execv.o			\
796	fsmisc.o		\
797	fstatat.o		\
798	getpagesizes.o		\
799	getpeerucred.o		\
800	inst_sync.o		\
801	issetugid.o		\
802	label.o			\
803	libc_fcntl.o		\
804	libc_link.o		\
805	libc_open.o		\
806	lockf.o			\
807	lwp.o			\
808	lwp_cond.o		\
809	lwp_rwlock.o		\
810	lwp_sigmask.o		\
811	meminfosys.o		\
812	msgsys.o		\
813	nfssys.o		\
814	openat.o		\
815	pgrpsys.o		\
816	posix_sigwait.o		\
817	ppriv.o			\
818	psetsys.o		\
819	rctlsys.o		\
820	sbrk.o			\
821	semsys.o		\
822	set_errno.o		\
823	sharefs.o		\
824	shmsys.o		\
825	sidsys.o		\
826	siginterrupt.o		\
827	signal.o		\
828	sigpending.o		\
829	sigstack.o		\
830	tasksys.o		\
831	time.o			\
832	time_util.o		\
833	ucontext.o		\
834	ustat.o			\
835	utimesys.o		\
836	zone.o
837
838PORTREGEX=			\
839	glob.o			\
840	regcmp.o		\
841	regex.o			\
842	wordexp.o
843
844VALUES=				\
845	values-Xa.o
846
847MOSTOBJS=			\
848	$(STRETS)		\
849	$(CRTOBJS)		\
850	$(DYNOBJS)		\
851	$(FPOBJS)		\
852	$(I386FPOBJS)		\
853	$(FPASMOBJS)		\
854	$(ATOMICOBJS)		\
855	$(XATTROBJS)		\
856	$(COMOBJS)		\
857	$(GENOBJS)		\
858	$(PORTFP)		\
859	$(PORTGEN)		\
860	$(PORTGEN64)		\
861	$(PORTI18N)		\
862	$(PORTI18N_COND)	\
863	$(PORTPRINT)		\
864	$(PORTPRINT_W)		\
865	$(PORTREGEX)		\
866	$(PORTSTDIO)		\
867	$(PORTSTDIO64)		\
868	$(PORTSTDIO_W)		\
869	$(PORTSYS)		\
870	$(PORTSYS64)		\
871	$(AIOOBJS)		\
872	$(RTOBJS)		\
873	$(TPOOLOBJS)		\
874	$(THREADSOBJS)		\
875	$(THREADSMACHOBJS)	\
876	$(THREADSASMOBJS)	\
877	$(UNICODEOBJS)		\
878	$(UNWINDMACHOBJS)	\
879	$(UNWINDASMOBJS)	\
880	$(COMSYSOBJS)		\
881	$(SYSOBJS)		\
882	$(COMSYSOBJS64)		\
883	$(SYSOBJS64)		\
884	$(VALUES)
885
886TRACEOBJS=			\
887	plockstat.o
888
889# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
890# modules whose source is provided in the $(SRC)/lib/common directory.
891# This must be done because otherwise the Sun C compiler would insert
892# its own versions of these modules and those versions contain code
893# to call out to C++ initialization functions.  Such C++ initialization
894# functions can call back into libc before thread initialization is
895# complete and this leads to segmentation violations and other problems.
896# Since libc contains no C++ code, linking with the minimal crti.o and
897# crtn.o modules is safe and avoids the problems described above.
898OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
899CRTSRCS= ../../common/amd64
900
901# include common library definitions
902include ../../Makefile.lib
903include ../../Makefile.lib.64
904
905# NOTE: libc_i18n.a will be part of libc.so.1.  Therefore, the compilation
906# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
907# need to be compatible with the ones for the libc stuff.  Whenever the changes
908# that affect the compilation conditions of libc happened, those for libc_i18n
909# also need to be updated.
910
911CFLAGS64 += $(CTF_FLAGS)
912
913# This is necessary to avoid problems with calling _ex_unwind().
914# We probably don't want any inlining anyway.
915CFLAGS64 += -xinline=
916
917# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
918# enables ASSERT() checking in the threads portion of the library.
919# This is automatically enabled for DEBUG builds, not for non-debug builds.
920THREAD_DEBUG =
921$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
922
923# Make string literals read-only to save memory
924CFLAGS64 += $(XSTRCONST)
925
926ALTPICS= $(TRACEOBJS:%=pics/%)
927
928$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
929$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
930
931MAPFILES =	../port/mapfile-vers mapfile-vers
932
933CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
934		-I. -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master) -I/usr/include
935ASFLAGS=	$(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
936		$(amd64_AS_XARCH)
937
938# Conditionally add support for making |wordexp()| check whether
939# /usr/bin/ksh is ksh93 or not
940include ../../../Makefile.ksh93switch
941CPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
942
943# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
944pics/proc64_id.o	:= CFLAGS64 += -I$(SRC)/uts/intel
945
946# Inform the run-time linker about libc specialized initialization
947RTLDINFO =	-z rtldinfo=tls_rtldinfo
948DYNFLAGS +=	$(RTLDINFO)
949
950# Force libc's internal references to be resolved immediately upon loading
951# in order to avoid critical region problems.  Since almost all libc symbols
952# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
953DYNFLAGS +=	-znow
954
955BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
956
957# Override this top level flag so the compiler builds in its native
958# C99 mode.  This has been enabled to support the complex arithmetic
959# added to libc.
960C99MODE=	$(C99_ENABLE)
961
962# libc method of building an archive
963BUILD.AR= $(RM) $@ ; \
964	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
965
966# extra files for the clean target
967CLEANFILES=			\
968	../port/gen/errlst.c	\
969	../port/gen/new_list.c	\
970	assym.h			\
971	genassym		\
972	crt/_rtld.s		\
973	pics/crti.o		\
974	pics/crtn.o		\
975	$(ALTPICS)
976
977CLOBBERFILES +=	$(LIB_PIC)
978
979# list of C source for lint
980SRCS=							\
981	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
982	$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c)	\
983	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
984	$(PORTFP:%.o=../port/fp/%.c)			\
985	$(PORTGEN:%.o=../port/gen/%.c)			\
986	$(PORTI18N:%.o=../port/i18n/%.c)		\
987	$(PORTPRINT:%.o=../port/print/%.c)		\
988	$(PORTREGEX:%.o=../port/regex/%.c)		\
989	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
990	$(PORTSYS:%.o=../port/sys/%.c)			\
991	$(AIOOBJS:%.o=../port/aio/%.c)			\
992	$(RTOBJS:%.o=../port/rt/%.c)			\
993	$(TPOOLOBJS:%.o=../port/tpool/%.c)		\
994	$(THREADSOBJS:%.o=../port/threads/%.c)		\
995	$(THREADSMACHOBJS:%.o=threads/%.c)		\
996	$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c)	\
997	$(UNWINDMACHOBJS:%.o=unwind/%.c)		\
998	$(FPOBJS:%.o=fp/%.c)				\
999	$(I386FPOBJS:%.o=../i386/fp/%.c)		\
1000	$(LIBCBASE)/gen/ecvt.c				\
1001	$(LIBCBASE)/gen/makectxt.c			\
1002	$(LIBCBASE)/gen/siginfolst.c			\
1003	$(LIBCBASE)/gen/siglongjmp.c			\
1004	$(LIBCBASE)/gen/sync_instruction_memory.c	\
1005	$(LIBCBASE)/sys/uadmin.c
1006
1007# conditional assignments
1008# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1009$(DYNLIB) := CRTI = crti.o
1010$(DYNLIB) := CRTN = crtn.o
1011
1012# Files which need the threads .il inline template
1013TIL=				\
1014	aio.o			\
1015	alloc.o			\
1016	assfail.o		\
1017	atexit.o		\
1018	atfork.o		\
1019	cancel.o		\
1020	door_calls.o		\
1021	errno.o			\
1022	lwp.o			\
1023	ma.o			\
1024	machdep.o		\
1025	posix_aio.o		\
1026	pthr_attr.o		\
1027	pthr_barrier.o		\
1028	pthr_cond.o		\
1029	pthr_mutex.o		\
1030	pthr_rwlock.o		\
1031	pthread.o		\
1032	rand.o			\
1033	rwlock.o		\
1034	scalls.o		\
1035	sched.o			\
1036	sema.o			\
1037	sigaction.o		\
1038	sigev_thread.o		\
1039	spawn.o			\
1040	stack.o			\
1041	synch.o			\
1042	tdb_agent.o		\
1043	thr.o			\
1044	thread_interface.o	\
1045	thread_pool.o		\
1046	thrp_unwind.o		\
1047	tls.o			\
1048	tsd.o
1049
1050$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1051
1052# pics/mul64.o := CFLAGS64 += crt/mul64.il
1053
1054# large-file-aware components that should be built large
1055
1056#$(COMSYSOBJS64:%=pics/%) := \
1057#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1058
1059#$(SYSOBJS64:%=pics/%) := \
1060#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1061
1062#$(PORTGEN64:%=pics/%) := \
1063#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1064
1065#$(PORTSTDIO64:%=pics/%) := \
1066#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1067
1068#$(PORTSYS64:%=pics/%) := \
1069#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1070
1071$(PORTSTDIO_W:%=pics/%) := \
1072	CPPFLAGS += -D_WIDE
1073
1074$(PORTPRINT_W:%=pics/%) := \
1075	CPPFLAGS += -D_WIDE
1076
1077$(PORTPRINT_C89:%=pics/%) := \
1078	CPPFLAGS += -D_C89_INTMAX32
1079
1080$(PORTSTDIO_C89:%=pics/%) := \
1081	CPPFLAGS += -D_C89_INTMAX32
1082
1083$(PORTI18N_COND:%=pics/%) := \
1084	CPPFLAGS += -D_WCS_LONGLONG
1085
1086.KEEP_STATE:
1087
1088all: $(LIBS) $(LIB_PIC)
1089
1090lint	:=	CPPFLAGS += -I../$(MACH)/fp
1091lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1092lint	:=	LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1093
1094lint:
1095	@echo $(LINT.c) ... $(LDLIBS)
1096	@$(LINT.c) $(SRCS) $(LDLIBS)
1097
1098$(LINTLIB):= SRCS=../port/llib-lc
1099$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1100$(LINTLIB):= LINTFLAGS64=-nvx -m64
1101
1102# object files that depend on inline template
1103$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1104# pics/mul64.o: crt/mul64.il
1105
1106# include common libc targets
1107include ../Makefile.targ
1108
1109# We need to strip out all CTF data from the static library
1110$(LIB_PIC) := DIR = pics
1111$(LIB_PIC): pics $$(PICS)
1112	$(BUILD.AR)
1113	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1114	$(AR) -ts $@ > /dev/null
1115	$(POST_PROCESS_A)
1116
1117ASSYMDEP_OBJS=			\
1118	_lwp_mutex_unlock.o	\
1119	_stack_grow.o		\
1120	asm_subr.o		\
1121	getcontext.o		\
1122	tls_get_addr.o		\
1123	vforkx.o
1124
1125$(ASSYMDEP_OBJS:%=pics/%): assym.h
1126
1127# assym.h build rules
1128
1129GENASSYM_C = genassym.c
1130
1131# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1132#	live in Makefile.master
1133
1134CPPFLAGS.genassym = \
1135	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1136
1137genassym: $(GENASSYM_C)
1138	$(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1139
1140OFFSETS = ../$(MACH)/offsets.in
1141
1142assym.h: $(OFFSETS) genassym
1143	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1144	./genassym >>$@
1145
1146# derived C source and related explicit dependencies
1147../port/gen/errlst.c + \
1148../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1149	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1150
1151pics/errlst.o: ../port/gen/errlst.c
1152
1153pics/new_list.o: ../port/gen/new_list.c
1154