public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFA 1/2]: Don't ignore target_header_dir when deciding inhibit_libc
@ 2014-09-04 21:40 Hans-Peter Nilsson
  2014-09-12 17:50 ` Ping: " Hans-Peter Nilsson
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Hans-Peter Nilsson @ 2014-09-04 21:40 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2016-10-17 16:05 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04 21:40 [RFA 1/2]: Don't ignore target_header_dir when deciding inhibit_libc Hans-Peter Nilsson
2014-09-12 17:50 ` Ping: " Hans-Peter Nilsson
2014-09-19  6:25   ` Jeff Law
2014-09-23 21:21 ` Thomas Schwinge
2014-09-23 22:30   ` Hans-Peter Nilsson
2015-10-06 14:04 ` Ulrich Weigand
2015-10-06 14:44   ` Hans-Peter Nilsson
2015-10-06 15:25     ` Ulrich Weigand
2015-10-06 16:31       ` Hans-Peter Nilsson
2015-10-06 16:56         ` Ulrich Weigand
2015-10-06 17:28           ` Hans-Peter Nilsson
2015-10-07 15:32             ` Ulrich Weigand
2015-10-07 17:18               ` Hans-Peter Nilsson
2015-10-08 16:52                 ` Ulrich Weigand
2015-10-09  2:34                   ` Hans-Peter Nilsson
2015-10-12  9:58                     ` Ulrich Weigand
2015-10-12 10:58                       ` Hans-Peter Nilsson
2015-10-23 11:54                       ` Bernd Schmidt
2016-03-17 16:35                         ` Andre Vieira (lists)
2016-03-30 16:14                           ` [arm-embedded]: " Andre Vieira (lists)
2016-04-07  9:31                           ` [RFA 1/2]: " Andre Vieira (lists)
2016-05-25 19:37                             ` Andre Vieira (lists)
2016-05-27 16:31                               ` Ulrich Weigand
2016-09-09 15:04                                 ` [GCC-6][RFA " Andre Vieira (lists)
2016-10-17 16:05                                   ` Andre Vieira (lists)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).