diff mbox

Add powerpc64-linux configuration options

Message ID 20120523223615.GA24175@ibm-tiger.the-meissners.org
State New
Headers show

Commit Message

Michael Meissner May 23, 2012, 10:36 p.m. UTC
On powerpc64-linux systems that run on IBM servers, the 32-bit software
emulation library is not built with the Red Hat and SUSE distributions, but the
FSF sources still list it as a multilib.  This patch adds a configuration
option (--disable-ppc64-swfloat) to disable building this library.

We've also seen some performance issues where building the multilibs with the
-mstrict-align option causes slow downs.  I vaguelly recall adding this option
in the 1995 time frame, because the 603, 604 systems of the day did not handle
unaligned accesses in little endian mode, and maybe some of the other embedded
chips did not handle unaligned accesses at all.  This patch also adds an option
(--disable-ppc64-strict-align) to disable building the multilibs with
-mstrict-align.

I have bootstrapped the compiler with and without the changes, and there are no
differences.  Is it ok to apply?

An alternative would be for the powerpc64-linux case, should we just delete the
software floating emulation multilib and stop using the -mstrict-align, since
Linux only runs in big endian mode.  The software emulation multilib would be
built for other powerpc varients and -mstrict-align would be used there as
well.

2012-05-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* configure.ac (--disable-ppc64-swfloat): New configure switches
	for powerpc64-linux to disable building multlibs for 32-bit
	software floating point emulation, and to remove the
	-mstrict-align option from the multilib options.
	(--disable-ppc64-strict-align): Likewise.
	* config.gcc (powerpc64-linux): Likewise.
	* configure: Regenerate.

	* config/rs6000/t-linux64-noalign: New configuration files for
	enabling and disabling building the libraries with
	-mstrict-align.
	* config/rs6000/t-linux64-align: Likewise.
	* config/rs6000/t-linux64-noswflt: New configuration file to
	disable building the 32-bit software floating point emulation
	library.
	* config/rs6000/t-linux64 (MULTILIB_EXTRA_OPTS): Move to
	t-linux64-align and t-linux64-noalign.

	* doc/install.texi (--disable-ppc64-swfloat): Document.
	(--dsiable-ppc64-strict-align): Likewise.

Comments

Joseph Myers May 23, 2012, 10:59 p.m. UTC | #1
On Wed, 23 May 2012, Michael Meissner wrote:

> An alternative would be for the powerpc64-linux case, should we just delete the
> software floating emulation multilib and stop using the -mstrict-align, since
> Linux only runs in big endian mode.  The software emulation multilib would be
> built for other powerpc varients and -mstrict-align would be used there as
> well.

I support deleting the soft-float multilib; it can't be used as-is because 
it requires its own libc, in its own sysroot, and the configuration 
doesn't use a separate sysroot for it.  As for -mstrict-align, again if 
someone wants -mstrict-align libraries I think they should set up a 
multilib using that option (or a CPU option that implies it) rather than 
trying to make the libraries from a compiler configured for some CPU 
compatible with another CPU they wouldn't normally be compatible with.
David Edelsohn May 24, 2012, 11:11 p.m. UTC | #2
On Wed, May 23, 2012 at 6:36 PM, Michael Meissner
<meissner@linux.vnet.ibm.com> wrote:
> On powerpc64-linux systems that run on IBM servers, the 32-bit software
> emulation library is not built with the Red Hat and SUSE distributions, but the
> FSF sources still list it as a multilib.  This patch adds a configuration
> option (--disable-ppc64-swfloat) to disable building this library.
>
> We've also seen some performance issues where building the multilibs with the
> -mstrict-align option causes slow downs.  I vaguelly recall adding this option
> in the 1995 time frame, because the 603, 604 systems of the day did not handle
> unaligned accesses in little endian mode, and maybe some of the other embedded
> chips did not handle unaligned accesses at all.  This patch also adds an option
> (--disable-ppc64-strict-align) to disable building the multilibs with
> -mstrict-align.

I thought the use of -mstrict-align for multilibs was because of some
re-use by embedded distros. That somehow one could build apps for
embedded PowerPC processors without a full embedded cross-toolchain --
just using the regular toolchain with an embedded target command line
option and the base libraries already worked. I am not suggesting that
(ab)use is appropriate, but I don't want to break embedded
environments.

I agree that strict-align does not make sense for PPC64.

I believe that is what you are accomplishing with the second version
of your patch, correct?

Thanks, David
Michael Meissner May 25, 2012, 2:22 p.m. UTC | #3
On Thu, May 24, 2012 at 07:11:53PM -0400, David Edelsohn wrote:
> On Wed, May 23, 2012 at 6:36 PM, Michael Meissner
> <meissner@linux.vnet.ibm.com> wrote:
> > On powerpc64-linux systems that run on IBM servers, the 32-bit software
> > emulation library is not built with the Red Hat and SUSE distributions, but the
> > FSF sources still list it as a multilib.  This patch adds a configuration
> > option (--disable-ppc64-swfloat) to disable building this library.
> >
> > We've also seen some performance issues where building the multilibs with the
> > -mstrict-align option causes slow downs.  I vaguelly recall adding this option
> > in the 1995 time frame, because the 603, 604 systems of the day did not handle
> > unaligned accesses in little endian mode, and maybe some of the other embedded
> > chips did not handle unaligned accesses at all.  This patch also adds an option
> > (--disable-ppc64-strict-align) to disable building the multilibs with
> > -mstrict-align.
> 
> I thought the use of -mstrict-align for multilibs was because of some
> re-use by embedded distros. That somehow one could build apps for
> embedded PowerPC processors without a full embedded cross-toolchain --
> just using the regular toolchain with an embedded target command line
> option and the base libraries already worked. I am not suggesting that
> (ab)use is appropriate, but I don't want to break embedded
> environments.

As I said, I believe the original motivation was that unaligned accesses did
not work in little endian mode, or for floating point but given it was 17 years
ago (and 4 or 5 different employers in my case), I don't remember the details
as much.

At least in the past, there are some differences between eabi programming and
Linux (2 small data pointers vs. 1, some alignment differences).

The first patch does this by keeping with the status quo and then if you want
to suppress the two features, adding options.  I could flip the sense of the
options, and make it default to no software floating point and no strict align.

Current SLES (Sles 10 and 11) and Red Hat (RHEL 5 and 6) right now disable
software floating emulation by applying a patch in their rpm spec files to
delete it.  In fact having the trunk still supporting software emulation causes
some problems as we build toolchains that use the host libraries.  The IBM
Advace Toolchain also eliminates the emulation libraries for the same reason.

I can't tell whether yellowdog linux compiles with the emulation library
multilib or not.

At the end of the day, any of the 3 proposals (counting the first patch and
swapping the defaults as a 3rd proposal) are fine with me.  It is simplest to
do the 2nd patch, but if we wanted to preserve the ability to do it, I would
suggest the first patch with the defaults set not to build the library or use
-mstrict-align would be best.

Alan does have a point that the MULTILIB_EXTRA_OPTS is broken for the default
libraries.  If you configure the compiler with a default for 64-bit, it is
mostly ok skipping the pic option or strict align.

> I agree that strict-align does not make sense for PPC64.
> 
> I believe that is what you are accomplishing with the second version
> of your patch, correct?

Yes, the second patch just does not build the library or use the -mstrict-align
option.  It is much simpler, but there may be somebody out there that depends
on the functionality.  I really don't know, one way or the other.
David Edelsohn May 25, 2012, 7:29 p.m. UTC | #4
On Fri, May 25, 2012 at 10:22 AM, Michael Meissner
<meissner@linux.vnet.ibm.com> wrote:

> Yes, the second patch just does not build the library or use the -mstrict-align
> option.  It is much simpler, but there may be somebody out there that depends
> on the functionality.  I really don't know, one way or the other.

Mike,

Please apply the second version of your patch corresponding to

       * config/rs6000/t-linux64: Delete the 32-bit multilib that uses
       software floating point emulation.  No longer build the multilibs
       with -mstrict-align.

Thanks, David
diff mbox

Patch

Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 187805)
+++ gcc/doc/install.texi	(working copy)
@@ -1423,6 +1423,21 @@  defaulted to o32.
 Currently, this option only affects sparc-linux, powerpc-linux, x86-linux,
 mips-linux and s390-linux.
 
+@item --disable-ppc64-swfloat
+This option disables building the 32-bit software floating point
+libraries for powerpc64-linux.
+
+@item --disable-ppc64-strict-align
+This option disables building the libraries with the
+@option{-mstrict-align} option on powerpc64-linux.
+@ifnothtml
+@xref{RS/6000 and PowerPC Options,, RS/6000 and PowerPC Options, gcc,
+Using the GNU Compiler Collection (GCC)},
+@end ifnothtml
+@ifhtml
+See ``RS/6000 and PowerPC Options'' in the main manual
+@end ifhtml
+
 @item --enable-secureplt
 This option enables @option{-msecure-plt} by default for powerpc-linux.
 @ifnothtml
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 187805)
+++ gcc/configure	(working copy)
@@ -893,6 +893,8 @@  with_multilib_list
 enable_rpath
 with_libiconv_prefix
 enable_sjlj_exceptions
+enable_ppc64_swfloat
+enable_ppc64_strict_align
 enable_secureplt
 enable_leading_mingw64_underscores
 enable_cld
@@ -1592,6 +1594,11 @@  Optional Features:
   --disable-rpath         do not hardcode runtime library paths
   --enable-sjlj-exceptions
                           arrange to use setjmp/longjmp exception handling
+  --disable-ppc64-swfloat disable building 32-bit software floating point
+                          libraries on 64-bit PowerPC Linux systems
+  --disable-ppc64-strict-align
+                          disable building multilibs with -mstrict-align on
+                          64-bit PowerPC Linux systems
   --enable-secureplt      enable -msecure-plt by default for PowerPC
   --enable-leading-mingw64-underscores
                           enable leading underscores on 64 bit mingw targets
@@ -11507,6 +11514,18 @@  case "$LIBINTL" in *$LIBICONV*)
 	LIBICONV= ;;
 esac
 
+# Check whether --enable-ppc64-swfloat was given.
+if test "${enable_ppc64_swfloat+set}" = set; then :
+  enableval=$enable_ppc64_swfloat;
+fi
+
+
+# Check whether --enable-ppc64-strict-align was given.
+if test "${enable_ppc64_strict_align+set}" = set; then :
+  enableval=$enable_ppc64_strict_align;
+fi
+
+
 # Check whether --enable-secureplt was given.
 if test "${enable_secureplt+set}" = set; then :
   enableval=$enable_secureplt;
@@ -17967,7 +17986,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17970 "configure"
+#line 17989 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18073,7 +18092,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18076 "configure"
+#line 18095 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 187805)
+++ gcc/configure.ac	(working copy)
@@ -1585,6 +1585,18 @@  case "$LIBINTL" in *$LIBICONV*)
 	LIBICONV= ;;
 esac
 
+AC_ARG_ENABLE(ppc64-swfloat,
+[AS_HELP_STRING([--disable-ppc64-swfloat],
+		[disable building 32-bit software floating point libraries
+		on 64-bit PowerPC Linux systems])],
+[], [])
+
+AC_ARG_ENABLE(ppc64-strict-align,
+[AS_HELP_STRING([--disable-ppc64-strict-align],
+		[disable building multilibs with -mstrict-align on 64-bit
+		PowerPC Linux systems])],
+[], [])
+
 AC_ARG_ENABLE(secureplt,
 [AS_HELP_STRING([--enable-secureplt],
 		[enable -msecure-plt by default for PowerPC])],
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 187805)
+++ gcc/config.gcc	(working copy)
@@ -2002,7 +2002,16 @@  powerpc-*-linux* | powerpc64-*-linux*)
 		    tm_file="${tm_file} rs6000/default64.h"
 		fi
 		tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h glibc-stdint.h"
-		tmake_file="$tmake_file rs6000/t-linux64"
+		if test x${enable_ppc64_strict_align} = xno; then
+		    tmake_file="$tmake_file rs6000/t-linux64-noalign"
+		else
+		    tmake_file="$tmake_file rs6000/t-linux64-align"
+		fi
+		if test x${enable_ppc64_swfloat} = xno; then
+		    tmake_file="$tmake_file rs6000/t-linux64-noswflt"
+		else
+		    tmake_file="$tmake_file rs6000/t-linux64"
+		fi
 		extra_options="${extra_options} rs6000/linux64.opt"
 		;;
 	    *)
Index: gcc/config/rs6000/t-linux64-noalign
===================================================================
--- gcc/config/rs6000/t-linux64-noalign	(revision 0)
+++ gcc/config/rs6000/t-linux64-noalign	(revision 0)
@@ -0,0 +1,22 @@ 
+#rs6000/t-l64-noalign
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Disable building multilibs with -mstrict-align
+MULTILIB_EXTRA_OPTS     = fPIC
Index: gcc/config/rs6000/t-linux64-noswflt
===================================================================
--- gcc/config/rs6000/t-linux64-noswflt	(revision 0)
+++ gcc/config/rs6000/t-linux64-noswflt	(revision 0)
@@ -0,0 +1,36 @@ 
+#rs6000/t-linux64-noswflt
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
+# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
+# /lib and /usr/lib, while other distributions install libraries into /lib64
+# and /usr/lib64.  The LSB does not enforce the use of /lib64 and /usr/lib64,
+# it doesn't tell anything about the 32bit libraries on those systems.  Set
+# MULTILIB_OSDIRNAMES according to what is found on the target.
+
+# Clone of t-linux64 without the software floating point libraries
+# MULTILIB_EXTRA_OPTS is set in t-linux64-noalign or t-linux64-align
+
+MULTILIB_OPTIONS        = m64/m32
+MULTILIB_DIRNAMES       = 64 32
+MULTILIB_EXCEPTIONS     =
+MULTILIB_EXCLUSIONS     =
+MULTILIB_OSDIRNAMES	= ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_MATCHES        = $(MULTILIB_MATCHES_FLOAT)
Index: gcc/config/rs6000/t-linux64-align
===================================================================
--- gcc/config/rs6000/t-linux64-align	(revision 0)
+++ gcc/config/rs6000/t-linux64-align	(revision 0)
@@ -0,0 +1,22 @@ 
+#rs6000/t-l64-align
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Enable building multilibs with -mstrict-align
+MULTILIB_EXTRA_OPTS     = fPIC mstrict-align
Index: gcc/config/rs6000/t-linux64
===================================================================
--- gcc/config/rs6000/t-linux64	(revision 187805)
+++ gcc/config/rs6000/t-linux64	(working copy)
@@ -1,7 +1,7 @@ 
 #rs6000/t-linux64
 
 # Copyright (C) 2002, 2003, 2004, 2006, 2007,
-# 2009, 2011 Free Software Foundation, Inc.
+# 2009, 2011, 2012 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -26,9 +26,10 @@ 
 # it doesn't tell anything about the 32bit libraries on those systems.  Set
 # MULTILIB_OSDIRNAMES according to what is found on the target.
 
+# MULTILIB_EXTRA_OPTS is set in t-linux64-noalign or t-linux64-align
+
 MULTILIB_OPTIONS        = m64/m32 msoft-float
 MULTILIB_DIRNAMES       = 64 32 nof
-MULTILIB_EXTRA_OPTS     = fPIC mstrict-align
 MULTILIB_EXCEPTIONS     = m64/msoft-float
 MULTILIB_EXCLUSIONS     = m64/!m32/msoft-float
 MULTILIB_OSDIRNAMES	= ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof