diff mbox

target/65286 - Disable multilib for ppc64le

Message ID 20150305231402.GD25172@bubble.grove.modra.org
State New
Headers show

Commit Message

Alan Modra March 5, 2015, 11:14 p.m. UTC
This arranges to build a powerpc64le-linux compiler without -m32
support by default.  Bootstrapped and regression tested on Ubuntu
powerpc64le-linux without --disable-multilib, and on powerpc64-linux
and powerpc-linux.  OK for mainline and branches?

This part of the config.gcc patch does most of the work
-	case ${maybe_biarch}:${enable_targets}:${cpu_is_64bit} in
-	    always:* | yes:*powerpc64* | yes:all:* | yes:*:yes)
+	case ${target}:${enable_targets}:${maybe_biarch} in
+	    powerpc64-* | powerpc-*:*:yes | *:*powerpc64-*:yes | *:all:yes \
+	    | powerpc64le*:*powerpcle* | powerpc64le*:*powerpc-* \
+	    | powerpcle-*:*powerpc64le*:yes)

always:* becomes powerpc64-*, ie. exclude powerpc64le
yes:*powerpc64* becomes *:*powerpc64-*:yes, excluding powerpc64le so
that --target=powerpc64le-linux --enable-targets=powerpc64le-linux
doesn't accidentally get you a biarch compiler.
yes:all:* becomes *:all:yes, more or less unchanged.
yes:*:yes becomes powerpc-*:*:yes allowing --target=powerpc-linux
--with-cpu=<supports 64-bit> to continue to build a biarch ppc64
compiler.

Some other notes:
t-fprules setting of MULTILIB variables is in every case overridden by
a following t-file, except for the commented out powerpc-*-openbsd*.
Since the aim of this patch is to build powerpc64le without multilibs,
the default setting of these vars needs to go.  t-ppcos needs to be
removed from powerpc64le configurations for the same reason.  Oh, and
adding t-fprules and t-ppcos before previous additions to tmake_file
is no longer necessary.  I checked all the other t-files that might be
added for interactions.

The linux64.h change is so that passing -m32 results in
	error: -m32 not supported in the configuration
rather than the confusing
	error: -m64 requires a PowerPC64 cpu
(Yes, I know using TARGET_64BIT_P would be nicer, but it's probably
better left to a cleanup patch.)

	PR target/65286
	* config.gcc (powerpc*-*-linux*): Arrange for powerpc64le-linux
	to be single-arch by default.  Set cpu_is_64bit for powerpc64
	given --with-cpu=native.
	* config/rs6000/t-fprules: Do not set default MULTILIB vars.
	* config/rs6000/t-linux (MULTIARCH_DIRNAME): Support powerpc64
	and powerpc64le.
	* config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Test
	rs6000_isa_flags rather than TARGET_64BIT.

Comments

David Edelsohn March 9, 2015, 6 p.m. UTC | #1
On Thu, Mar 5, 2015 at 6:14 PM, Alan Modra <amodra@gmail.com> wrote:
> This arranges to build a powerpc64le-linux compiler without -m32
> support by default.  Bootstrapped and regression tested on Ubuntu
> powerpc64le-linux without --disable-multilib, and on powerpc64-linux
> and powerpc-linux.  OK for mainline and branches?
>
> This part of the config.gcc patch does most of the work
> -       case ${maybe_biarch}:${enable_targets}:${cpu_is_64bit} in
> -           always:* | yes:*powerpc64* | yes:all:* | yes:*:yes)
> +       case ${target}:${enable_targets}:${maybe_biarch} in
> +           powerpc64-* | powerpc-*:*:yes | *:*powerpc64-*:yes | *:all:yes \
> +           | powerpc64le*:*powerpcle* | powerpc64le*:*powerpc-* \
> +           | powerpcle-*:*powerpc64le*:yes)
>
> always:* becomes powerpc64-*, ie. exclude powerpc64le
> yes:*powerpc64* becomes *:*powerpc64-*:yes, excluding powerpc64le so
> that --target=powerpc64le-linux --enable-targets=powerpc64le-linux
> doesn't accidentally get you a biarch compiler.
> yes:all:* becomes *:all:yes, more or less unchanged.
> yes:*:yes becomes powerpc-*:*:yes allowing --target=powerpc-linux
> --with-cpu=<supports 64-bit> to continue to build a biarch ppc64
> compiler.
>
> Some other notes:
> t-fprules setting of MULTILIB variables is in every case overridden by
> a following t-file, except for the commented out powerpc-*-openbsd*.
> Since the aim of this patch is to build powerpc64le without multilibs,
> the default setting of these vars needs to go.  t-ppcos needs to be
> removed from powerpc64le configurations for the same reason.  Oh, and
> adding t-fprules and t-ppcos before previous additions to tmake_file
> is no longer necessary.  I checked all the other t-files that might be
> added for interactions.
>
> The linux64.h change is so that passing -m32 results in
>         error: -m32 not supported in the configuration
> rather than the confusing
>         error: -m64 requires a PowerPC64 cpu
> (Yes, I know using TARGET_64BIT_P would be nicer, but it's probably
> better left to a cleanup patch.)
>
>         PR target/65286
>         * config.gcc (powerpc*-*-linux*): Arrange for powerpc64le-linux
>         to be single-arch by default.  Set cpu_is_64bit for powerpc64
>         given --with-cpu=native.
>         * config/rs6000/t-fprules: Do not set default MULTILIB vars.
>         * config/rs6000/t-linux (MULTIARCH_DIRNAME): Support powerpc64
>         and powerpc64le.
>         * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Test
>         rs6000_isa_flags rather than TARGET_64BIT.

Okay.

The number of name variations is annoying, but I guess there's no choice now.

Thanks, David
Markus Trippelsdorf March 10, 2015, 6:13 a.m. UTC | #2
On 2015.03.09 at 14:00 -0400, David Edelsohn wrote:
> On Thu, Mar 5, 2015 at 6:14 PM, Alan Modra <amodra@gmail.com> wrote:
> > This arranges to build a powerpc64le-linux compiler without -m32
> > support by default.  Bootstrapped and regression tested on Ubuntu
> > powerpc64le-linux without --disable-multilib, and on powerpc64-linux
> > and powerpc-linux.  OK for mainline and branches?
> >
> > This part of the config.gcc patch does most of the work
> > -       case ${maybe_biarch}:${enable_targets}:${cpu_is_64bit} in
> > -           always:* | yes:*powerpc64* | yes:all:* | yes:*:yes)
> > +       case ${target}:${enable_targets}:${maybe_biarch} in
> > +           powerpc64-* | powerpc-*:*:yes | *:*powerpc64-*:yes | *:all:yes \
> > +           | powerpc64le*:*powerpcle* | powerpc64le*:*powerpc-* \
> > +           | powerpcle-*:*powerpc64le*:yes)
> >
> > always:* becomes powerpc64-*, ie. exclude powerpc64le
> > yes:*powerpc64* becomes *:*powerpc64-*:yes, excluding powerpc64le so
> > that --target=powerpc64le-linux --enable-targets=powerpc64le-linux
> > doesn't accidentally get you a biarch compiler.
> > yes:all:* becomes *:all:yes, more or less unchanged.
> > yes:*:yes becomes powerpc-*:*:yes allowing --target=powerpc-linux
> > --with-cpu=<supports 64-bit> to continue to build a biarch ppc64
> > compiler.
> >
> > Some other notes:
> > t-fprules setting of MULTILIB variables is in every case overridden by
> > a following t-file, except for the commented out powerpc-*-openbsd*.
> > Since the aim of this patch is to build powerpc64le without multilibs,
> > the default setting of these vars needs to go.  t-ppcos needs to be
> > removed from powerpc64le configurations for the same reason.  Oh, and
> > adding t-fprules and t-ppcos before previous additions to tmake_file
> > is no longer necessary.  I checked all the other t-files that might be
> > added for interactions.
> >
> > The linux64.h change is so that passing -m32 results in
> >         error: -m32 not supported in the configuration
> > rather than the confusing
> >         error: -m64 requires a PowerPC64 cpu
> > (Yes, I know using TARGET_64BIT_P would be nicer, but it's probably
> > better left to a cleanup patch.)
> >
> >         PR target/65286
> >         * config.gcc (powerpc*-*-linux*): Arrange for powerpc64le-linux
> >         to be single-arch by default.  Set cpu_is_64bit for powerpc64
> >         given --with-cpu=native.
> >         * config/rs6000/t-fprules: Do not set default MULTILIB vars.
> >         * config/rs6000/t-linux (MULTIARCH_DIRNAME): Support powerpc64
> >         and powerpc64le.
> >         * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Test
> >         rs6000_isa_flags rather than TARGET_64BIT.
> 
> Okay.
> 
> The number of name variations is annoying, but I guess there's no choice now.

This patch breaks the build on ppc64le:

trippels@gcc2-power8 gcc_build_dir % ../gcc/configure --with-cpu=power8 --disable-libsanitizer --disable-bootstrap --disable-libstdcxx-pch --disable-libvtv --disable-libitm --disable-libcilkrts --disable-libssp --disable-libgomp --disable-werror --disable-multilib --enable-languages=c,c++
...
ranlib libgcc.a
# @multilib_flags@ is still needed because this may use
# /home/trippels/gcc_build_dir/./gcc/xgcc -B/home/trippels/gcc_build_dir/./gcc/ -B/usr/local/powerpc64le-unknown-linux-gnu/bin/ -B/usr/local/powerpc64le-unknown-linux-gnu/lib/ -isystem /usr/local/powerpc64le-unknown-linux-gnu/include -isystem /usr/local/powerpc64le-unknown-linux-gnu/sys-include    and -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -mlong-double-128 -mno-minimal-toc -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  directly.
# @multilib_dir@ is not really necessary, but sometimes it has
# more uses than just a directory name.
/bin/sh ../../../gcc/libgcc/../mkinstalldirs .
/home/trippels/gcc_build_dir/./gcc/xgcc -B/home/trippels/gcc_build_dir/./gcc/ -B/usr/local/powerpc64le-unknown-linux-gnu/bin/ -B/usr/local/powerpc64le-unknown-linux-gnu/lib/ -isystem /usr/local/powerpc64le-unknown-linux-gnu/include -isystem /usr/local/powerpc64le-unknown-linux-gnu/sys-include    -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -mlong-double-128 -mno-minimal-toc -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o ibm-ldouble_s.o tramp_s.o ppc64-fp_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && (echo "/* GNU ld script"; echo "   Use the shared library, but some functions are only in"; echo "   the static library.  */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > ./libgcc_s.so
/home/trippels/bin/ld: error: cannot open crti.o: No such file or directory
/home/trippels/bin/ld: error: cannot open crtn.o: No such file or directory
/home/trippels/bin/ld: error: cannot find -lc
collect2: error: ld returned 1 exit status
Makefile:947: recipe for target 'libgcc_s.so' failed
make[2]: *** [libgcc_s.so] Error 1

There is a ppc64le compile farm machine available @gcc2-2-power8.osuosl.org.
Alan Modra March 10, 2015, 7:28 a.m. UTC | #3
On Tue, Mar 10, 2015 at 07:13:48AM +0100, Markus Trippelsdorf wrote:
> This patch breaks the build on ppc64le:

Works for me with your configure options.

> trippels@gcc2-power8 gcc_build_dir % ../gcc/configure --with-cpu=power8 --disable-libsanitizer --disable-bootstrap --disable-libstdcxx-pch --disable-libvtv --disable-libitm --disable-libcilkrts --disable-libssp --disable-libgomp --disable-werror --disable-multilib --enable-languages=c,c++

At a guess, you're trying to build without glibc installed.  If so,
you'll also need --disable-shared.  I'm a bit surprised if you could
do that before my patch.

> There is a ppc64le compile farm machine available @gcc2-2-power8.osuosl.org.

I would be greedy to load the compile farm when I can use internal IBM
machines.  :)
Markus Trippelsdorf March 10, 2015, 7:32 a.m. UTC | #4
On 2015.03.10 at 17:58 +1030, Alan Modra wrote:
> On Tue, Mar 10, 2015 at 07:13:48AM +0100, Markus Trippelsdorf wrote:
> > This patch breaks the build on ppc64le:
> 
> Works for me with your configure options.
> 
> > trippels@gcc2-power8 gcc_build_dir % ../gcc/configure --with-cpu=power8 --disable-libsanitizer --disable-bootstrap --disable-libstdcxx-pch --disable-libvtv --disable-libitm --disable-libcilkrts --disable-libssp --disable-libgomp --disable-werror --disable-multilib --enable-languages=c,c++
> 
> At a guess, you're trying to build without glibc installed.  If so,
> you'll also need --disable-shared.  I'm a bit surprised if you could
> do that before my patch.

No, glibc is installed.

> > There is a ppc64le compile farm machine available @gcc2-2-power8.osuosl.org.
> 
> I would be greedy to load the compile farm when I can use internal IBM
> machines.  :)

I mentioned the machine, because it runs Fedora 21 and you have tested
only on Ubuntu.
diff mbox

Patch

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 221164)
+++ gcc/config.gcc	(working copy)
@@ -2337,28 +2337,32 @@ 
 powerpc*-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
 	extra_options="${extra_options} rs6000/sysv4.opt"
-	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
+	tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm"
 	extra_objs="$extra_objs rs6000-linux.o"
 	case ${target} in
 	    powerpc*le-*-*)
 		tm_file="${tm_file} rs6000/sysv4le.h" ;;
 	esac
-	maybe_biarch=yes
+	case ${target}:${with_cpu} in
+	    powerpc64*: | powerpc64*:native) cpu_is_64bit=yes ;;
+	esac
+	maybe_biarch=${cpu_is_64bit}
+	case ${enable_targets} in
+	    *powerpc64*) maybe_biarch=yes ;;
+	esac
 	case ${target} in
 	    powerpc64*-*-linux*spe* | powerpc64*-*-linux*paired*)
-	    	echo "*** Configuration ${target} not supported" 1>&2
+		echo "*** Configuration ${target} not supported" 1>&2
 		exit 1
 		;;
 	    powerpc*-*-linux*spe* | powerpc*-*-linux*paired*)
 		maybe_biarch=
 		;;
-	    powerpc64*-*-linux*)
-	    	test x$with_cpu != x || cpu_is_64bit=yes
-		maybe_biarch=always
-		;;
 	esac
-	case ${maybe_biarch}:${enable_targets}:${cpu_is_64bit} in
-	    always:* | yes:*powerpc64* | yes:all:* | yes:*:yes)
+	case ${target}:${enable_targets}:${maybe_biarch} in
+	    powerpc64-* | powerpc-*:*:yes | *:*powerpc64-*:yes | *:all:yes \
+	    | powerpc64le*:*powerpcle* | powerpc64le*:*powerpc-* \
+	    | powerpcle-*:*powerpc64le*:yes)
 		if test x$cpu_is_64bit = xyes; then
 		    tm_file="${tm_file} rs6000/default64.h"
 		fi
@@ -2379,9 +2383,14 @@ 
 		esac
 		extra_options="${extra_options} rs6000/linux64.opt"
 		;;
+	    powerpc64*)
+		tm_file="${tm_file} rs6000/default64.h rs6000/linux64.h glibc-stdint.h"
+		extra_options="${extra_options} rs6000/linux64.opt"
+		tmake_file="${tmake_file} rs6000/t-linux"
+		;;
 	    *)
 		tm_file="${tm_file} rs6000/linux.h glibc-stdint.h"
-		tmake_file="$tmake_file rs6000/t-linux"
+		tmake_file="${tmake_file} rs6000/t-ppcos rs6000/t-linux"
 		;;
 	esac
 	case ${target} in
Index: gcc/config/rs6000/t-fprules
===================================================================
--- gcc/config/rs6000/t-fprules	(revision 221164)
+++ gcc/config/rs6000/t-fprules	(working copy)
@@ -18,9 +18,3 @@ 
 
 SOFT_FLOAT_CPUS = e300c2 401 403 405 440 464 476 ec603e 801 821 823 860
 MULTILIB_MATCHES_FLOAT = $(foreach cpu, $(SOFT_FLOAT_CPUS), msoft-float=mcpu?$(cpu))
-
-# Build the libraries for both hard and soft floating point by default
-
-MULTILIB_OPTIONS = msoft-float
-MULTILIB_DIRNAMES = soft-float
-MULTILIB_MATCHES	= ${MULTILIB_MATCHES_FLOAT}
Index: gcc/config/rs6000/t-linux
===================================================================
--- gcc/config/rs6000/t-linux	(revision 221164)
+++ gcc/config/rs6000/t-linux	(working copy)
@@ -1,12 +1,19 @@ 
 # do not define the multiarch name if configured for a soft-float cpu
 # or soft-float.
 ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
+ifneq (,$(findstring powerpc64,$(target)))
+MULTIARCH_DIRNAME := powerpc64-linux-gnu
+else
 ifneq (,$(findstring spe,$(target)))
-MULTIARCH_DIRNAME = powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
+MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
 else
-MULTIARCH_DIRNAME = powerpc-linux-gnu
+MULTIARCH_DIRNAME := powerpc-linux-gnu
 endif
 endif
+ifneq (,$(findstring powerpcle,$(target))$(findstring powerpc64le,$(target)))
+MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
+endif
+endif
 
 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
 	$(COMPILE) $<
Index: gcc/config/rs6000/linux64.h
===================================================================
--- gcc/config/rs6000/linux64.h	(revision 221164)
+++ gcc/config/rs6000/linux64.h	(working copy)
@@ -97,7 +97,7 @@ 
     {								\
       if (!global_options_set.x_rs6000_alignment_flags)		\
 	rs6000_alignment_flags = MASK_ALIGN_NATURAL;		\
-      if (TARGET_64BIT)						\
+      if (rs6000_isa_flags & OPTION_MASK_64BIT)			\
 	{							\
 	  if (DEFAULT_ABI != ABI_AIX)				\
 	    {							\