This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Add -mcode-readable multilibs to mips*-sde-elf*
- From: Richard Sandiford <richard at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 17 Aug 2007 14:16:39 +0100
- Subject: [committed] Add -mcode-readable multilibs to mips*-sde-elf*
This patch adds -mcode-readable=no multilibs to the mips*-sde-elf*
configuration. It also compiles the other multilibs with
-mcode-readable=pcrel, so that the multilibs work with both
-mcode-readable=pcrel and -mcode-readable=yes.
SDE configurations have traditionally used -mno-data-in-code as
the name of -mcode-readable=no and -mcode-xonly as the name of
-mcode-readable=pcrel, with the former overriding the latter.
The patch uses DRIVER_SELF_SPECS to add these aliases.
At present, the libgcc2 makefile adds TARGET_LIBGCC2_CFLAGS _after_ the
multilib flags, so we cannot add -mcode-readable=pcrel there. Rather
than introduce a new form of TARGET_LIBGCC2_CFLAGS that goes before the
multilibs flags, we might as well take advantage of the weakness of
-mcode-xonly.
Tested on mipsisa32r2-sde-elf and applied. I've applied the toplevel
stuff to src too.
Richard
2007-08-17 Richard Sandiford <richard@codesourcery.com>
Nigel Stephens <nigel@mips.com>
* config/mt-sde: New file.
* configure.ac (mips*-sde-elf*): New stanza. Use config/mt-sde
as target_makefile_frag.
* configure: Regenerate.
gcc/
2007-08-17 Richard Sandiford <richard@codesourcery.com>
Nigel Stephens <nigel@mips.com>
* config/mips/sde.h (DRIVER_SELF_SPECS): Add commas.
Treat -mno-data-in-code and -mcode-xonly as aliases for
-mcode-readable=no and -mcode-readable=pcrel respectively.
* config/mips/t-sde (TARGET_LIBGCC2_CFLAGS): Add -mcode-xonly.
(MULTILIB_OPTIONS): Add -mcode-readable=no multilibs.
(MULTILIB_DIRNAMES): Update accordingly.
Index: config/mt-sde
===================================================================
--- /dev/null 2007-05-17 15:58:34.028651136 -0700
+++ config/mt-sde 2007-08-16 02:17:14.000000000 -0700
@@ -0,0 +1,8 @@
+# We default to building libraries optimised for size. We switch off
+# sibling-call optimization to permit interlinking of MIPS16 and
+# non-MIPS16 functions. The -mcode-xonly option allows MIPS16
+# libraries to run on Harvard-style split I/D memories, so long as
+# they have the D-to-I redirect for pc-relative loads.
+
+CFLAGS_FOR_TARGET = -Os -fno-optimize-sibling-calls -mcode-xonly
+CXXFLAGS_FOR_TARGET = -Os -fno-optimize-sibling-calls -mcode-xonly
Index: configure.ac
===================================================================
--- configure.ac 2007-08-13 02:36:17.000000000 -0700
+++ configure.ac 2007-08-17 01:59:19.000000000 -0700
@@ -1748,6 +1748,9 @@ case "${target}" in
spu-*-*)
target_makefile_frag="config/mt-spu"
;;
+ mips*-sde-elf*)
+ target_makefile_frag="config/mt-sde"
+ ;;
*-*-netware*)
target_makefile_frag="config/mt-netware"
;;
Index: configure
===================================================================
--- configure 2007-08-13 02:37:26.000000000 -0700
+++ configure 2007-08-17 01:59:38.000000000 -0700
@@ -5224,6 +5224,9 @@ case "${target}" in
spu-*-*)
target_makefile_frag="config/mt-spu"
;;
+ mips*-sde-elf*)
+ target_makefile_frag="config/mt-sde"
+ ;;
*-*-netware*)
target_makefile_frag="config/mt-netware"
;;
Index: gcc/config/mips/sde.h
===================================================================
--- gcc/config/mips/sde.h 2007-08-13 02:35:58.000000000 -0700
+++ gcc/config/mips/sde.h 2007-08-17 02:09:36.000000000 -0700
@@ -36,11 +36,18 @@ #define DRIVER_SELF_SPECS \
/* Remove a redundant -mfp64 for -mabi=n32; we want the !mfp64 \
multilibs. There's no need to check whether the architecture \
is 64-bit; cc1 will complain if it isn't. */ \
- "%{mabi=n32: %<mfp64}" \
+ "%{mabi=n32: %<mfp64}", \
\
/* Make sure that an endian option is always present. This makes \
things like LINK_SPEC easier to write. */ \
- "%{!EB:%{!EL:%(endian_spec)}}"
+ "%{!EB:%{!EL:%(endian_spec)}}", \
+ \
+ /* -mcode-xonly is a traditional alias for -mcode-readable=pcrel and \
+ -mno-data-in-code is a traditional alias for -mcode-readable=no. \
+ The latter trumps the former. */ \
+ "%{mno-data-in-code: -mcode-readable=no}", \
+ "%{!mcode-readable=no: %{mcode-xonly: -mcode-readable=pcrel}}", \
+ "%<mno-data-in-code %<mcode-xonly"
/* Use trap rather than break for all but MIPS I ISA. Force -no-mips16,
so that MIPS16 assembler code requires an explicit ".set mips16".
Index: gcc/config/mips/t-sde
===================================================================
--- gcc/config/mips/t-sde 2007-08-13 02:35:58.000000000 -0700
+++ gcc/config/mips/t-sde 2007-08-13 05:39:23.000000000 -0700
@@ -14,10 +14,12 @@ $(T)crtn.o: $(srcdir)/config/mips/crtn.a
# without the $gp register. Use -fno-optimize-sibling-calls in case
# we have a mixed mips16/non-mips16 environment where a plain "jump"
# instuction won't work across the divide (no jx instruction).
-TARGET_LIBGCC2_CFLAGS = -G 0 -fno-optimize-sibling-calls
+# Compile libraries with -mcode-xonly, so that they are link-compatible
+# with both -mcode-readable=pcrel and -mcode-readable=yes.
+TARGET_LIBGCC2_CFLAGS = -G 0 -fno-optimize-sibling-calls -mcode-xonly
-MULTILIB_OPTIONS = EL/EB mips32/mips32r2/mips64 mips16 msoft-float/mfp64
-MULTILIB_DIRNAMES = el eb mips32 mips32r2 mips64 mips16 sof f64
+MULTILIB_OPTIONS = EL/EB mips32/mips32r2/mips64 mips16 msoft-float/mfp64 mcode-readable=no
+MULTILIB_DIRNAMES = el eb mips32 mips32r2 mips64 mips16 sof f64 spram
MULTILIB_MATCHES = EL=mel EB=meb
# The -mfp64 option is only valid in conjunction with -mips32r2.