]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
soft-fp: Adjust call to abort for kernel use.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 20 Feb 2015 18:07:03 +0000 (18:07 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 20 Feb 2015 18:07:03 +0000 (18:07 +0000)
soft-fp calls abort in various cases that the code doesn't handle, all
cases that should never actually occur for any supported choice of
types.

Calling an abort function is not appropriate for kernel use, so the
Linux kernel redefines abort as a macro in various ways in the ports
using this code, typically to "return 0" or similar.

One use of abort in soft-fp is inside a comma expression and doesn't
work with such a macro.  This patch changes it to use a statement
expression.

Tested for powerpc-nofpu that installed shared libraries are unchanged
by this patch.

(There are two classes of aborts: those to make control flow visible
to the compiler, in default cases of switches over _FP_CLS_COMBINE,
which could reasonably change to __builtin_unreachable for glibc but
would still need to handle pre-4.5 compilers for kernel use, and those
intended to detect any use of soft-fp for combinations of types the
code doesn't know how to handle, which could reasonably become link
failures if the calls should always be optimized away.  But those are
separate possible future enhancements.)

* soft-fp/op-common.h (_FP_FROM_INT): Wrap call to abort in
expression inside statement expression.

ChangeLog
soft-fp/op-common.h

index 60d99fe3a4e67ffaece01582b5e013efd124c6a4..2b518f29708a6ea7de891b7205a8bc0924165ad3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-20  Joseph Myers  <joseph@codesourcery.com>
+
+       * soft-fp/op-common.h (_FP_FROM_INT): Wrap call to abort in
+       expression inside statement expression.
+
 2015-02-20  Stefan Liebler  <stli@linux.vnet.ibm.com>
 
        * sysdeps/unix/sysv/linux/s390/lowlevellock.h: Include
index 342532a4cc4161724def629eb7d46e1567cd276d..14fd6cdc9643bb429a749c8e4778bb871e000721 100644 (file)
                         X##_e = (_FP_EXPBIAS_##fs + 2 * _FP_W_TYPE_SIZE - 1 \
                                  - _FP_FROM_INT_lz);                   \
                       })                                               \
-                    : (abort (), 0)));                                 \
+                    : ({ abort (); 0; })));                            \
                                                                        \
          if ((rsize) - 1 + _FP_EXPBIAS_##fs >= _FP_EXPMAX_##fs         \
              && X##_e >= _FP_EXPMAX_##fs)                              \