Powerpc is special here. powerpc and powerpc64 use different ABIs, so

their implementations aren't in the same files.  Introduce LIBC_ARCH
and use that in preference to MACHINE_CPUARCH.  Tested by amd64 and
powerpc64 builds (thanks nathanw@)
This commit is contained in:
imp 2010-08-24 20:54:43 +00:00
parent d3a20dc0b9
commit a34c7e0187
9 changed files with 35 additions and 32 deletions

View File

@ -5,6 +5,15 @@ SHLIBDIR?= /lib
.include <bsd.own.mk>
# We have to special case powerpc and powerpc64, since they mostly have
# the same source implementation. libc is very different due to large
# ABI differences.
.if ${LIBC_ARCH} == "powerpc"
LIBC_ARCH=${MACHINE_ARCH}
.else
LIBC_ARCH=${LIBC_ARCH}
.endif
# All library objects contain FreeBSD revision strings by default; they may be
# excluded as a space-saving measure. To produce a library that does
# not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
@ -15,7 +24,7 @@ LIB=c
SHLIB_MAJOR= 7
WARNS?= 2
CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include
CFLAGS+=-I${.CURDIR}/${MACHINE_CPUARCH}
CFLAGS+=-I${.CURDIR}/${LIBC_ARCH}
CFLAGS+=-DNLS
CLEANFILES+=tags
INSTALL_PIC_ARCHIVE=
@ -36,7 +45,7 @@ MDASM=
MIASM=
NOASM=
.include "${.CURDIR}/${MACHINE_CPUARCH}/Makefile.inc"
.include "${.CURDIR}/${LIBC_ARCH}/Makefile.inc"
.include "${.CURDIR}/db/Makefile.inc"
.include "${.CURDIR}/compat-43/Makefile.inc"
.include "${.CURDIR}/gdtoa/Makefile.inc"
@ -49,14 +58,14 @@ NOASM=
.include "${.CURDIR}/net/Makefile.inc"
.include "${.CURDIR}/nls/Makefile.inc"
.include "${.CURDIR}/posix1e/Makefile.inc"
.if ${MACHINE_CPUARCH} != "amd64" && \
${MACHINE_CPUARCH} != "ia64" && \
${MACHINE_ARCH} != "powerpc64" && \
${MACHINE_CPUARCH} != "sparc64" && \
${MACHINE_CPUARCH} != "mips"
.if ${LIBC_ARCH} != "amd64" && \
${LIBC_ARCH} != "ia64" && \
${LIBC_ARCH} != "powerpc64" && \
${LIBC_ARCH} != "sparc64" && \
${LIBC_ARCH} != "mips"
.include "${.CURDIR}/quad/Makefile.inc"
.endif
.if ${MACHINE_ARCH} == "mips" && \
.if ${LIBC_ARCH} == "mips" && \
(!defined(TARGET_ABI) || ${TARGET_ABI} == "o32")
.include "${.CURDIR}/quad/Makefile.inc"
.endif
@ -70,7 +79,7 @@ NOASM=
.include "${.CURDIR}/rpc/Makefile.inc"
.include "${.CURDIR}/uuid/Makefile.inc"
.include "${.CURDIR}/xdr/Makefile.inc"
.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
.if ${LIBC_ARCH} == "arm" || ${LIBC_ARCH} == "mips"
.include "${.CURDIR}/softfloat/Makefile.inc"
.endif
.if ${MK_NIS} != "no"
@ -115,14 +124,14 @@ KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \
strcat.c strcmp.c strcpy.c strlen.c strncpy.c
libkern: libkern.gen libkern.${MACHINE_CPUARCH}
libkern: libkern.gen libkern.${LIBC_ARCH}
libkern.gen: ${KQSRCS} ${KSRCS}
cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
libkern.${MACHINE_CPUARCH}:: ${KMSRCS}
libkern.${LIBC_ARCH}:: ${KMSRCS}
.if defined(KMSRCS) && !empty(KMSRCS)
cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${MACHINE_CPUARCH}
cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
.endif
.include <bsd.lib.mk>

View File

@ -2,7 +2,7 @@
# $FreeBSD$
# compat-43 sources
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/compat-43 ${.CURDIR}/compat-43
.PATH: ${.CURDIR}/${LIBC_ARCH}/compat-43 ${.CURDIR}/compat-43
SRCS+= creat.c gethostid.c getwd.c killpg.c sethostid.c setpgrp.c \
setrgid.c setruid.c sigcompat.c

View File

@ -2,7 +2,7 @@
# $FreeBSD$
# machine-independent gen sources
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/gen ${.CURDIR}/gen
.PATH: ${.CURDIR}/${LIBC_ARCH}/gen ${.CURDIR}/gen
SRCS+= __getosreldate.c __xuname.c \
_once_stub.c _pthread_stubs.c _rand48.c _spinlock_stub.c \
@ -38,9 +38,7 @@ SRCS+= __getosreldate.c __xuname.c \
SYM_MAPS+=${.CURDIR}/gen/Symbol.map
# machine-dependent gen sources
.if exists(${.CURDIR}/${MACHINE_CPUARCH}/gen/Makefile.inc)
.include "${.CURDIR}/${MACHINE_CPUARCH}/gen/Makefile.inc"
.endif
.sinclude "${.CURDIR}/${LIBC_ARCH}/gen/Makefile.inc"
MAN+= alarm.3 arc4random.3 \
basename.3 check_utility_compat.3 clock.3 \

View File

@ -2,7 +2,7 @@
# $FreeBSD$
# locale sources
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/locale ${.CURDIR}/locale
.PATH: ${.CURDIR}/${LIBC_ARCH}/locale ${.CURDIR}/locale
SRCS+= ascii.c big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \
gb18030.c gb2312.c gbk.c isctype.c iswctype.c \

View File

@ -2,9 +2,9 @@
# $FreeBSD$
# Quad support, if needed
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/quad ${.CURDIR}/quad
.PATH: ${.CURDIR}/${LIBC_ARCH}/quad ${.CURDIR}/quad
.if ${MACHINE_CPUARCH} == "i386"
.if ${LIBC_ARCH} == "i386"
SRCS+= cmpdi2.c divdi3.c moddi3.c qdivrem.c ucmpdi2.c udivdi3.c umoddi3.c

View File

@ -2,10 +2,10 @@
# $FreeBSD$
SOFTFLOAT_BITS?=64
.PATH: ${MACHINE_CPUARCH}/softfloat \
.PATH: ${LIBC_ARCH}/softfloat \
${.CURDIR}/softfloat/bits${SOFTFLOAT_BITS} ${.CURDIR}/softfloat
CFLAGS+= -I${.CURDIR}/${MACHINE_CPUARCH}/softfloat -I${.CURDIR}/softfloat
CFLAGS+= -I${.CURDIR}/${LIBC_ARCH}/softfloat -I${.CURDIR}/softfloat
CFLAGS+= -DSOFTFLOAT_FOR_GCC
SRCS+= softfloat.c

View File

@ -2,7 +2,7 @@
# $FreeBSD$
# machine-independent stdlib sources
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/stdlib ${.CURDIR}/stdlib
.PATH: ${.CURDIR}/${LIBC_ARCH}/stdlib ${.CURDIR}/stdlib
MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \
@ -16,7 +16,7 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map
# machine-dependent stdlib sources
.sinclude "${.CURDIR}/${MACHINE_CPUARCH}/stdlib/Makefile.inc"
.sinclude "${.CURDIR}/${LIBC_ARCH}/stdlib/Makefile.inc"
MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \
div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \

View File

@ -1,7 +1,7 @@
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
# $FreeBSD$
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/string ${.CURDIR}/string
.PATH: ${.CURDIR}/${LIBC_ARCH}/string ${.CURDIR}/string
CFLAGS+= -I${.CURDIR}/locale
@ -26,9 +26,7 @@ SYM_MAPS+= ${.CURDIR}/string/Symbol.map
# machine-dependent string sources
.if exists(${.CURDIR}/${MACHINE_CPUARCH}/string/Makefile.inc)
.include "${.CURDIR}/${MACHINE_CPUARCH}/string/Makefile.inc"
.endif
.sinclude "${.CURDIR}/${LIBC_ARCH}/string/Makefile.inc"
MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \

View File

@ -2,7 +2,7 @@
# $FreeBSD$
# sys sources
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/sys ${.CURDIR}/sys
.PATH: ${.CURDIR}/${LIBC_ARCH}/sys ${.CURDIR}/sys
# Include the generated makefile containing the *complete* list
# of syscall names in MIASM.
@ -13,9 +13,7 @@
# MDASM names override the default syscall names in MIASM.
# NOASM will prevent the default syscall code from being generated.
#
.if exists(${.CURDIR}/${MACHINE_CPUARCH}/sys/Makefile.inc)
.include "${.CURDIR}/${MACHINE_CPUARCH}/sys/Makefile.inc"
.endif
.sinclude "${.CURDIR}/${LIBC_ARCH}/sys/Makefile.inc"
# Sources common to both syscall interfaces:
SRCS+= stack_protector.c stack_protector_compat.c __error.c