On Thu, Apr 27, 2017 at 03:50:19PM +0300, Janne Blomqvist wrote:
> Glibc 2.17 made __secure_getenv an officially supported function, and
> renamed it secure_getenv. The libgfortran configure has checked for
> both of these, per
> https://sourceware.org/glibc/wiki/Tips_and_Tricks/secure_getenv.
> 
> Unfortunately, while the dynamical library (libc.so) retains the
> __secure_getenv symbol for backwards compatibility, the static library
> (libc.a) does not. This means that a libgfortran.a compiled against an
> older glibc will not work if one tries to link against a newer
> libc.a. This creates problems for providing gfortran binary
> distributions that work on as many target systems as possible.

I don't think it is a good idea, if __secure_getenv is available, better use
it, because it can do stuff that the fallback one can't (figuring out
priviledge elevatation through AT_* values in aux vector).

So, if anything, I'd suggest if !HAVE_SECURE_GETENV and HAVE___SECURE_GETENV
to use weakref for __secure_getenv and call it if non-NULL, otherwise
use the fallback implementation.

> Thus, drop the support for __secure_getenv. This implies that when
> libgfortran is compiled against an older glibc it instead uses the
> fallback secure_getenv in libgfortran/runtime/environ.c instead of
> glibc __secure_getenv.
> 
> Regtested on x86_64-pc-linux-gnu, Ok for trunk, 7.x when it reopens,
> 6, 5?
> 
> 2017-04-27  Janne Blomqvist  <j...@gcc.gnu.org>
> 
>       * configure.ac: Don't check for presence of __secure_getenv.
>       * libgfortran.h: HAVE_SECURE_GETENV: Don't check
>       HAVE___SECURE_GETENV.
>       * Makefile.in: Regenerated.
>       * config.h.in: Regenerated.
>       * configure: Regenerated.

        Jakub

Reply via email to