public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH], Add support for --with-advance-toolchain=<xx> to PowerPC
@ 2015-06-03  0:06 Michael Meissner
  2015-06-03  0:10 ` Joseph Myers
  2015-06-03 15:51 ` David Edelsohn
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Meissner @ 2015-06-03  0:06 UTC (permalink / raw)
  To: gcc-patches, dje.gcc

[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]

This is a convenience patch that would help those of us who work on the main
GCC releases as well as backporting changes to the IBM Advance Toolchain.  It
adds a new configuration switch, --with-advance-toolchain=<xxx> that configures
the compiler to use the include files, libraries, and dynamic loader that are
released with the IBM Advance Toolchain releases instead of the distribution
headers and libraries.

On the older systems, the distribution glibc (based on glibc 2.11) accounts for
some errors in the testsuite that are fixed in newer glibc's that the Advance
Toolchain provides (Advance Toolchain 7.0 provides 2.18, while Advance
Toolchain 8.0 provides 2.20), and it is useful not to encounter these when
running make check.

I've tested these patches on a power7 SuSE Sles 11.3 big endian system, and on
a power8 Ubuntu little endian system.  On the older system, I can't build a
bootstrap compiler, due to C++ library issues.  On the Ubunto system, I get no
regressions.  Given this switch is a debug convenience option that users are
not expected to use, I don't see the no bootstrap issue as being a problem.

In addition to the trunk, I would like to backport the patch to the active
branches (4.9 and 5).  Is this patch acceptable to commit to the trunk and to
the branches?

2015-06-02  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config.gcc (powerpc*-*-*): Add support for a new configure
	option --with-advance-toolchain=<xxx> which overrides using the
	default header files, libraries and dynamic linker.

	* config/rs6000/linux64.h (SUBSUBTARGET_EXTRA_SPECS): Add new
	specs to support the configure --with-advance-toolchain=<xxx>
	option.
	(INCLUDE_EXTRA_SPEC): Likewise.
	(LINK_OS_EXTRA_SPEC32): Likewise.
	(LINK_OK_EXTRA_SPEC64): Likewise.
	(LINK_OS_NEW_DTAGS_SPEC): Likewise.
	(DYNAMIC_LINKER_PREFIX): Likewise.
	(CPP_OS_DEFAULT_SPEC): Use the new specs for providing advance
	toolchain support.
	(GLIBC_DYNAMIC_LINKER32): Likewise.
	(GLIBC_DYNAMIC_LINKER64): Likewise.
	(LINK_OS_LINUX_SPEC32): Likewise.
	(LINK_OS_LINUX_SPEC64): Likewise.

	* doc/install.texi (--enable-advance-toolchain=<xx>): Document new
	configuration option.

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

[-- Attachment #2: at-prefixes.patch02b --]
[-- Type: text/plain, Size: 6592 bytes --]

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(.../svn+ssh://meissner@gcc.gnu.org/svn/gcc/trunk/gcc/config.gcc)	(revision 223994)
+++ gcc/config.gcc	(.../gcc/config.gcc)	(working copy)
@@ -4044,7 +4044,7 @@ case "${target}" in
 		;;
 
 	powerpc*-*-* | rs6000-*-*)
-		supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64"
+		supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64 advance_toolchain"
 
 		for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
 			eval "val=\$with_$which"
@@ -4091,6 +4091,56 @@ case "${target}" in
 			exit 1
 			;;
 		esac
+
+		if test "x$with_advance_toolchain" != x; then
+		    if test -d "/opt/$with_advance_toolchain/." -a \
+			-d "/opt/$with_advance_toolchain/bin/." -a \
+			-d "/opt/$with_advance_toolchain/include/."; then
+
+			tm_file="$tm_file ./advance-toolchain.h"
+			(at="/opt/$with_advance_toolchain"
+			 echo "/* Use Advance Toolchain $at */"
+			 echo
+			 echo "#ifndef USE_AT_INCLUDE_FILES"
+			 echo "#define USE_AT_INCLUDE_FILES 1"
+			 echo "#endif"
+			 echo
+			 echo "#if USE_AT_INCLUDE_FILES"
+			 echo "#undef  INCLUDE_EXTRA_SPEC"
+			 echo "#define INCLUDE_EXTRA_SPEC" \
+			      "\"-isystem $at/include\""
+			 echo "#endif"
+			 echo
+			 echo "#undef  LINK_OS_EXTRA_SPEC32"
+			 echo "#define LINK_OS_EXTRA_SPEC32" \
+			      "\"%(link_os_new_dtags)" \
+			      "-rpath $prefix/lib -rpath $at/lib" \
+			      "-L $prefix/lib -L $at/lib\""
+			 echo
+			 echo "#undef  LINK_OS_EXTRA_SPEC64"
+			 echo "#define LINK_OS_EXTRA_SPEC64" \
+			      "\"%(link_os_new_dtags)" \
+			      "-rpath $prefix/lib64 -rpath $at/lib64" \
+			      "-L $prefix/lib64 -L $at/lib64\""
+			 echo
+			 echo "#undef  LINK_OS_NEW_DTAGS_SPEC"
+			 echo "#define LINK_OS_NEW_DTAGS_SPEC" \
+			      "\"--enable-new-dtags\""
+			 echo
+			 echo "#undef  DYNAMIC_LINKER_PREFIX"
+			 echo "#define DYNAMIC_LINKER_PREFIX \"$at\""
+			 echo
+			 echo "#undef  MD_EXEC_PREFIX"
+			 echo "#define MD_EXEC_PREFIX \"$at/bin/\""
+			 echo
+			 echo "#undef  MD_STARTFILE_PREFIX"
+			 echo "#define MD_STARTFILE_PREFIX \"$at/lib/\"") \
+			    > advance-toolchain.h
+		    else
+			echo "Unknown advance-toolchain $with_advance_toolchain"
+			exit 1
+		    fi
+		fi
 		;;
 
 	s390*-*-*)
Index: gcc/config/rs6000/linux64.h
===================================================================
--- gcc/config/rs6000/linux64.h	(.../svn+ssh://meissner@gcc.gnu.org/svn/gcc/trunk/gcc/config/rs6000)	(revision 223994)
+++ gcc/config/rs6000/linux64.h	(.../gcc/config/rs6000)	(working copy)
@@ -207,7 +207,36 @@ extern int dot_symbols;
   { "asm_spec32",		ASM_SPEC32 },				\
   { "asm_spec64",		ASM_SPEC64 },				\
   { "link_os_linux_spec32",	LINK_OS_LINUX_SPEC32 },			\
-  { "link_os_linux_spec64",	LINK_OS_LINUX_SPEC64 },
+  { "link_os_linux_spec64",	LINK_OS_LINUX_SPEC64 },			\
+  { "link_os_extra_spec32",	LINK_OS_EXTRA_SPEC32 },			\
+  { "link_os_extra_spec64",	LINK_OS_EXTRA_SPEC64 },			\
+  { "link_os_new_dtags",	LINK_OS_NEW_DTAGS_SPEC },		\
+  { "include_extra",		INCLUDE_EXTRA_SPEC },			\
+  { "dynamic_linker_prefix",	DYNAMIC_LINKER_PREFIX },
+
+/* Optional specs used for overriding the system include directory, default
+   -rpath links, and prefix for the dynamic linker.  Normally, there are not
+   defined, but if the user configure with the --with-advance-toolchain=<xxx>
+   option, the advance-toolchain.h file will override these.  */
+#ifndef INCLUDE_EXTRA_SPEC
+#define INCLUDE_EXTRA_SPEC	""
+#endif
+
+#ifndef LINK_OS_EXTRA_SPEC32
+#define LINK_OS_EXTRA_SPEC32	""
+#endif
+
+#ifndef LINK_OS_EXTRA_SPEC64
+#define LINK_OS_EXTRA_SPEC64	""
+#endif
+
+#ifndef LINK_OS_NEW_DTAGS_SPEC
+#define LINK_OS_NEW_DTAGS_SPEC	""
+#endif
+
+#ifndef DYNAMIC_LINKER_PREFIX
+#define DYNAMIC_LINKER_PREFIX	""
+#endif
 
 #undef	MULTILIB_DEFAULTS
 #if DEFAULT_ARCH64_P
@@ -341,7 +370,7 @@ extern int dot_symbols;
   while (0)
 
 #undef  CPP_OS_DEFAULT_SPEC
-#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
+#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
 
 #undef  LINK_SHLIB_SPEC
 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
@@ -361,12 +390,18 @@ extern int dot_symbols;
 #undef	LINK_OS_DEFAULT_SPEC
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
+
 #ifdef LINUX64_DEFAULT_ABI_ELFv2
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
+#define GLIBC_DYNAMIC_LINKER64 \
+"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
+":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
 #else
-#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
+#define GLIBC_DYNAMIC_LINKER64 \
+"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
+":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
 #endif
+
 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
 #if DEFAULT_LIBC == LIBC_UCLIBC
@@ -402,11 +437,13 @@ extern int dot_symbols;
 
 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
   %{rdynamic:-export-dynamic} \
-  -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}"
+  -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
+  %(link_os_extra_spec32)"
 
 #define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
   %{rdynamic:-export-dynamic} \
-  -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}"
+  -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}} \
+  %(link_os_extra_spec64)"
 
 #undef  TOC_SECTION_ASM_OP
 #define TOC_SECTION_ASM_OP \
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(.../svn+ssh://meissner@gcc.gnu.org/svn/gcc/trunk/gcc/doc)	(revision 223994)
+++ gcc/doc/install.texi	(.../gcc/doc)	(working copy)
@@ -1607,6 +1607,14 @@ should not be built.
 Specify that the compiler should
 use DWARF 2 debugging information as the default.
 
+@item --enable-advance-toolchain=@var{at}
+On 64-bit PowerPC Linux systems, configure the compiler to use the
+header files, library files, and the dynamic linker from the Advance
+Toolchain release @var{at} instead of the default versions that are
+provided by the Linux distribution.  In general, this option is
+intended for the developers of GCC, and it is not intended for general
+use.
+
 @item --enable-targets=all
 @itemx --enable-targets=@var{target_list}
 Some GCC targets, e.g.@: powerpc64-linux, build bi-arch compilers.

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

* Re: [PATCH], Add support for --with-advance-toolchain=<xx> to PowerPC
  2015-06-03  0:06 [PATCH], Add support for --with-advance-toolchain=<xx> to PowerPC Michael Meissner
@ 2015-06-03  0:10 ` Joseph Myers
  2015-06-03  2:34   ` Michael Meissner
  2015-06-03 15:51 ` David Edelsohn
  1 sibling, 1 reply; 4+ messages in thread
From: Joseph Myers @ 2015-06-03  0:10 UTC (permalink / raw)
  To: Michael Meissner; +Cc: gcc-patches, dje.gcc

On Tue, 2 Jun 2015, Michael Meissner wrote:

> 	* config.gcc (powerpc*-*-*): Add support for a new configure
> 	option --with-advance-toolchain=<xxx> which overrides using the
> 	default header files, libraries and dynamic linker.

> 	* doc/install.texi (--enable-advance-toolchain=<xx>): Document new
> 	configuration option.

These are inconsistent about the naming of the option (the implementation 
uses --with but the documentation uses --enable).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH], Add support for --with-advance-toolchain=<xx> to PowerPC
  2015-06-03  0:10 ` Joseph Myers
@ 2015-06-03  2:34   ` Michael Meissner
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Meissner @ 2015-06-03  2:34 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Michael Meissner, gcc-patches, dje.gcc

On Wed, Jun 03, 2015 at 12:05:36AM +0000, Joseph Myers wrote:
> On Tue, 2 Jun 2015, Michael Meissner wrote:
> 
> > 	* config.gcc (powerpc*-*-*): Add support for a new configure
> > 	option --with-advance-toolchain=<xxx> which overrides using the
> > 	default header files, libraries and dynamic linker.
> 
> > 	* doc/install.texi (--enable-advance-toolchain=<xx>): Document new
> > 	configuration option.
> 
> These are inconsistent about the naming of the option (the implementation 
> uses --with but the documentation uses --enable).

Good catch.  I meant to use --with in the documentation.

-- 
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] 4+ messages in thread

* Re: [PATCH], Add support for --with-advance-toolchain=<xx> to PowerPC
  2015-06-03  0:06 [PATCH], Add support for --with-advance-toolchain=<xx> to PowerPC Michael Meissner
  2015-06-03  0:10 ` Joseph Myers
@ 2015-06-03 15:51 ` David Edelsohn
  1 sibling, 0 replies; 4+ messages in thread
From: David Edelsohn @ 2015-06-03 15:51 UTC (permalink / raw)
  To: Michael Meissner, GCC Patches, Joseph S. Myers

On Tue, Jun 2, 2015 at 8:02 PM, Michael Meissner
<meissner@linux.vnet.ibm.com> wrote:
> This is a convenience patch that would help those of us who work on the main
> GCC releases as well as backporting changes to the IBM Advance Toolchain.  It
> adds a new configuration switch, --with-advance-toolchain=<xxx> that configures
> the compiler to use the include files, libraries, and dynamic loader that are
> released with the IBM Advance Toolchain releases instead of the distribution
> headers and libraries.
>
> On the older systems, the distribution glibc (based on glibc 2.11) accounts for
> some errors in the testsuite that are fixed in newer glibc's that the Advance
> Toolchain provides (Advance Toolchain 7.0 provides 2.18, while Advance
> Toolchain 8.0 provides 2.20), and it is useful not to encounter these when
> running make check.
>
> I've tested these patches on a power7 SuSE Sles 11.3 big endian system, and on
> a power8 Ubuntu little endian system.  On the older system, I can't build a
> bootstrap compiler, due to C++ library issues.  On the Ubunto system, I get no
> regressions.  Given this switch is a debug convenience option that users are
> not expected to use, I don't see the no bootstrap issue as being a problem.
>
> In addition to the trunk, I would like to backport the patch to the active
> branches (4.9 and 5).  Is this patch acceptable to commit to the trunk and to
> the branches?
>
> 2015-06-02  Michael Meissner  <meissner@linux.vnet.ibm.com>
>
>         * config.gcc (powerpc*-*-*): Add support for a new configure
>         option --with-advance-toolchain=<xxx> which overrides using the
>         default header files, libraries and dynamic linker.
>
>         * config/rs6000/linux64.h (SUBSUBTARGET_EXTRA_SPECS): Add new
>         specs to support the configure --with-advance-toolchain=<xxx>
>         option.
>         (INCLUDE_EXTRA_SPEC): Likewise.
>         (LINK_OS_EXTRA_SPEC32): Likewise.
>         (LINK_OK_EXTRA_SPEC64): Likewise.
>         (LINK_OS_NEW_DTAGS_SPEC): Likewise.
>         (DYNAMIC_LINKER_PREFIX): Likewise.
>         (CPP_OS_DEFAULT_SPEC): Use the new specs for providing advance
>         toolchain support.
>         (GLIBC_DYNAMIC_LINKER32): Likewise.
>         (GLIBC_DYNAMIC_LINKER64): Likewise.
>         (LINK_OS_LINUX_SPEC32): Likewise.
>         (LINK_OS_LINUX_SPEC64): Likewise.
>
>         * doc/install.texi (--enable-advance-toolchain=<xx>): Document new
>         configuration option.

This is okay, with the correction noticed by Joseph.

Please ask the Release Managers about backporting.

Thanks, David

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

end of thread, other threads:[~2015-06-03 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-03  0:06 [PATCH], Add support for --with-advance-toolchain=<xx> to PowerPC Michael Meissner
2015-06-03  0:10 ` Joseph Myers
2015-06-03  2:34   ` Michael Meissner
2015-06-03 15:51 ` David Edelsohn

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