This is the mail archive of the
mailing list for the GCC project.
Re: [patch, bz #58312] Fix libssp handling of vsnprintf for cross-compilers
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Brooks Moses <bmoses at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 4 Sep 2013 09:01:04 +0200
- Subject: Re: [patch, bz #58312] Fix libssp handling of vsnprintf for cross-compilers
- Authentication-results: sourceware.org; auth=none
- References: <CAOxa4KpSEkLdXX_FMzhXYv-Nmv-CQEaMMW4AF7f2LDnS+samCA at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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
> 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
"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 <firstname.lastname@example.org>
> * configure.ac: Replace runtime vsnprintf check with
> compile-time check.
> * configure: Regenerate.