http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58312

            Bug ID: 58312
           Summary: libssp configure check for "usable vsnprintf" is
                    broken on cross-compilers.
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brooks at gcc dot gnu.org

The libssp configure script contains a check for "whether vsnprintf is usable",
starting around line 128.

This check is based on an AC_RUN_IFELSE call, which compiles and runs a program
that uses a vsnprintf call.  The problem is in the fallback argument for the
cross-compiling case, which is simply "ssp_have_usable_vsnprintf=undef" --
which is to say, assume it does not work.  The result is that about a third of
the libssp files -- sprintf-chk.c, snprintf-chk.c, vsprintf-chk.c, and
vsnprintf-chk.c -- are then effectively #ifdef'ed out of existence.

This is a significant problem; we have programs compiled with a native compiler
that are having runtime link errors with the runtime libraries from a cross
compiler for the same target, because functions such as __sprintf_chk are not
defined in the cross-compiled libssp.so.

It's not at all clear to me why this check needs to be a runtime check at all;
is it not simply sufficient to check for the existence of a vsnprintf function?
 There are no comments in the code to indicate why this is insufficient, and
the runtime check was present in the initial version of the code without
comments:
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00066.html

Reply via email to