From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23974 invoked by alias); 26 Oct 2012 21:06:17 -0000 Received: (qmail 23958 invoked by uid 22791); 26 Oct 2012 21:06:17 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD,SARE_BAYES_5x8,SARE_BAYES_6x8 X-Spam-Check-By: sourceware.org Received: from dns1.mips.com (HELO dns1.mips.com) (12.201.5.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Oct 2012 21:06:11 +0000 Received: from mailgate1.mips.com (mailgate1.mips.com [12.201.5.111]) by dns1.mips.com (8.13.8/8.13.8) with ESMTP id q9QL60Fo011924; Fri, 26 Oct 2012 14:06:01 -0700 X-M-MSG: Received: from exchdb01.mips.com (unknown [192.168.36.84]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mailgate1.mips.com (Postfix) with ESMTP id 2135B36465E; Fri, 26 Oct 2012 14:05:59 -0700 (PDT) Received: from [192.168.65.53] (192.168.65.53) by exchhub01.mips.com (192.168.36.84) with Microsoft SMTP Server id 14.1.270.1; Fri, 26 Oct 2012 14:05:54 -0700 Subject: Re: [patch, mips] Fix stubs files for hard float vs. soft float From: Steve Ellcey To: "Joseph S. Myers" CC: Roland McGrath , Andreas Schwab , In-Reply-To: References: <1350342376.2044.41.camel@ubuntu-sellcey> <1350948702.15035.5.camel@ubuntu-sellcey> <1351023590.15035.14.camel@ubuntu-sellcey> <20121023213216.B0F222C0A2@topped-with-meat.com> <1351030448.15035.25.camel@ubuntu-sellcey> <20121023224821.DA5B52C09F@topped-with-meat.com> <1351095503.15035.45.camel@ubuntu-sellcey> <1351098761.15035.52.camel@ubuntu-sellcey> <20121024172501.AA6E52C0A5@topped-with-meat.com> <1351123186.15035.57.camel@ubuntu-sellcey> Content-Type: text/plain; charset="UTF-8" Date: Fri, 26 Oct 2012 21:06:00 -0000 Message-ID: <1351285554.15035.94.camel@ubuntu-sellcey> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-EMS-Proccessed: 6LP3oGfGVdcdb8o1aBnt6w== X-EMS-STAMP: jb1Zv1zQ+sB0kx+0dca/ag== Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-10/txt/msg00099.txt.bz2 On Thu, 2012-10-25 at 12:41 +0000, Joseph S. Myers wrote: > On Wed, 24 Oct 2012, Steve Ellcey wrote: > > > +# Get value of abi-default > > +#include $(common-objpfx)default-abi.make > > Is this really tested for all ABI variants? Having this commented out > hardly makes sense.... > > > +#ifeq (,$(filter $(default-abi),$(abi-variants))) > > +#Unknown ABI, must be one of $(abi-variants) > > +#endif > > Don't add new commented-out code. OK, Here is my latest patch. I uncommented these lines (which in turn uncovered a bug in my change where I set libc_mips_abi to '64' instead of 'n64'. After fixing that I did some glibc native testing and some GCC cross testing and everything looked good. I didn't test every combination of options, that would take forever, but I did look at the abi-default settings and examined the stub files for various versions of glibc builds (the 3 different ABIs, hard/soft float) to make sure they all looked OK. Steve Ellcey sellcey@mips.com 2012-10-26 Steve Ellcey * sysdeps/unix/sysv/linux/mips/mips32/Makefile: Remove. * sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile: Remove. * sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile: Remove. * sysdeps/unix/sysv/linux/mips/configure.in: Create default_abi.make. * sysdeps/unix/sysv/linux/mips/configure: Regenerate. * sysdeps/unix/sysv/linux/mips/Makefile: Include default_abi.make. (abi-variants): Add hard and soft float versions. (abi-o32-options): Remove. (abi-o32-condition): Remove. (abi-n32-options): Remove. (abi-n32-condition): Remove. (abi-n64-options): Remove. (abi-n64-condition): Remove. (abi-o32_soft-options): New. (abi-o32_soft-condition): New. (abi-o32_hard-options): New. (abi-o32_hard-condition): New. (abi-n32_soft-options): New. (abi-n32_soft-condition): New. (abi-n32_hard-options): New. (abi-n32_hard-condition): New. (abi-n64_soft-options): New. (abi-n64_soft-condition): New. (abi-n64_hard-options): New. (abi-n64_hard-condition): New. diff --git a/ports/sysdeps/unix/sysv/linux/mips/Makefile b/ports/sysdeps/unix/sysv/linux/mips/Makefile index 99c554f..c188cae 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/Makefile +++ b/ports/sysdeps/unix/sysv/linux/mips/Makefile @@ -8,15 +8,36 @@ sysdep_routines += cachectl cacheflush sysmips _test_and_set sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h endif -# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3 -abi-variants := o32 n32 n64 +# Get value of abi-default +include $(common-objpfx)default-abi.make + +abi-variants := o32_soft o32_hard n32_soft n32_hard n64_soft n64_hard + +ifeq (,$(filter $(default-abi),$(abi-variants))) +Unknown ABI, must be one of $(abi-variants) +endif + abi-includes := sgidefs.h -abi-o32-options := -D_MIPS_SIM=1 -abi-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32 -abi-n32-options := -D_MIPS_SIM=2 -abi-n32-condition := _MIPS_SIM == _MIPS_SIM_NABI32 -abi-n64-options := -D_MIPS_SIM=3 -abi-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64 + +# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3 +abi-o32_soft-options := -D_MIPS_SIM=1 -D__mips_soft_float +abi-o32_soft-condition := defined(__mips_soft_float) \ + && (_MIPS_SIM == _MIPS_SIM_ABI32) +abi-o32_hard-options := -D_MIPS_SIM=1 -D__mips_hard_float +abi-o32_hard-condition := defined(__mips_hard_float) \ + && (_MIPS_SIM == _MIPS_SIM_ABI32) +abi-n32_soft-options := -D_MIPS_SIM=2 -D__mips_soft_float +abi-n32_soft-condition := defined(__mips_soft_float) \ + && (_MIPS_SIM == _MIPS_SIM_NABI32) +abi-n32_hard-options := -D_MIPS_SIM=2 -D__mips_hard_float +abi-n32_hard-condition := defined(__mips_hard_float) \ + && (_MIPS_SIM == _MIPS_SIM_NABI32) +abi-n64_soft-options := -D_MIPS_SIM=3 -D__mips_soft_float +abi-n64_soft-condition := defined(__mips_soft_float) \ + && (_MIPS_SIM == _MIPS_SIM_ABI64) +abi-n64_hard-options := -D_MIPS_SIM=3 -D__mips_hard_float +abi-n64_hard-condition := defined(__mips_hard_float) \ + && (_MIPS_SIM == _MIPS_SIM_ABI64) ifeq ($(subdir),elf) ifeq ($(build-shared),yes) diff --git a/ports/sysdeps/unix/sysv/linux/mips/configure b/ports/sysdeps/unix/sysv/linux/mips/configure index 051432d..36757e8 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/configure +++ b/ports/sysdeps/unix/sysv/linux/mips/configure @@ -1,6 +1,112 @@ # This file is generated from configure.in by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/unix/sysv/linux/mips. + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if (_MIPS_SIM != _ABIO32) + #error Not O32 ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_abi=o32 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if (_MIPS_SIM != _ABIN32) + #error Not N32 ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_abi=n32 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if (_MIPS_SIM != _ABI64) + #error Not 64 ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_abi=n64 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test -z "$libc_mips_abi"; then + as_fn_error "could not determine what ABI the compiler is using" "$LINENO" 5 +fi + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if !defined(__mips_soft_float) + #error Not soft ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_float=soft +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if !defined(__mips_hard_float) + #error Not hard ABI + #endif +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_mips_float=hard +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test -z "$libc_mips_float"; then + as_fn_error "could not determine if compiler is using hard or soft floating point ABI" "$LINENO" 5 +fi + +echo "default-abi := ${libc_mips_abi}_${libc_mips_float}" > default-abi.make + case "$prefix" in /usr | /usr/) # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. diff --git a/ports/sysdeps/unix/sysv/linux/mips/configure.in b/ports/sysdeps/unix/sysv/linux/mips/configure.in index 18e8bbc..167779e 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/configure.in +++ b/ports/sysdeps/unix/sysv/linux/mips/configure.in @@ -2,6 +2,50 @@ sinclude(./aclocal.m4)dnl Autoconf lossage GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/unix/sysv/linux/mips. +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if (_MIPS_SIM != _ABIO32) + #error Not O32 ABI + #endif])], + [libc_mips_abi=o32], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if (_MIPS_SIM != _ABIN32) + #error Not N32 ABI + #endif])], + [libc_mips_abi=n32], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if (_MIPS_SIM != _ABI64) + #error Not 64 ABI + #endif])], + [libc_mips_abi=n64], + [])])]) + +if test -z "$libc_mips_abi"; then + AC_MSG_ERROR([could not determine what ABI the compiler is using]) +fi + +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if !defined(__mips_soft_float) + #error Not soft ABI + #endif])], + [libc_mips_float=soft], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #if !defined(__mips_hard_float) + #error Not hard ABI + #endif])], + [libc_mips_float=hard], + [])]) + +if test -z "$libc_mips_float"; then + AC_MSG_ERROR([could not determine if compiler is using hard or soft floating point ABI]) +fi + +echo "default-abi := ${libc_mips_abi}_${libc_mips_float}" > default-abi.make + case "$prefix" in /usr | /usr/) # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.