This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Do not install specs file


Hi Alex,

Alexandre Oliva <aoliva@redhat.com> writes:
> The attached patch appears to get mips64-linux-gnu to behave as
> intended, while removing the hideous hack I introduced some time ago.
> The only functional change is that I think someone that runs
> mips64-linux-gnu-gcc -print-file-name=libgcc_s.so will now get the n32
> lib, instead of the o32 lib you'd get before.
> [...]
> 	* config/mips/t-linux64: Remove code that messed with $(SPECS).
> 	(MULTILIB_OPTIONS, MULTILIB_DIRNAMES, MULTILIB_OSDIRNAMES): Move
> 	n32 to the front.
> 	(MULTILIB_EXTRA_OPTS, CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S):
> 	Removed.
> 	* config/mips/linux64.h (DRIVER_SELF_SPECS): Don't handle
> 	-mabi-fake-default.
> 	(SUBTARGET_TARGET_SWITCHES): Likewise.

Sorry for sitting on this message for so long.  I realise the patch
has already been approved and applied, but I wanted to check how it
handled the o32 multilib.

I've finally got around to bootstrapping mips64-linux-gnu post-patch,
and although it builds OK, the "o32" multilib is actually built as n32.
I.e. you get two n32 multilibs and one n64 multilib.

As I think you intended, o32 is still the default as far as the gcc.c
multilib code is concerned.  The problem is that this default multilib
gets built without an explicit -mabi= flag, and in the absence of the
alternative spec file, there's nothing to stop DRIVER_DEFAULT_ABI_SELF_SPEC
from kicking in.  The default multilib therefore gets built with -mabi=n32.

This all raises the question of whether we still need o32 to be the
default multilib.  I realise you only did that as a last resort, not
because it was aesthetically beautiful, but I wondered whether later
infrastructure improvements mean that we can now make n32 the true default.

The comment in config.gcc says:

	# This default ABI is a partial lie: t-linux64 overrides the
	# DRIVER_SELF_SPEC that sets the default abi, in the spec file
	# that is installed.  What GCC thinks of as the default must
	# remain as ABI_32 such that the SONAMEs of the libgcc shared
	# libraries remain compatible with those of mips-linux-gnu.

but these days, the SONAMEs of all three libgccs are "libgcc_s.so.1".
Did they used to be different?  Or does the comment really mean the
link-time filename (libgcc_s.so, etc.) instead of the SONAME?  Making
o32 the default means that gcc links against libgcc_s.so for o32, just
like it does for mips-linux-gnu, so I can see why that would make sense.

Also, was the name of libgcc the only reason for making o32 the
default multilib, or were there others?

If we're just talking about the link-time name of libgcc, then I
suppose one alternative would be to install two links for the o32
library, libgcc_s.so and libgcc_s_<abiname>.so.  mips-linux-gnu
could use the former and mips64-linux-gnu the latter.  The patch
below does this and makes n32 the true default.

On the other hand, I thought any mips-linux-gnu toolchain ought
really to be linking against its own libgcc, and would do so by
default.  So is the link-time name of libgcc really an issue?
It would be nice not to have the link hack if at all possible.

(Even if the mips-linux-gnu libraries are installed in the same place,
the "make install" step for mips-linux-gnu ought to install a suitable
libgcc_s.so link.  And there shouldn't be any collision problems because
mips64-linux-gnu only puts the o32 links in lib/.  The n32 ones go in
lib32/ and the n64 ones in lib64/.)

The patch also cleans up a couple of other things, probably as a result
of general changes that were made after the configuration was added:

  - The configuration sets the default ISA to mips1 in config.gcc
    and then uses DRIVER_SELF_SPECS to override it for n32 and n64.
    These days, the default default ABI is "from-abi", so neither
    the config.gcc nor DRIVER_SELF_SPECS bits are necessary.
    Removing them makes debugging a little easier because you
    don't have to remember to use a -mips* flag when invoking
    cc1 directly.

  - extra_parts is already set by the generic *-linux-gnu code.

  - the target_cpu_default setting isn't necessary.  linux.h already
    makes -mabicalls the default and the other masks are automatically
    set based on the ABI.

  - I always found it confusing that "32" is the name of the multilib
    directory for -mabi=n32: it sounds like it should be for -mabi=32.
    I'd like to use the -mabi= argument as the name of the directory
    instead.  (FWIW, this matches what we now do for IRIX.)

Bootstrapped & regression tested on mips64-linux-gnu.  Does it
look OK to you?  Can I drop the SHLIB_INSTALL bit? (please? ;)

Richard


	* config.gcc (mips64*-*-linux*): Set the default abi to n32.  Remove
	redundant target_cpu_default and extra_parts lines.  Use the default
	"from-abi" ISA.
	* config/mips/linux64.h (DRIVER_DEFAULT_ABI_SELF_SPEC): Delete.
	(SUBTARGET_EXTRA_SPECS): Delete.
	(DRIVER_SELF_SPECS): Remove architecture lines.  Set the ABI directly.
	(SUBTARGET_ASM_SPEC): Remove -mabi=n32 and -mabi=64 mappings.
	* config/mips/t-linux64 (MULTILIB_DIRNAMES): Use "32" for -mabi=32
	and "n32" for -mabi=n32.
	(SHLIB_INSTALL): If the link-time name ends in _32.so, create an
	equivalent .so link for 32-bit toolchains.

Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.505
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.505 config.gcc
--- config.gcc	22 Dec 2004 08:41:31 -0000	1.505
+++ config.gcc	16 Jan 2005 10:21:19 -0000
@@ -1373,15 +1373,7 @@ mips*-*-netbsd*)			# NetBSD/mips, either
 mips64*-*-linux*)
 	tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h mips/linux64.h"
 	tmake_file="${tmake_file} mips/t-linux64"
-
-	# This default ABI is a partial lie: t-linux64 overrides the
-	# DRIVER_SELF_SPEC that sets the default abi, in the spec file
-	# that is installed.  What GCC thinks of as the default must
-	# remain as ABI_32 such that the SONAMEs of the libgcc shared
-	# libraries remain compatible with those of mips-linux-gnu.
-	tm_defines="MIPS_ISA_DEFAULT=1 MIPS_ABI_DEFAULT=ABI_32"
-	target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT"
-	extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+	tm_defines="MIPS_ABI_DEFAULT=ABI_N32"
 	gnu_ld=yes
 	gas=yes
 	;;
Index: config/mips/linux64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/linux64.h,v
retrieving revision 1.9
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.9 linux64.h
--- config/mips/linux64.h	22 Dec 2004 06:02:15 -0000	1.9
+++ config/mips/linux64.h	16 Jan 2005 10:21:19 -0000
@@ -19,25 +19,16 @@ along with GCC; see the file COPYING.  I
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* This sets the post-install default ABI to n32.  This must NOT be
-   kept in sync with the default ABI in gcc/config.gcc; it's actually
-   meant to override that.  However, for correct behavior at build
-   time, we also need t-linux64 to get the build-time specs in line
-   with the setting in config.gcc.  */
-#define DRIVER_DEFAULT_ABI_SELF_SPEC "%{!mabi=*:-mabi=n32}"
-#undef SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS \
-  { "driver_default_abi_self_spec", DRIVER_DEFAULT_ABI_SELF_SPEC },
+/* Force the default endianness and ABI flags onto the command line
+   in order to make the other specs easier to write.  */
 #define DRIVER_SELF_SPECS \
 "%{!EB:%{!EL:%(endian_spec)}}", \
-"%(driver_default_abi_self_spec)", \
-"%{!mips*:%{!march=*:%{mabi=32:-mips1}%{mabi=n32|mabi=64:-mips3}}}"
+"%{!mabi=*: -mabi=n32}"
 
 #undef SUBTARGET_ASM_SPEC
 #define SUBTARGET_ASM_SPEC "\
 %{!fno-PIC:%{!fno-pic:-KPIC}} \
-%{fno-PIC:-non_shared} %{fno-pic:-non_shared} \
-%{mabi=64:-64} %{mabi=n32:-n32}"
+%{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
 
 #undef LIB_SPEC
 #define LIB_SPEC "\
Index: config/mips/t-linux64
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/t-linux64,v
retrieving revision 1.4
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 t-linux64
--- config/mips/t-linux64	22 Dec 2004 06:02:15 -0000	1.4
+++ config/mips/t-linux64	16 Jan 2005 10:21:19 -0000
@@ -1,5 +1,5 @@
 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
-MULTILIB_DIRNAMES = 32 o32 64
+MULTILIB_DIRNAMES = n32 32 64
 MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
 
 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
@@ -17,3 +17,14 @@ tp-bit.c: $(srcdir)/config/fp-bit.c
 	echo '# define TFLOAT' >> tp-bit.c
 	cat $(srcdir)/config/fp-bit.c >> tp-bit.c
 	echo '#endif' >> tp-bit.c
+
+# Install a link that 32-bit toolchains can use.
+SHLIB_INSTALL += ; \
+	case $(SHLIB_SOLINK) in \
+	  *_32.so) \
+	    alias=`echo $(SHLIB_SOLINK) | sed s/_32\.so/.so/`; \
+	    rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$$$$alias; \
+	    $(LN_S) $(SHLIB_SONAME) \
+	      $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$$$$alias \
+	    ;; \
+	esac


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]