public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir
@ 2016-01-10 19:28 Bernd Edlinger
  2016-01-10 23:10 ` Peter Bergner
  0 siblings, 1 reply; 6+ messages in thread
From: Bernd Edlinger @ 2016-01-10 19:28 UTC (permalink / raw)
  To: Peter Bergner; +Cc: gcc-patches, David Edelsohn, Michael Meissner

Hi Peter,

> @@ -4167,6 +4167,7 @@
> 			-d "/opt/$with_advance_toolchain/bin/." -a \
> 			-d "/opt/$with_advance_toolchain/include/."; then
> 
>+			target_header_dir=`find /opt/$with_advance_toolchain/ -path '*/include/features.h' | sed -e 's#/features.h##'`
> 			tm_file="$tm_file ./advance-toolchain.h"
> 			(at="/opt/$with_advance_toolchain"
> 			 echo "/* Use Advance Toolchain $at */"

why can't you just set native_system_header_dir instead?


Bernd.

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

* Re: [PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir
  2016-01-10 19:28 [PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir Bernd Edlinger
@ 2016-01-10 23:10 ` Peter Bergner
  2016-01-11 19:20   ` Michael Meissner
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Bergner @ 2016-01-10 23:10 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, David Edelsohn, Michael Meissner

On Sun, 2016-01-10 at 19:28 +0000, Bernd Edlinger wrote:
> Hi Peter,
> 
> > @@ -4167,6 +4167,7 @@
> > 			-d "/opt/$with_advance_toolchain/bin/." -a \
> > 			-d "/opt/$with_advance_toolchain/include/.";
> > then
> > 
> > +			target_header_dir=`find
> > /opt/$with_advance_toolchain/ -path '*/include/features.h' | sed -e
> > 's#/features.h##'`
> > 			tm_file="$tm_file ./advance-toolchain.h"
> > 			(at="/opt/$with_advance_toolchain"
> > 			 echo "/* Use Advance Toolchain $at */"
> 
> why can't you just set native_system_header_dir instead?
> 

That won't work on our cross builds using --with-advance-toolchain=...
options, correct?  And don't we really need the native_system_header_dir
to really point at the native system headers for tests against gmp.h etc.?

Peter

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

* Re: [PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir
  2016-01-10 23:10 ` Peter Bergner
@ 2016-01-11 19:20   ` Michael Meissner
  2016-01-11 21:36     ` Bernd Edlinger
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Meissner @ 2016-01-11 19:20 UTC (permalink / raw)
  To: Peter Bergner
  Cc: Bernd Edlinger, gcc-patches, David Edelsohn, Michael Meissner

On Sun, Jan 10, 2016 at 05:10:29PM -0600, Peter Bergner wrote:
> On Sun, 2016-01-10 at 19:28 +0000, Bernd Edlinger wrote:
> > Hi Peter,
> > 
> > > @@ -4167,6 +4167,7 @@
> > > 			-d "/opt/$with_advance_toolchain/bin/." -a \
> > > 			-d "/opt/$with_advance_toolchain/include/.";
> > > then
> > > 
> > > +			target_header_dir=`find
> > > /opt/$with_advance_toolchain/ -path '*/include/features.h' | sed -e
> > > 's#/features.h##'`
> > > 			tm_file="$tm_file ./advance-toolchain.h"
> > > 			(at="/opt/$with_advance_toolchain"
> > > 			 echo "/* Use Advance Toolchain $at */"
> > 
> > why can't you just set native_system_header_dir instead?
> > 
> 
> That won't work on our cross builds using --with-advance-toolchain=...
> options, correct?  And don't we really need the native_system_header_dir
> to really point at the native system headers for tests against gmp.h etc.?

The problem is on native systems, you want to search the AT include files and
libraries, and then if it doesn't find them in the AT directory, fall back to
the system directory.  This is because AT only has a selected set of libraries
that it provides.  For cross, you want to go with using the normal
--with-sysroot approach.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797

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

* Re: [PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir
  2016-01-11 19:20   ` Michael Meissner
@ 2016-01-11 21:36     ` Bernd Edlinger
  2016-01-20  0:46       ` Peter Bergner
  0 siblings, 1 reply; 6+ messages in thread
From: Bernd Edlinger @ 2016-01-11 21:36 UTC (permalink / raw)
  To: Michael Meissner, Peter Bergner, gcc-patches, David Edelsohn

Hi,

On 11.01.2016 20:20, Michael Meissner wrote:
> On Sun, Jan 10, 2016 at 05:10:29PM -0600, Peter Bergner wrote:
>> On Sun, 2016-01-10 at 19:28 +0000, Bernd Edlinger wrote:
>>> Hi Peter,
>>>
>>>> @@ -4167,6 +4167,7 @@
>>>> 			-d "/opt/$with_advance_toolchain/bin/." -a \
>>>> 			-d "/opt/$with_advance_toolchain/include/.";
>>>> then
>>>>
>>>> +			target_header_dir=`find
>>>> /opt/$with_advance_toolchain/ -path '*/include/features.h' | sed -e
>>>> 's#/features.h##'`
>>>> 			tm_file="$tm_file ./advance-toolchain.h"
>>>> 			(at="/opt/$with_advance_toolchain"
>>>> 			 echo "/* Use Advance Toolchain $at */"
>>>
>>> why can't you just set native_system_header_dir instead?
>>>
>>
>> That won't work on our cross builds using --with-advance-toolchain=...
>> options, correct?  And don't we really need the native_system_header_dir
>> to really point at the native system headers for tests against gmp.h etc.?
>
> The problem is on native systems, you want to search the AT include files and
> libraries, and then if it doesn't find them in the AT directory, fall back to
> the system directory.  This is because AT only has a selected set of libraries
> that it provides.  For cross, you want to go with using the normal
> --with-sysroot approach.
>

Hmm, the patch looks just too odd...

Could if work also if you set native_system_header_dir to
/opt/$with_advance_toolchain/include or somthing and instead of
-isystem $at/include in INCLUDE_EXTRA_SPEC you could add something like
%{!nostdinc:-idirafter $original_native_system_header_dir } ?




Bernd.

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

* Re: [PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir
  2016-01-11 21:36     ` Bernd Edlinger
@ 2016-01-20  0:46       ` Peter Bergner
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Bergner @ 2016-01-20  0:46 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: Michael Meissner, gcc-patches, David Edelsohn

On Mon, 2016-01-11 at 21:35 +0000, Bernd Edlinger wrote:
> Could if work also if you set native_system_header_dir to
> /opt/$with_advance_toolchain/include or somthing and instead of
> -isystem $at/include in INCLUDE_EXTRA_SPEC you could add something like
> %{!nostdinc:-idirafter $original_native_system_header_dir } ?

The following patch does seem to work on my native build.
I'll have to check on a cross build, but I wonder, does the
second hunk setting INCLUDE_EXTRA_SPEC make sense on a cross
build, since the original native_system_header_dir is equal
to /usr/include?

I will say I do like that second hunk for the native build, since the
native Advance Toolchain does not contain everything you'd find in a
normal /usr/include, so falling back on /usr/include if the Advance
Toolchain doesn't supply it seems wise.  I guess we really should
be conditionally setting that hunk.

Peter


Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 232595)
+++ gcc/config.gcc	(working copy)
@@ -4167,6 +4167,8 @@
 			-d "/opt/$with_advance_toolchain/bin/." -a \
 			-d "/opt/$with_advance_toolchain/include/."; then
 
+			orig_native_system_header_dir=$native_system_header_dir
+			native_system_header_dir=`find /opt/$with_advance_toolchain/ -path '*/include/features.h' | sed -e 's#/features.h##'`
 			tm_file="$tm_file ./advance-toolchain.h"
 			(at="/opt/$with_advance_toolchain"
 			 echo "/* Use Advance Toolchain $at */"
@@ -4178,7 +4180,7 @@
 			 echo "#if USE_AT_INCLUDE_FILES"
 			 echo "#undef  INCLUDE_EXTRA_SPEC"
 			 echo "#define INCLUDE_EXTRA_SPEC" \
-			      "\"-isystem $at/include\""
+			      "\"%{!nostdinc:-idirafter $orig_native_system_header_dir}\""
 			 echo "#endif"
 			 echo
 			 echo "#undef  LINK_OS_EXTRA_SPEC32"

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

* [PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir
@ 2016-01-10 17:44 Peter Bergner
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Bergner @ 2016-01-10 17:44 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Edelsohn, Michael Meissner

While testing a configure fragment change for an upcoming patch, I noticed
that --with-advance-toolchain=... wasn't correctly setting $target_header_dir
to point to the Advance Toolchain's headers and instead was pointing at
the system headers.  This patch arranges for configure.ac to allow
config.gcc to set $target_header_dir which fixes the problem.

This patch passes bootstrap and regtesting on powerpc64le-linux.
Ok for mainline?

Peter


	PR target/69153
	* config.gcc: Set target_header_dir for --with-advance-toolchain=<xxx>.
	* configure.ac: Only initialize target_header_dir is it isn't already
	initialized from config.gcc.
	* configure: Regenerate.

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 232115)
+++ gcc/config.gcc	(working copy)
@@ -4167,6 +4167,7 @@
 			-d "/opt/$with_advance_toolchain/bin/." -a \
 			-d "/opt/$with_advance_toolchain/include/."; then
 
+			target_header_dir=`find /opt/$with_advance_toolchain/ -path '*/include/features.h' | sed -e 's#/features.h##'`
 			tm_file="$tm_file ./advance-toolchain.h"
 			(at="/opt/$with_advance_toolchain"
 			 echo "/* Use Advance Toolchain $at */"
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 232115)
+++ gcc/configure.ac	(working copy)
@@ -1401,6 +1401,7 @@
 . ${srcdir}/config.host
 
 target_gtfiles=
+target_header_dir=
 
 # Collect target-machine-specific information.
 . ${srcdir}/config.gcc
@@ -1997,20 +1998,22 @@
         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}"
+if test "x$target_header_dir" == x; then
+  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="${with_sysroot}${native_system_header_dir}"
+    target_header_dir=${native_system_header_dir}
   fi
-else
-  target_header_dir=${native_system_header_dir}
 fi
 
 # If this is a cross-compiler that does not
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 232115)
+++ gcc/configure	(working copy)
@@ -11458,6 +11458,7 @@
 . ${srcdir}/config.host
 
 target_gtfiles=
+target_header_dir=
 
 # Collect target-machine-specific information.
 . ${srcdir}/config.gcc
@@ -12215,20 +12216,22 @@
         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}"
+if test "x$target_header_dir" == x; then
+  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="${with_sysroot}${native_system_header_dir}"
+    target_header_dir=${native_system_header_dir}
   fi
-else
-  target_header_dir=${native_system_header_dir}
 fi
 
 # If this is a cross-compiler that does not
@@ -18406,7 +18409,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18409 "configure"
+#line 18412 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18512,7 +18515,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18515 "configure"
+#line 18518 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H

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

end of thread, other threads:[~2016-01-20  0:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-10 19:28 [PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir Bernd Edlinger
2016-01-10 23:10 ` Peter Bergner
2016-01-11 19:20   ` Michael Meissner
2016-01-11 21:36     ` Bernd Edlinger
2016-01-20  0:46       ` Peter Bergner
  -- strict thread matches above, loose matches on Subject: below --
2016-01-10 17:44 Peter Bergner

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).