Ping: [RFA 1/2]: Don't ignore target_header_dir when deciding inhibit_libc
Hans-Peter Nilsson
hans-peter.nilsson@axis.com
Fri Sep 12 17:50:00 GMT 2014
Ping! <http://gcc.gnu.org/ml/gcc-patches/2014-09/msg00402.html>
> From: Hans-Peter Nilsson <hp@axis.com>
> Date: Thu, 4 Sep 2014 23:40:40 +0200
> The directory at $target_header_dir is already inspected in
> gcc/configure, for e.g. glibc version and stack protector
> support, but not for setting inhibit_libc. This is just
> inconsistent and the obvious resolution to me is to inhibit
> inhibit_libc when a target *does* "have its own set of headers",
> to quote the comment above the inhibit_libc setting. There is
> nothing in the build log for "make all-gcc" that shows a
> difference with/without --with-headers, if headers are actually
> present anyway!
>
> It may seem that libgcc/configure.ac would be the appropriate
> place to patch and test, but it is gcc/configure.ac which tests
> various things about target headers and makes the inhibit_libc
> decision, exporting it through the generated obj/gcc/libgcc.mvars
> that is included in libgcc/Makefile.
>
> Tested before/after by "make all-gcc" on native x86_64-linux (*a) and
> seeing it still set (for the peace of most users) in
> gcc/Makefile, and cross to mipsel-linux "make all-gcc" with/without (*b,c) a
> pre-installed set of headers just implied by --prefix and --target to
> observe the intended difference and the same with (*d)
> --with-sysroot (but no headers at the sysroot) and (*e)
> --with-build-sysroot and both (*f) (note that
> --with-build-sysroot=... without --with-sysroot also got
> inhibit_libc) to observe no change for the --with-sysroot one
> (still no inhibit_libc). The same with --with-headers
> (*g). Also, I checked that nothing other than the inhibit_libc code
> uses target_header_dir or sets the used variables in the block
> of code involved in the move.
>
> Ok to commit?
>
> gcc:
> * configure.ac (target_header_dir): Move block defining
> this to before the block setting inhibit_libc.
> (inhibit_libc): When considering $with_headers, just
> check it it's explicitly "no". If not, also check if
> $target_header_dir/stdio.h is present. If not, set
> inhibit_libc=true.
> * configure: Regenerate.
>
> Index: gcc/configure.ac
> ===================================================================
> --- gcc/configure.ac (revision 214736)
> +++ gcc/configure.ac (working copy)
> @@ -1924,6 +1924,22 @@ elif test "x$TARGET_SYSTEM_ROOT" != x; t
> SYSTEM_HEADER_DIR=$build_system_header_dir
> fi
>
> +if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
> + if test "x$with_headers" != x; then
> + target_header_dir=$with_headers
> + elif test "x$with_sysroot" = x; then
> + target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
> + elif test "x$with_build_sysroot" != "x"; then
> + target_header_dir="${with_build_sysroot}${native_system_header_dir}"
> + elif test "x$with_sysroot" = xyes; then
> + target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
> + else
> + target_header_dir="${with_sysroot}${native_system_header_dir}"
> + fi
> +else
> + target_header_dir=${native_system_header_dir}
> +fi
> +
> # If this is a cross-compiler that does not
> # have its own set of headers then define
> # inhibit_libc
> @@ -1935,7 +1951,7 @@ fi
> : ${inhibit_libc=false}
> if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
> test x$with_newlib = xyes ; } &&
> - { test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
> + { test "x$with_headers" = xno || test ! -f "$target_header_dir/stdio.h"; } ; then
> inhibit_libc=true
> fi
> AC_SUBST(inhibit_libc)
> @@ -4441,22 +4457,6 @@ if test x$with_sysroot = x && test x$hos
> && test "$prefix" != "NONE"; then
> AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
> [Define to PREFIX/include if cpp should also search that directory.])
> -fi
> -
> -if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
> - if test "x$with_headers" != x; then
> - target_header_dir=$with_headers
> - elif test "x$with_sysroot" = x; then
> - target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
> - elif test "x$with_build_sysroot" != "x"; then
> - target_header_dir="${with_build_sysroot}${native_system_header_dir}"
> - elif test "x$with_sysroot" = xyes; then
> - target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
> - else
> - target_header_dir="${with_sysroot}${native_system_header_dir}"
> - fi
> -else
> - target_header_dir=${native_system_header_dir}
> fi
>
> # Determine the version of glibc, if any, used on the target.
>
> brgds, H-P
>
More information about the Gcc-patches
mailing list