From a34c7e01875a6937a85f5aeab3c3c4a9abad4989 Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 24 Aug 2010 20:54:43 +0000 Subject: 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@) --- lib/libc/Makefile | 33 +++++++++++++++++++++------------ lib/libc/compat-43/Makefile.inc | 2 +- lib/libc/gen/Makefile.inc | 6 ++---- lib/libc/locale/Makefile.inc | 2 +- lib/libc/quad/Makefile.inc | 4 ++-- lib/libc/softfloat/Makefile.inc | 4 ++-- lib/libc/stdlib/Makefile.inc | 4 ++-- lib/libc/string/Makefile.inc | 6 ++---- lib/libc/sys/Makefile.inc | 6 ++---- 9 files changed, 35 insertions(+), 32 deletions(-) (limited to 'lib') diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 8aed00f..a607160 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -5,6 +5,15 @@ SHLIBDIR?= /lib .include +# 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 ) 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 diff --git a/lib/libc/compat-43/Makefile.inc b/lib/libc/compat-43/Makefile.inc index e8ec364..867a9d9 100644 --- a/lib/libc/compat-43/Makefile.inc +++ b/lib/libc/compat-43/Makefile.inc @@ -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 diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 204541e..dd4bb5a 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -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 \ diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc index 8cf5beb..8fff0589 100644 --- a/lib/libc/locale/Makefile.inc +++ b/lib/libc/locale/Makefile.inc @@ -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 \ diff --git a/lib/libc/quad/Makefile.inc b/lib/libc/quad/Makefile.inc index 84723a7..016fa34 100644 --- a/lib/libc/quad/Makefile.inc +++ b/lib/libc/quad/Makefile.inc @@ -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 diff --git a/lib/libc/softfloat/Makefile.inc b/lib/libc/softfloat/Makefile.inc index c3df0ae..ac7fbf7 100644 --- a/lib/libc/softfloat/Makefile.inc +++ b/lib/libc/softfloat/Makefile.inc @@ -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 diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index d26f66a..3627294 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -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 \ diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc index 96759d5..3673a41 100644 --- a/lib/libc/string/Makefile.inc +++ b/lib/libc/string/Makefile.inc @@ -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 \ diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index dc56429..9876bde 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -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 -- cgit v1.1