[Bug libc/25050] New: MB_LEN_MAX incorrect when compiling with _FORTIFY_SOURCE for PowerPC

bradley.gamble at ncipher dot com sourceware-bugzilla@sourceware.org
Mon Sep 30 17:22:00 GMT 2019


https://sourceware.org/bugzilla/show_bug.cgi?id=25050

            Bug ID: 25050
           Summary: MB_LEN_MAX incorrect when compiling with
                    _FORTIFY_SOURCE for PowerPC
           Product: glibc
           Version: 2.29
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: bradley.gamble at ncipher dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

(Apologies if this is a GCC bug, although I believe this is a glibc bug)

Trying to build a simple test program for PowerPC with the build flag
-D_FORTIFY_SOURCE=2 reports that the value of MB_LEN_MAX is incorrect.

I have built glibc 2.29 targetting PowerPC with the following configure flags:

mkdir -p build-glibc
cd build-glibc
../glibc-2.29/configure \
   --prefix=output/powerpc-linux-gnu \
  --build=x86_64-linux-gnu \
  --host=powerpc-linux-gnu \
  --target=powerpc-linux-gnu \
  --with-headers=output/powerpc-linux-gnu/include \
  libc_cv_forced_unwind=yes

Using this with GCC (Tested from 4.9.2 to 8.3.0) works and can compile a valid
binary application. The sample application I use is:

#include <limits.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
  return 0;
}

The command line I use to compile this is:

/opt/cross/gcc/bin/powerpc-linux-gnu-gcc -D_FORTIFY_SOURCE=2 -O2 hello.c

The error I receive is:

In file included from /opt/cross/gcc/powerpc-linux-gnu/include/stdlib.h:958:0,
                 from hello.c:2:
/opt/cross/gcc/powerpc-linux-gnu/include/bits/stdlib.h: In function 'wctomb':
/opt/cross/gcc/powerpc-linux-gnu/include/bits/stdlib.h:90:3: error: #error
"Assumed value of MB_LEN_MAX wrong"
 # error "Assumed value of MB_LEN_MAX wrong"
   ^

If I disable the -DFORTIFY_SOURCE=2 command line option the application will
compile successfully, equally if I move limits.h to be below stdlib.h, the
application will compile successfully.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list