This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, bz #58312] Fix libssp handling of vsnprintf for cross-compilers

On Tue, Sep 03, 2013 at 06:59:30PM -0700, Brooks Moses wrote:
> The attached patch fixes bug 58312, by replacing the runtime check of
> vsnprintf with a compile-time check -- which means that it now
> performs the same checks for both native and cross compilers, ensuring
> consistency instead of the previous behavior of just discarding some
> libssp functions when cross-compiling.
> I've tested this by reconfiguring (on an x86-linux cross
> configuration) and confirming that it behaves as expected -- the
> HAVE_USABLE_VSNPRINTF macro is defined in confdefs.h, and the
> config.log has verbosity of output similar to the previous version.
> (The formerly-explicit output is included as part of the AC_CHECK_FUNC
> macro.)
> It is possible that this will enable the macro on some native
> configurations where vsnprintf was present but is broken.  The effect
> is simply that a few additional functions (which rely on vsnprintf)
> are compiled into libssp; this seems relatively innocuous.
> Jakub, I'm cc'ing you in hopes that you're a reasonably appropriate
> person to review this.

That looks wrong, the test was intentionally looking for badly implemented
vsnprintf, see
"This function does not return a byte count as specified in C99 on some
platforms: HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw."

The implementation relies on the returned byte count to be exactly correct,
so it can't be implemented on platforms where that is not the case.

Not sure which of the targets from the above list we still support,
certainly at least mingw, though in that case I don't know if it hasn't been
fixed there.  So, as Joseph said, you probably should keep the runtime test
as is, and just for cross compiling replace the unconditional =undef with
an optimistic assumption followed by a blacklist of platforms where it is
known not to work.

> 2013-09-03  Brooks Moses  <>
>         * Replace runtime vsnprintf check with
>           compile-time check.
>         * configure: Regenerate.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]