← Back to team overview

touch-packages team mailing list archive

[Bug 1091823] Re: libgcc2.c includes limits.h without need

 

** Changed in: gcc-linaro
       Status: Confirmed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to gcc-4.8 in Ubuntu.
https://bugs.launchpad.net/bugs/1091823

Title:
  libgcc2.c includes limits.h without need

Status in Linaro GCC:
  Fix Released
Status in Linaro AArch64 cross-distro work:
  Fix Released
Status in “gcc-4.7” package in Ubuntu:
  Won't Fix
Status in “gcc-4.8” package in Ubuntu:
  Fix Released
Status in “gcc-4.7” package in Debian:
  Fix Released

Bug description:
  gcc stage1 build configured with --without headers fails during
  (static) libgcc build due to including limits.h, which is only present
  in build arch versions at this point. This only seems to actually crop
  up in the Debian/Ubuntu packaging, probably because of multiarch file
  layouts. (The build completes if any version of bits/predefs.h is
  found anywhere, such as /usr/include, which will normally be the case
  on a mahcine with libc6-dev installed -that it is for the wrong arch
  doesn't actually seem to matter in this case).

  The error is:
  /home/wookey/linaro/armv8/toolchain/raringnew/arm64-cross-toolchain-base-1.92/gcc/build/./gcc/xgcc -B/home/wookey/linaro/armv8/toolchain/raringnew/arm64-cross-toolchain-base-1.92/gcc/build/./gcc/ -B/usr/aarch64-linux-gnu/bin/ -B/usr/aarch64-linux-gnu/lib/ -isystem /usr/aarch64-linux-gnu/include -isystem /usr/aarch64-linux-gnu/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fPIC -I. -I. -I../.././gcc -I../../../src/libgcc -I../../../src/libgcc/. -I../../../src/libgcc/../gcc -I../../../src/libgcc/../include  -DHAVE_CC_TLS  -o _fixunsxfsi.o -MT _fixunsxfsi.o -MD -MP -MF _fixunsxfsi.dep -DL_fixunsxfsi -c ../../../src/libgcc/libgcc2.c 
  In file included from /usr/include/features.h:341:0,
                   from /usr/include/limits.h:26,
                   from /home/wookey/linaro/armv8/toolchain/raringnew/arm64-cross-toolchain-base-1.92/gcc/build/./gcc/include-fixed/limits.h:169,
                   from /home/wookey/linaro/armv8/toolchain/raringnew/arm64-cross-toolchain-base-1.92/gcc/build/./gcc/include-fixed/syslimits.h:7,
                   from /home/wookey/linaro/armv8/toolchain/raringnew/arm64-cross-toolchain-base-1.92/gcc/build/./gcc/include-fixed/limits.h:34,
                   from ../../../src/libgcc/libgcc2.c:1733:
  /usr/include/stdc-predef.h:30:26: fatal error: bits/predefs.h: No such file or directory

  Including headers when --without-headers is set should be wrong.
  Including wrong-arch headers is also wrong. Things could (and possibly
  should) probably be done to fix that, but in fact it's not actually
  necessary:

  The offending code is in libgcc2.c around 1733:
  #if defined(L_fixunsxfsi) && LIBGCC2_HAS_XF_MODE
  /* Reenable the normal types, in case limits.h needs them.  */
  #undef char
  #undef short
  #undef int
  #undef long
  #undef unsigned
  #undef float
  #undef double
  #undef MIN
  #undef MAX
  #include <limits.h>
    
  UWtype    
  __fixunsxfSI (XFtype a)
  {
    if (a >= - (DFtype) Wtype_MIN)
      return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
    return (Wtype) a;
  }
  #endif

  That inclusion of limits.h was there because the function __fixunsxfSI used to use LONG_MIN from that headers file, but this was changed a while back  (http://repo.or.cz/w/official-gcc.git/blobdiff/49f0f270673c4512c11f72a038b84c321ae5534a..7429c938827aa98bf3b02c4ac89510f4d28ef0b1:/gcc/libgcc2.c)
  to use Wtype_MIN instead, which is defined in the local libgcc2.h header.

  so in fact the limits.h inclusion is no longer needed.

  The attached patch fixes this for gcc 4.7.2

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc-linaro/+bug/1091823/+subscriptions