[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] Fix ARM bits/predefs.h



One local change in EGLIBC is the bits/predefs.h mechanism for targets to 
declare that they do not fully support IEEE arithmetic with exceptions and 
rounding modes etc.; this was rejected by Ulrich for GLIBC.

arm/eabi/bits/predefs.h and arm/eabi/fpu/bits/predefs.h differ; the latter 
is the only file under arm/eabi/fpu/.  Having installed headers differ 
based on configuration is a bad idea, since a single set of headers should 
be usable for multiple installed multilibs.

Which header is used - arm/eabi/fpu/bits/predefs.h declaring IEEE support 
to be present or arm/eabi/bits/predefs.h not doing so - depends on whether 
EGLIBC has been configured with --with-fp (default) or --without-fp.  But 
whether IEEE support is in fact present has nothing to do with that - it 
depends on whether both libc and the program being compiled were compiled 
with -mfloat-abi=softfp; if either wasn't, they will have calls to 
soft-float libgcc functions without exception or rounding mode support.

So it's better to have a single header, and the definitions in it should 
be conditional on defined (__VFP_FP__) && !defined(__SOFTFP__).  This is 
correct except in the case of building a VFP object being linked with 
non-VFP libc, when it's incorrect regarding the libc, but I think it's as 
accurate as can be achieved at compile time.  I've applied this patch to 
EGLIBC trunk, EGLIBC 2.5 and EGLIBC 2.3.

Index: ChangeLog.eglibc
===================================================================
--- ChangeLog.eglibc	(revision 616)
+++ ChangeLog.eglibc	(working copy)
@@ -1,3 +1,10 @@
+2006-11-08  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/arm/eabi/bits/predefs.h (__STDC_IEC_559__,
+	__STDC_IEC_559_COMPLEX__): Define if defined (__VFP_FP__) &&
+	!defined(__SOFTFP__).
+	* sysdeps/arm/eabi/fpu: Remove.
+
 2006-10-26  Joseph S. Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h
Index: sysdeps/arm/eabi/fpu/bits/predefs.h
===================================================================
--- sysdeps/arm/eabi/fpu/bits/predefs.h	(revision 616)
+++ sysdeps/arm/eabi/fpu/bits/predefs.h	(working copy)
@@ -1,30 +0,0 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with GCC; see the file COPYING.  If not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.  */
-
-#ifndef _FEATURES_H
-# error "Never use <bits/predefs.h> directly; include <features.h> instead."
-#endif
-
-#ifndef _PREDEFS_H
-#define _PREDEFS_H
-
-/* We do support the IEC 559 math functionality, real and complex.  */
-#define __STDC_IEC_559__		1
-#define __STDC_IEC_559_COMPLEX__	1
-
-#endif /* predefs.h */
Index: sysdeps/arm/eabi/bits/predefs.h
===================================================================
--- sysdeps/arm/eabi/bits/predefs.h	(revision 616)
+++ sysdeps/arm/eabi/bits/predefs.h	(working copy)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +27,7 @@
    if a VFP coprocessor is present. If we don't have one, we fall back to
    software emulation and the functions won't work properly. So in general,
    we don't claim to support this functionality.  */
-#if 0
+#if defined (__VFP_FP__) && !defined(__SOFTFP__)
 #define __STDC_IEC_559__		1
 #define __STDC_IEC_559_COMPLEX__	1
 #endif

-- 
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx