public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* GAS patch for sh*-unknown-linux-gnu
@ 2001-10-03  2:34 NIIBE Yutaka
  2001-10-03  4:22 ` Ralf Corsepius
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: NIIBE Yutaka @ 2001-10-03  2:34 UTC (permalink / raw)
  To: binutils

Hi there, 

Here's a patch for gas for the target sh*-unknown-linux-gnu.

It does some clean-up for endian handling.  Removing the variable
shl and use target_big_endian directly, let configure define
TARGET_BYTES_BIG_ENDIAN.

Besides, we'd like to set default as little endian for
sh-unknown-linux-gnu, because it's more populer for SH-3 and SH-4.

While only little endian is supported for sh-*-pe, we need
support of big endian, thus, the option -big.


2001-10-03  NIIBE Yutaka  <gniibe@m17n.org>

	* config/tc-sh.c (big): New function.
	(md_show_usage): Add description fo -big.
	(md_parse_option): Handle OPTION_BIG.
	(md_pseudo_table, md_longopts): Added "big".
	(OPTION_BIG): Added.
	
	* configure.in (endian): Default is big, it is little for two
	cases, sh-*-pe* and sh*-*-linux*.
	(cpu_type): Set sh for target sh*.

	* config/tc-sh.c (shl): Removed.
	(little, md_parse_option): Remove shl handling.
	(md_begin): Don't set target_big_endian here (depending shl).

	* config/tc-sh.h (TARGET_BYTES_BIG_ENDIAN): Removed.
	(LISTING_HEADER, COFF_MAGIC, TARGET_FORMAT): Use target_big_endian.
	(shl): Removed.

Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.78
diff -u -p -r1.78 configure.in
--- configure.in	2001/09/14 11:46:40	1.78
+++ configure.in	2001/10/03 09:24:25
@@ -144,6 +144,7 @@ changequote([,])dnl
       rs6000*)		cpu_type=ppc ;;
       s390x*)		cpu_type=s390 arch=s390x ;;
       s390*)		cpu_type=s390 arch=s390 ;;
+      sh*)		cpu_type=sh endian=big ;;
       sparclite*)	cpu_type=sparc arch=sparclite ;;
       sparclet*)	cpu_type=sparc arch=sparclet ;;
       sparc64*)		cpu_type=sparc arch=v9-64 ;;
@@ -398,10 +399,11 @@ changequote([,])dnl
       s390x-*-linux-gnu*)   fmt=elf em=linux ;;
       s390-*-linux-gnu*)    fmt=elf em=linux ;;
 
-      sh-*-linux*)	    fmt=elf em=linux ;;
+      sh*eb-*-linux*)	    fmt=elf em=linux endian=big ;;
+      sh*-*-linux*)	    fmt=elf em=linux endian=little ;;
       sh-*-elf*)	    fmt=elf ;;
       sh-*-coff*)           fmt=coff bfd_gas=yes;;
-      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
+      sh-*-pe*)             fmt=coff em=pe bfd_gas=yes endian=little ;;
       sh-*-rtemself*)       fmt=elf ;;
       sh-*-rtems*)	    fmt=coff bfd_gas=yes;;
 
Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.43
diff -u -p -r1.43 tc-sh.c
--- tc-sh.c	2001/10/01 00:06:58	1.43
+++ tc-sh.c	2001/10/03 09:24:25
@@ -80,13 +80,17 @@ static void sh_elf_cons PARAMS ((int));
 symbolS *GOT_symbol;		/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
 #endif
 
-int shl = 0;
+static void
+big (ignore)
+     int ignore ATTRIBUTE_UNUSED;
+{
+  target_big_endian = 1;
+}
 
 static void
 little (ignore)
      int ignore ATTRIBUTE_UNUSED;
 {
-  shl = 1;
   target_big_endian = 0;
 }
 
@@ -107,6 +111,7 @@ const pseudo_typeS md_pseudo_table[] =
   {"int", cons, 4},
   {"word", cons, 2},
 #endif /* OBJ_ELF */
+  {"big", big, 0},
   {"form", listing_psize, 0},
   {"little", little, 0},
   {"heading", listing_title, 0},
@@ -439,14 +444,6 @@ md_begin ()
   char *prev_name = "";
   int target_arch;
 
-#ifdef TE_PE
-  /* The WinCE OS only supports little endian executables.  */
-  target_big_endian = 0;
-#else
-  if (! shl)
-    target_big_endian = 1;
-#endif
-
   target_arch = arch_sh1_up & ~(sh_dsp ? arch_sh3e_up : arch_sh_dsp_up);
   valid_arch = target_arch;
 
@@ -2127,11 +2124,13 @@ CONST char *md_shortopts = "";
 struct option md_longopts[] =
 {
 #define OPTION_RELAX  (OPTION_MD_BASE)
-#define OPTION_LITTLE (OPTION_MD_BASE + 1)
+#define OPTION_BIG (OPTION_MD_BASE + 1)
+#define OPTION_LITTLE (OPTION_BIG + 1)
 #define OPTION_SMALL (OPTION_LITTLE + 1)
 #define OPTION_DSP (OPTION_SMALL + 1)
 
   {"relax", no_argument, NULL, OPTION_RELAX},
+  {"big", no_argument, NULL, OPTION_BIG},
   {"little", no_argument, NULL, OPTION_LITTLE},
   {"small", no_argument, NULL, OPTION_SMALL},
   {"dsp", no_argument, NULL, OPTION_DSP},
@@ -2150,8 +2149,11 @@ md_parse_option (c, arg)
       sh_relax = 1;
       break;
 
+    case OPTION_BIG:
+      target_big_endian = 1;
+      break;
+
     case OPTION_LITTLE:
-      shl = 1;
       target_big_endian = 0;
       break;
 
@@ -2177,6 +2179,7 @@ md_show_usage (stream)
   fprintf (stream, _("\
 SH options:\n\
 -little			generate little endian code\n\
+-big			generate big endian code\n\
 -relax			alter jump instructions for long displacements\n\
 -small			align sections to 4 byte boundaries, not 16\n\
 -dsp			enable sh-dsp insns, and disable sh3e / sh4 insns.\n"));
Index: gas/config/tc-sh.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.h,v
retrieving revision 1.14
diff -u -p -r1.14 tc-sh.h
--- tc-sh.h	2001/10/01 00:08:36	1.14
+++ tc-sh.h	2001/10/03 09:24:25
@@ -21,8 +21,6 @@
 
 #define TC_SH
 
-#define TARGET_BYTES_BIG_ENDIAN 0
-
 #define TARGET_ARCH bfd_arch_sh
 
 #if ANSI_PROTOTYPES
@@ -30,9 +28,6 @@ struct segment_info_struct;
 struct internal_reloc;
 #endif
 
-/* Whether in little endian mode.  */
-extern int shl;
-
 /* Whether -relax was used.  */
 extern int sh_relax;
 
@@ -81,7 +76,7 @@ extern long md_pcrel_from_section PARAMS
 
 #define IGNORE_NONSTANDARD_ESCAPES
 
-#define LISTING_HEADER (shl ? "Hitachi Super-H GAS Little Endian" : "Hitachi Super-H GAS Big Endian")
+#define LISTING_HEADER (!target_big_endian ? "Hitachi Super-H GAS Little Endian" : "Hitachi Super-H GAS Big Endian")
 
 #define md_operand(x)
 
@@ -123,7 +118,7 @@ extern void sh_frob_file PARAMS ((void))
 
 #define BFD_ARCH TARGET_ARCH
 
-#define COFF_MAGIC (shl ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG)
+#define COFF_MAGIC (!target_big_endian ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG)
 
 /* We need to write out relocs which have not been completed.  */
 #define TC_COUNT_RELOC(fix) ((fix)->fx_addsy != NULL)
@@ -168,9 +163,9 @@ extern int tc_coff_sizemachdep PARAMS ((
 extern int target_big_endian;
 
 #ifdef TE_LINUX
-#define TARGET_FORMAT (shl ? "elf32-sh-linux" : "elf32-shbig-linux")
+#define TARGET_FORMAT (!target_big_endian ? "elf32-sh-linux" : "elf32-shbig-linux")
 #else
-#define TARGET_FORMAT (shl ? "elf32-shl" : "elf32-sh")
+#define TARGET_FORMAT (!target_big_endian ? "elf32-shl" : "elf32-sh")
 #endif
 
 #define elf_tc_final_processing sh_elf_final_processing
-- 

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  2:34 GAS patch for sh*-unknown-linux-gnu NIIBE Yutaka
@ 2001-10-03  4:22 ` Ralf Corsepius
  2001-10-03  5:06   ` NIIBE Yutaka
  2001-10-04  3:17 ` Hans-Peter Nilsson
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: Ralf Corsepius @ 2001-10-03  4:22 UTC (permalink / raw)
  To: NIIBE Yutaka; +Cc: binutils

Am Mit, 2001-10-03 um 11:34 Uhr schrieb NIIBE Yutaka:
> Hi there, 
> 
> Here's a patch for gas for the target sh*-unknown-linux-gnu.
> 
> It does some clean-up for endian handling.  Removing the variable
> shl and use target_big_endian directly, let configure define
> TARGET_BYTES_BIG_ENDIAN.
> 
> Besides, we'd like to set default as little endian for
> sh-unknown-linux-gnu, because it's more populer for SH-3 and SH-4.
> 
> While only little endian is supported for sh-*-pe, we need
> support of big endian, thus, the option -big.
Well, I am not sure if this patch is a good idea.
IMHO, it introduces compatibility problems and complications at doubtful
benefits:

* backward compatiblity problems. Users are used to sh-binutils to
default to big endianness, all gcc version up to now have pre-supposed
using bigendian as default and packages might be relying on it.

* -big would be redundant to -little and actually is of little use for
all sh users but linux-gnu users.

Further, I don't understand the need for this patch. There are other
means to provide "convenience-defaults" to users (rpm, gcc/specs, etc.).

Additionally, I also do not understand why a new variable
"target_big_endian" shall be used instead of "shl". AFAIU, it breaks
sourcecode backward compatibility at no real functional benefits.

Ralf


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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  4:22 ` Ralf Corsepius
@ 2001-10-03  5:06   ` NIIBE Yutaka
  2001-10-03  6:16     ` Ralf Corsepius
  0 siblings, 1 reply; 17+ messages in thread
From: NIIBE Yutaka @ 2001-10-03  5:06 UTC (permalink / raw)
  To: Ralf Corsepius; +Cc: binutils

Ralf Corsepius wrote:
 > Well, I am not sure if this patch is a good idea.
 > IMHO, it introduces compatibility problems and complications at doubtful
 > benefits:

Could you please read the patch, and possibly test it?
It doesn't change any sh target except sh*-unknown-linux-gnu (except
redundant -big).

 > * backward compatiblity problems. Users are used to sh-binutils to
 > default to big endianness, all gcc version up to now have pre-supposed
 > using bigendian as default and packages might be relying on it.

Yes, I know.  I did care, and I believe that I maintain backward
compatibility.

If you insist it's not, could you please let me know where's backward
compatibility problem, how?

 > * -big would be redundant to -little and actually is of little use for
 > all sh users but linux-gnu users.

When little endian is default, we need -big.

 > Additionally, I also do not understand why a new variable
 > "target_big_endian" shall be used instead of "shl". AFAIU, it breaks
 > sourcecode backward compatibility at no real functional benefits.

It is not new variable.  The variable "target_big_endian" is used
every other targets.  SH target uses "shl" in some not clear reason.

Could you please look other use of "target_big_endian" in other targets.
-- 

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  5:06   ` NIIBE Yutaka
@ 2001-10-03  6:16     ` Ralf Corsepius
  2001-10-03  6:59       ` NIIBE Yutaka
                         ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Ralf Corsepius @ 2001-10-03  6:16 UTC (permalink / raw)
  To: NIIBE Yutaka; +Cc: binutils

Am Mit, 2001-10-03 um 14:06 Uhr schrieb NIIBE Yutaka:
> Ralf Corsepius wrote:
>  > Well, I am not sure if this patch is a good idea.
>  > IMHO, it introduces compatibility problems and complications at doubtful
>  > benefits:
> 
> Could you please read the patch, and possibly test it?
> It doesn't change any sh target except sh*-unknown-linux-gnu
This is exactly what I am referring to:

It changes the behavior of "sh-*-as" from always using bigendian (except
wince) by default into something indeterministically, requiring
different flags for different "sh-*-as" variants, introducing additional
complication to configurations (configure-scripts), Makefiles etc.

I would prefer all sh-*-as variants to exhibit the same behavior on all
targets. WinCE not doing so already is bad enough, IMO.

>  > * -big would be redundant to -little and actually is of little use for
>  > all sh users but linux-gnu users.
> 
> When little endian is default, we need -big.

Well, IMHO the word "need" is false, here.

You could easily provide -little from inside gcc if you want to make
_gcc_ to default to little endianness and let a -big option be handled
there.

Similar procedures are applied to many other architectures as well.
I am even inclined to say having an "as" which does not need any other
option can rarely be met anywhere.

>  > Additionally, I also do not understand why a new variable
>  > "target_big_endian" shall be used instead of "shl". AFAIU, it breaks
>  > sourcecode backward compatibility at no real functional benefits.
> 
> It is not new variable.  The variable "target_big_endian" is used
> every other targets.  SH target uses "shl" in some not clear reason.
OK, I haven't known about this. I only noticed that your patch would
break my experimental patches for reasons being not obvious to me.

Ralf



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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  6:16     ` Ralf Corsepius
@ 2001-10-03  6:59       ` NIIBE Yutaka
  2001-10-03  7:36       ` M. R. Brown
  2001-10-03  7:38       ` NIIBE Yutaka
  2 siblings, 0 replies; 17+ messages in thread
From: NIIBE Yutaka @ 2001-10-03  6:59 UTC (permalink / raw)
  To: Ralf Corsepius; +Cc: binutils

Ralf Corsepius wrote:
 > It changes the behavior of "sh-*-as" from always using bigendian (except
 > wince) by default into something indeterministically, requiring
 > different flags for different "sh-*-as" variants, introducing additional
 > complication to configurations (configure-scripts), Makefiles etc.
 > 
 > I would prefer all sh-*-as variants to exhibit the same behavior on all
 > targets. WinCE not doing so already is bad enough, IMO.

Well, could you please let me know what is your target?
-- 

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  6:16     ` Ralf Corsepius
  2001-10-03  6:59       ` NIIBE Yutaka
@ 2001-10-03  7:36       ` M. R. Brown
  2001-10-03  7:38       ` NIIBE Yutaka
  2 siblings, 0 replies; 17+ messages in thread
From: M. R. Brown @ 2001-10-03  7:36 UTC (permalink / raw)
  To: Ralf Corsepius; +Cc: NIIBE Yutaka, binutils

* Ralf Corsepius <corsepiu@faw.uni-ulm.de> on Wed, Oct 03, 2001:

> This is exactly what I am referring to:
> 
> It changes the behavior of "sh-*-as" from always using bigendian (except
> wince) by default into something indeterministically, requiring
> different flags for different "sh-*-as" variants, introducing additional
> complication to configurations (configure-scripts), Makefiles etc.
> 

Huh?  You may want to actually look at other targets before making vague
assumptions.  Nearly every GAS target from alpha to z8k uses
TARGET_BYTES_BIG_ENDIAN, and SH is one of the few missing from that list.
The current "shl" behaviour is wrong, plain and simple.  The configure
script should be able to set the endianness default, not a hack in the
tc-sh.c file.

See the tc-*.h files in gas/config for more information.

> I would prefer all sh-*-as variants to exhibit the same behavior on all
> targets. WinCE not doing so already is bad enough, IMO.
> 

WinCE for SH is only a little-endian target.  There are no big-endian WinCE
machines.

> 
> You could easily provide -little from inside gcc if you want to make
> _gcc_ to default to little endianness and let a -big option be handled
> there.
> 
> Similar procedures are applied to many other architectures as well.
> I am even inclined to say having an "as" which does not need any other
> option can rarely be met anywhere.
> 

Elaborate.  What other targets?  All other targets seem to be doing the
correct thing, where SH deviates from the norm.

> OK, I haven't known about this. I only noticed that your patch would
> break my experimental patches for reasons being not obvious to me.
> 

Yes, changing the default endianness is huge, but if you can find a commodity
big-endian SH machine that runs Linux (not talking about exp. boards where
you can toggle endianness), then setting the default endianness for
sh-linux targets is not an issue.

Do your experimental patches deal with the sh-linux target?  Across
binutils and gcc?  Seems like you also need to provide supporting arguments
against NIIBE's patches, now that their intention has been made abundantly
clear.

M. R.

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  6:16     ` Ralf Corsepius
  2001-10-03  6:59       ` NIIBE Yutaka
  2001-10-03  7:36       ` M. R. Brown
@ 2001-10-03  7:38       ` NIIBE Yutaka
  2 siblings, 0 replies; 17+ messages in thread
From: NIIBE Yutaka @ 2001-10-03  7:38 UTC (permalink / raw)
  To: Ralf Corsepius; +Cc: binutils

I read your main again, but, sorry, I don't understand your argument.

Ralf Corsepius wrote:
 > It changes the behavior of "sh-*-as" from always using bigendian (except
 > wince) by default into something indeterministically, requiring
 > different flags for different "sh-*-as" variants, introducing additional
 > complication to configurations (configure-scripts), Makefiles etc.

I don't see.  It doesn't touch "Makefiles etc.".  Please look configure.in
scripts, the use of the variable 'endian', and 'cpu_type'.  It's completly
normal use.  I don't add any new things, here.

For our target, sh*-unknown-linux-gnu, we want the default as little
endian.  While WindowsCE only supports little endian, we also support
big endian.

It seems for me that you insists having big endian default for
sh*-unknown-linux-gnu.  If so, no thank you, please.  There're reasons
to do so.  Linux only runs on SH-3 or SH-4 (with MMU) as WindowsCE.
For SH-3 and SH-4, most system adopt little endian, (as Microsoft
requires it), and some hardware feature (such as PCMCIA support) is
not available in big endian.

 > > When little endian is default, we need -big.
 > 
 > Well, IMHO the word "need" is false, here.

Wrong.  You just insist, there's another way not to default little
endian.

With little endian default, we need -big option, which is true.
-- 

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  2:34 GAS patch for sh*-unknown-linux-gnu NIIBE Yutaka
  2001-10-03  4:22 ` Ralf Corsepius
@ 2001-10-04  3:17 ` Hans-Peter Nilsson
  2001-10-04 21:02   ` NIIBE Yutaka
  2001-10-15 19:45 ` Hans-Peter Nilsson
  2001-10-15 20:09 ` Hans-Peter Nilsson
  3 siblings, 1 reply; 17+ messages in thread
From: Hans-Peter Nilsson @ 2001-10-04  3:17 UTC (permalink / raw)
  To: NIIBE Yutaka; +Cc: binutils

Thank you for your patch.  One quick note.

On Wed, 3 Oct 2001, NIIBE Yutaka wrote:
> Index: gas/config/tc-sh.c

> +big (ignore)
> +     int ignore ATTRIBUTE_UNUSED;
> +{
> +  target_big_endian = 1;
> +}

> +  {"big", big, 0},

Setting the endianness from a directive will not work.  The
output file already has been opened and the endianness set at
the time the directive is processed.  Changing it to be an
assertion (with an as_bad call if the output isn't big-endian)
might be useful, though.

I'm not against the rest of the patch (as long as it doesn't
affect compatibility), but will unfortunately not have time to
look closer until after this weekend.  (The same goes for the
other pending SH patches.  Sorry.)  I'll consider the comments
this patch has received when I review it properly.

brgds, H-P

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-04  3:17 ` Hans-Peter Nilsson
@ 2001-10-04 21:02   ` NIIBE Yutaka
  0 siblings, 0 replies; 17+ messages in thread
From: NIIBE Yutaka @ 2001-10-04 21:02 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

Hans-Peter Nilsson wrote:
 > The same goes for the other pending SH patches.  Sorry.

No problem at all.

I've found the lack of the documentation for SH specific option in GAS.
While waiting the review, I'll do the doc thing...
-- 

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  2:34 GAS patch for sh*-unknown-linux-gnu NIIBE Yutaka
  2001-10-03  4:22 ` Ralf Corsepius
  2001-10-04  3:17 ` Hans-Peter Nilsson
@ 2001-10-15 19:45 ` Hans-Peter Nilsson
  2001-10-15 20:09 ` Hans-Peter Nilsson
  3 siblings, 0 replies; 17+ messages in thread
From: Hans-Peter Nilsson @ 2001-10-15 19:45 UTC (permalink / raw)
  To: NIIBE Yutaka; +Cc: binutils

On Wed, 3 Oct 2001, NIIBE Yutaka wrote:
> Here's a patch for gas for the target sh*-unknown-linux-gnu.
>
> It does some clean-up for endian handling.  Removing the variable
> shl and use target_big_endian directly, let configure define
> TARGET_BYTES_BIG_ENDIAN.
>
> Besides, we'd like to set default as little endian for
> sh-unknown-linux-gnu, because it's more populer for SH-3 and SH-4.
>
> While only little endian is supported for sh-*-pe, we need
> support of big endian, thus, the option -big.

Thanks!

I've committed the non-controversial changes, like the cleanup
of s/shl/!target_big_endian/ and to use endian=... in
configure.in, though I changed .big to be an assertion rather
than an attempt to change the endianness, which isn't possible
as previously pointed out.  The emitted data may be right, but
the file is marked as having the "original" endianness, causing
at least confusion.  I see .little was also wrong in this
regard.  I committed what's below.  It is possible that this
change may cause problems for some people, but then again I
think this would be the least of their problems.  Tell me if I'm
wrong.

Some nits: I added a ChangeLog entry saying "configure:
Regenerate" and a prototype for the function big.  Also,
my preference is for test-cases for all changes.

You mentioned that you were working on documentation patches.
That'd be most welcome.

2001-10-16  NIIBE Yutaka  <gniibe@m17n.org>,
	    Hans-Peter Nilsson  <hp@bitrange.com>

	* config/tc-sh.c (shl): Remove.
 	(big): New function.
	(little): Remove shl handling.  Emit error for endian mismatch.
	(md_show_usage): Add description of -big.
	(md_parse_option): Handle OPTION_BIG.  Remove shl handling.
	(OPTION_BIG): Add.
	(md_pseudo_table): Add .big.
	(md_longopts): Add -big.
	(md_begin): Don't set target_big_endian here.
	* config/tc-sh.h (TARGET_BYTES_BIG_ENDIAN): Remove.
	(LISTING_HEADER, COFF_MAGIC, TARGET_FORMAT): Use target_big_endian.
	(shl): Remove.
	* configure.in (endian): Default is big.
	(sh-*-pe*): Little endian.
	(cpu_type): Set sh for target sh*.
	* configure: Regenerate.

gas/testsuite:
	* gas/sh/err-le.s, gas/sh/err-be.s: New tests.

*** /dev/null	Tue Jan  1 05:00:00 1980
--- err-be.s	Tue Oct 16 03:54:09 2001
***************
*** 0 ****
--- 1,10 ----
+ ! { dg-do assemble { target sh*-*-elf} }
+ ! { dg-options "-little" }
+ ! { dg-error "-big required" "" { target sh*-*-elf } 0 }
+
+ ! Check that a mismatch between command-line options and the .big
+ ! directive is identified.
+
+ 	.big
+ start:
+ 	nop

*** /dev/null	Tue Jan  1 05:00:00 1980
--- err-le.s	Tue Oct 16 03:54:03 2001
***************
*** 0 ****
--- 1,10 ----
+ ! { dg-do assemble { target sh*-*-elf} }
+ ! { dg-options "-big" }
+ ! { dg-error "-little required" "" { target sh*-*-elf } 0 }
+
+ ! Check that a mismatch between command-line options and the .big
+ ! directive is identified.
+
+ 	.little
+ start:
+ 	nop

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.78
diff -p -c -r1.78 configure.in
*** configure.in	2001/09/14 11:46:40	1.78
--- configure.in	2001/10/16 02:32:07
*************** changequote([,])dnl
*** 144,149 ****
--- 144,150 ----
        rs6000*)		cpu_type=ppc ;;
        s390x*)		cpu_type=s390 arch=s390x ;;
        s390*)		cpu_type=s390 arch=s390 ;;
+       sh*)		cpu_type=sh endian=big ;;
        sparclite*)	cpu_type=sparc arch=sparclite ;;
        sparclet*)	cpu_type=sparc arch=sparclet ;;
        sparc64*)		cpu_type=sparc arch=v9-64 ;;
*************** changequote([,])dnl
*** 401,407 ****
        sh-*-linux*)	    fmt=elf em=linux ;;
        sh-*-elf*)	    fmt=elf ;;
        sh-*-coff*)           fmt=coff bfd_gas=yes;;
!       sh-*-pe*)             fmt=coff em=pe bfd_gas=yes;;
        sh-*-rtemself*)       fmt=elf ;;
        sh-*-rtems*)	    fmt=coff bfd_gas=yes;;

--- 402,408 ----
        sh-*-linux*)	    fmt=elf em=linux ;;
        sh-*-elf*)	    fmt=elf ;;
        sh-*-coff*)           fmt=coff bfd_gas=yes;;
!       sh-*-pe*)             fmt=coff em=pe bfd_gas=yes endian=little ;;
        sh-*-rtemself*)       fmt=elf ;;
        sh-*-rtems*)	    fmt=coff bfd_gas=yes;;

Index: config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.44
diff -p -c -r1.44 tc-sh.c
*** tc-sh.c	2001/10/11 23:56:33	1.44
--- tc-sh.c	2001/10/16 02:01:45
*************** static void s_uacons PARAMS ((int));
*** 57,62 ****
--- 57,63 ----
  static sh_opcode_info *find_cooked_opcode PARAMS ((char **));
  static unsigned int assemble_ppi PARAMS ((char *, sh_opcode_info *));
  static void little PARAMS ((int));
+ static void big PARAMS ((int));
  static bfd_reloc_code_real_type sh_elf_suffix
    PARAMS ((char **str_p, expressionS *, expressionS *new_exp_p));
  static int parse_reg PARAMS ((char *, int *, int *));
*************** static void sh_elf_cons PARAMS ((int));
*** 80,92 ****
  symbolS *GOT_symbol;		/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
  #endif

! int shl = 0;

  static void
  little (ignore)
       int ignore ATTRIBUTE_UNUSED;
  {
!   shl = 1;
    target_big_endian = 0;
  }

--- 81,105 ----
  symbolS *GOT_symbol;		/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
  #endif

! static void
! big (ignore)
!      int ignore ATTRIBUTE_UNUSED;
! {
!   if (! target_big_endian)
!     as_bad (_("directive .big encountered when option -big required"));

+   /* Stop further messages.  */
+   target_big_endian = 1;
+ }
+
  static void
  little (ignore)
       int ignore ATTRIBUTE_UNUSED;
  {
!   if (target_big_endian)
!     as_bad (_("directive .little encountered when option -little required"));
!
!   /* Stop further messages.  */
    target_big_endian = 0;
  }

*************** const pseudo_typeS md_pseudo_table[] =
*** 107,112 ****
--- 120,126 ----
    {"int", cons, 4},
    {"word", cons, 2},
  #endif /* OBJ_ELF */
+   {"big", big, 0},
    {"form", listing_psize, 0},
    {"little", little, 0},
    {"heading", listing_title, 0},
*************** md_begin ()
*** 439,452 ****
    char *prev_name = "";
    int target_arch;

- #ifdef TE_PE
-   /* The WinCE OS only supports little endian executables.  */
-   target_big_endian = 0;
- #else
-   if (! shl)
-     target_big_endian = 1;
- #endif
-
    target_arch = arch_sh1_up & ~(sh_dsp ? arch_sh3e_up : arch_sh_dsp_up);
    valid_arch = target_arch;

--- 453,458 ----
*************** CONST char *md_shortopts = "";
*** 2127,2137 ****
  struct option md_longopts[] =
  {
  #define OPTION_RELAX  (OPTION_MD_BASE)
! #define OPTION_LITTLE (OPTION_MD_BASE + 1)
  #define OPTION_SMALL (OPTION_LITTLE + 1)
  #define OPTION_DSP (OPTION_SMALL + 1)

    {"relax", no_argument, NULL, OPTION_RELAX},
    {"little", no_argument, NULL, OPTION_LITTLE},
    {"small", no_argument, NULL, OPTION_SMALL},
    {"dsp", no_argument, NULL, OPTION_DSP},
--- 2133,2145 ----
  struct option md_longopts[] =
  {
  #define OPTION_RELAX  (OPTION_MD_BASE)
! #define OPTION_BIG (OPTION_MD_BASE + 1)
! #define OPTION_LITTLE (OPTION_BIG + 1)
  #define OPTION_SMALL (OPTION_LITTLE + 1)
  #define OPTION_DSP (OPTION_SMALL + 1)

    {"relax", no_argument, NULL, OPTION_RELAX},
+   {"big", no_argument, NULL, OPTION_BIG},
    {"little", no_argument, NULL, OPTION_LITTLE},
    {"small", no_argument, NULL, OPTION_SMALL},
    {"dsp", no_argument, NULL, OPTION_DSP},
*************** md_parse_option (c, arg)
*** 2150,2157 ****
        sh_relax = 1;
        break;

      case OPTION_LITTLE:
-       shl = 1;
        target_big_endian = 0;
        break;

--- 2158,2168 ----
        sh_relax = 1;
        break;

+     case OPTION_BIG:
+       target_big_endian = 1;
+       break;
+
      case OPTION_LITTLE:
        target_big_endian = 0;
        break;

*************** md_show_usage (stream)
*** 2177,2182 ****
--- 2188,2194 ----
    fprintf (stream, _("\
  SH options:\n\
  -little			generate little endian code\n\
+ -big			generate big endian code\n\
  -relax			alter jump instructions for long displacements\n\
  -small			align sections to 4 byte boundaries, not 16\n\
  -dsp			enable sh-dsp insns, and disable sh3e / sh4 insns.\n"));
Index: config/tc-sh.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.h,v
retrieving revision 1.14
diff -p -c -r1.14 tc-sh.h
*** tc-sh.h	2001/10/01 00:08:36	1.14
--- tc-sh.h	2001/10/16 02:01:45
***************
*** 21,28 ****

  #define TC_SH

- #define TARGET_BYTES_BIG_ENDIAN 0
-
  #define TARGET_ARCH bfd_arch_sh

  #if ANSI_PROTOTYPES
--- 21,26 ----
*************** struct segment_info_struct;
*** 30,38 ****
  struct internal_reloc;
  #endif

- /* Whether in little endian mode.  */
- extern int shl;
-
  /* Whether -relax was used.  */
  extern int sh_relax;

--- 28,33 ----
*************** extern long md_pcrel_from_section PARAMS
*** 81,87 ****

  #define IGNORE_NONSTANDARD_ESCAPES

! #define LISTING_HEADER (shl ? "Hitachi Super-H GAS Little Endian" : "Hitachi Super-H GAS Big Endian")

  #define md_operand(x)

--- 76,84 ----

  #define IGNORE_NONSTANDARD_ESCAPES

! #define LISTING_HEADER \
!   (!target_big_endian \
!    ? "Hitachi Super-H GAS Little Endian" : "Hitachi Super-H GAS Big Endian")

  #define md_operand(x)

*************** extern void sh_frob_file PARAMS ((void))
*** 123,129 ****

  #define BFD_ARCH TARGET_ARCH

! #define COFF_MAGIC (shl ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG)

  /* We need to write out relocs which have not been completed.  */
  #define TC_COUNT_RELOC(fix) ((fix)->fx_addsy != NULL)
--- 120,126 ----

  #define BFD_ARCH TARGET_ARCH

! #define COFF_MAGIC (!target_big_endian ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG)

  /* We need to write out relocs which have not been completed.  */
  #define TC_COUNT_RELOC(fix) ((fix)->fx_addsy != NULL)
*************** extern int tc_coff_sizemachdep PARAMS ((
*** 168,176 ****
  extern int target_big_endian;

  #ifdef TE_LINUX
! #define TARGET_FORMAT (shl ? "elf32-sh-linux" : "elf32-shbig-linux")
  #else
! #define TARGET_FORMAT (shl ? "elf32-shl" : "elf32-sh")
  #endif

  #define elf_tc_final_processing sh_elf_final_processing
--- 165,173 ----
  extern int target_big_endian;

  #ifdef TE_LINUX
! #define TARGET_FORMAT (!target_big_endian ? "elf32-sh-linux" : "elf32-shbig-linux")
  #else
! #define TARGET_FORMAT (!target_big_endian ? "elf32-shl" : "elf32-sh")
  #endif

  #define elf_tc_final_processing sh_elf_final_processing

brgds, H-P

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-03  2:34 GAS patch for sh*-unknown-linux-gnu NIIBE Yutaka
                   ` (2 preceding siblings ...)
  2001-10-15 19:45 ` Hans-Peter Nilsson
@ 2001-10-15 20:09 ` Hans-Peter Nilsson
  2001-10-15 22:41   ` Ralf Corsepius
                     ` (2 more replies)
  3 siblings, 3 replies; 17+ messages in thread
From: Hans-Peter Nilsson @ 2001-10-15 20:09 UTC (permalink / raw)
  To: NIIBE Yutaka; +Cc: binutils, corsepiu, bje

On Wed, 3 Oct 2001, NIIBE Yutaka wrote:

> Here's a patch for gas for the target sh*-unknown-linux-gnu.

> Besides, we'd like to set default as little endian for
> sh-unknown-linux-gnu, because it's more populer for SH-3 and SH-4.

To me, it seems that you (Niibe) are right in that sh-linux is
always little-endian.  Refer to ASM_SPEC in
gcc/config/sh/linux.h.  Making it the default for sh-linux seems
it would only make things simpler, for people who need to write
mixed assembly and C.

I'm not really sure about using "sh*eb-*-linux*" to denote a
GNU/Linux system using big endian code and data.  Is this triple
new or has it been used somewhere else?  I'm not sure I can
approve it if it's new.  Do we need it; do you know of any
GNU/Linux big endian variant?  It's not used in e.g. bfd.  Is
there an existing (non-SH-based) port where sh* would collide?
Can Ben Elliston, the config.* maintainer, shed some light?

I'd like to hear if the sh-linux change of default would
actually cause people any problems.  Ralf Corsepius, you were
opposed to this change.  Do you have a big-endian SH-based port,
or do you think this change would be bad for other reasons than
there would then be different default-endians among sh-*-*
ELF-based targets?

I'll wait until at least the weekend with committing the
remaining patch below, or until things are clear enough.  Right
now, I think I'll commit not this patch, but a variant, just
changing sh-*-linux* to get a little-endian-default assembler
(adding endian=little to sh-*-linux*).

2001-10-16  NIIBE Yutaka  <gniibe@m17n.org>

	* configure.in (sh*eb-*-linux*): New case, defaulting to
	big-endian.
	(sh*-*-linux*): Default to little-endian.
	* configure: Regenerate.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.79
diff -p -c -r1.79 configure.in
*** configure.in	2001/10/16 02:36:19	1.79
--- configure.in	2001/10/16 02:47:12
*************** changequote([,])dnl
*** 399,405 ****
        s390x-*-linux-gnu*)   fmt=elf em=linux ;;
        s390-*-linux-gnu*)    fmt=elf em=linux ;;

!       sh-*-linux*)	    fmt=elf em=linux ;;
        sh-*-elf*)	    fmt=elf ;;
        sh-*-coff*)           fmt=coff bfd_gas=yes;;
        sh-*-pe*)             fmt=coff em=pe bfd_gas=yes endian=little ;;
--- 399,406 ----
        s390x-*-linux-gnu*)   fmt=elf em=linux ;;
        s390-*-linux-gnu*)    fmt=elf em=linux ;;

!       sh*eb-*-linux*)	    fmt=elf em=linux endian=big ;;
!       sh*-*-linux*)	    fmt=elf em=linux endian=little ;;
        sh-*-elf*)	    fmt=elf ;;
        sh-*-coff*)           fmt=coff bfd_gas=yes;;
        sh-*-pe*)             fmt=coff em=pe bfd_gas=yes endian=little ;;

brgds, H-P

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-15 20:09 ` Hans-Peter Nilsson
@ 2001-10-15 22:41   ` Ralf Corsepius
  2001-10-16  7:48   ` Daniel Jacobowitz
  2001-10-17  2:20   ` NIIBE Yutaka
  2 siblings, 0 replies; 17+ messages in thread
From: Ralf Corsepius @ 2001-10-15 22:41 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: NIIBE Yutaka, binutils, bje, Joel Sherrill

Am Die, 2001-10-16 um 05.09 schrieb Hans-Peter Nilsson:
> On Wed, 3 Oct 2001, NIIBE Yutaka wrote:
> 
> > Here's a patch for gas for the target sh*-unknown-linux-gnu.
> 
> > Besides, we'd like to set default as little endian for
> > sh-unknown-linux-gnu, because it's more populer for SH-3 and SH-4.
> 
> To me, it seems that you (Niibe) are right in that sh-linux is
> always little-endian.  Refer to ASM_SPEC in
> gcc/config/sh/linux.h.  Making it the default for sh-linux seems
> it would only make things simpler, for people who need to write
> mixed assembly and C.
IMHO, this is only partially correct. 

The default for the sh been bigendian. Therefore users and applications
are used to using gcc -ml and to using __LITTLE_ENDIAN__ and such.

> I'm not really sure about using "sh*eb-*-linux*" to denote a
> GNU/Linux system using big endian code and data.  Is this triple
> new or has it been used somewhere else?  I'm not sure I can
> approve it if it's new.  Do we need it; do you know of any
> GNU/Linux big endian variant?  It's not used in e.g. bfd.  Is
> there an existing (non-SH-based) port where sh* would collide?
> Can Ben Elliston, the config.* maintainer, shed some light?
Sorry, I don't know, but I am inclined to agree with you (i.e. to reject
the sh-*eb* part).

> I'd like to hear if the sh-linux change of default would
> actually cause people any problems.  Ralf Corsepius, you were
> opposed to this change.  Do you have a big-endian SH-based port,
Depends on what you are referring to. 

No, I don't have a big-endian sh-linux port nor am I using sh-linux. 

I am the original porter of RTEMS to the sh and the
"defacto/inofficial"-maintainer of sh-rtems. RTEMS currently supports
sh1/sh2 big endian (little endian is supposed to work, but has never
been used, AFAIK), I heared about sh3-ports (RTEMS can be used closed
source), furthermore, an sh4/little endian port currently is being
merged into the public sources.

The GNU-toolchains being used for all of them is more or less identical
to default sh-coff and sh-elf gcc/GNU-toolchains, ie. multilibbed, with
big-endian being the default for all cpu-variants.

> or do you think this change would be bad for other reasons than
> there would then be different default-endians among sh-*-*
> ELF-based targets?
This part of your sentence is the quintessence of what I tried to
express: I am concerned about inconsistent defaults for different
sh-*-binutils and complications arizing from this. All I want is
simplicity wrt. portability, but I am not particularily concerned about
sh-*-linux-gnu.

I just want to avoid complaints like these: "WTH does sh-rtems-as
require -ml, while sh-*linux-as doesn't. Now, I need to hack my
source-tree to get that d***ed stuff working?"

If you feel comfortable with this, please go ahead. As such low-level
libraries and applications will rare be met, this issue will only affect
a very small number of users, anyway :(

Ralf


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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-15 20:09 ` Hans-Peter Nilsson
  2001-10-15 22:41   ` Ralf Corsepius
@ 2001-10-16  7:48   ` Daniel Jacobowitz
  2001-10-17  2:20   ` NIIBE Yutaka
  2 siblings, 0 replies; 17+ messages in thread
From: Daniel Jacobowitz @ 2001-10-16  7:48 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: NIIBE Yutaka, binutils, corsepiu, bje

On Mon, Oct 15, 2001 at 11:09:28PM -0400, Hans-Peter Nilsson wrote:
> To me, it seems that you (Niibe) are right in that sh-linux is
> always little-endian.  Refer to ASM_SPEC in
> gcc/config/sh/linux.h.  Making it the default for sh-linux seems
> it would only make things simpler, for people who need to write
> mixed assembly and C.

There's some argument ongoing that sh-linux should be default little
endian but generally flexible, and that if you only want one endianness
you should configure for sh?e[bl].  I'm not sure I agree with that
argument, though.

> I'm not really sure about using "sh*eb-*-linux*" to denote a
> GNU/Linux system using big endian code and data.  Is this triple
> new or has it been used somewhere else?  I'm not sure I can
> approve it if it's new.  Do we need it; do you know of any
> GNU/Linux big endian variant?  It's not used in e.g. bfd.  Is
> there an existing (non-SH-based) port where sh* would collide?
> Can Ben Elliston, the config.* maintainer, shed some light?

It's been in use in at least some community trees for a while now.  We
at MontaVista support a couple of big-endian SH3/SH4 GNU/Linux targets
now.

Configurewise, we build tools for sh?e[bl].  We then build all user
applications for sh-*-*.  It's a little hokey, but it seems to work
very well; applications don't really Need To Know which SH they are
built for, and this lets us make tools that default to the correct
target for the given port.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-15 20:09 ` Hans-Peter Nilsson
  2001-10-15 22:41   ` Ralf Corsepius
  2001-10-16  7:48   ` Daniel Jacobowitz
@ 2001-10-17  2:20   ` NIIBE Yutaka
  2001-10-24 17:01     ` Michael Eager
  2 siblings, 1 reply; 17+ messages in thread
From: NIIBE Yutaka @ 2001-10-17  2:20 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils, corsepiu, bje

Hans-Peter Nilsson wrote:
 > I'm not really sure about using "sh*eb-*-linux*" to denote a
 > GNU/Linux system using big endian code and data.  Is this triple
 > new or has it been used somewhere else?  I'm not sure I can
 > approve it if it's new.  Do we need it; do you know of any
 > GNU/Linux big endian variant?  It's not used in e.g. bfd.  Is
 > there an existing (non-SH-based) port where sh* would collide?
 > Can Ben Elliston, the config.* maintainer, shed some light?

It's not new (for me :-).  For GNU/Linux on SuperH Project
( http://www.m17n.org/linux-sh/ ), there're for targets:

	sh4-unknown-linux-gnu
	sh4eb-unknown-linux-gnu
	sh3-unknown-linux-gnu
	sh3eb-unknown-linux-gnu

Note that the kernel (uname on native machine) returns sh3, sh3eb,
sh4, or sh4eb.  IIRC, it was discussed around April 2000, and
implemented (in kernel) July 2000.  Before that, we only had cross
toolchain, and didn't care about native toolchain.  The kernel
returned "sh" for all of four targets.  We found the probelm when
we became to have native toolchain.

I've already send a changes to Ben, and all support of the four
targets is now included in config.{sub,guess}.  Thanks Ben for
maintaining them.

(I didn't know the maintainance of config.{sub,guess}, so it took time
since kernel change to toolchain change.

I think I have confgigury change for ld on native GNU/Linux system on
SuperH too, I will send later (after document addition of gas).

I think that the definition of CPU name is determined by kernel.
While I think "sh4el" could be candidate, kernel already has been use
the definition above for a year or so.
-- 

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-17  2:20   ` NIIBE Yutaka
@ 2001-10-24 17:01     ` Michael Eager
  2001-10-24 17:13       ` Hans-Peter Nilsson
  2001-10-29  1:27       ` NIIBE Yutaka
  0 siblings, 2 replies; 17+ messages in thread
From: Michael Eager @ 2001-10-24 17:01 UTC (permalink / raw)
  To: NIIBE Yutaka; +Cc: Hans-Peter Nilsson, binutils, corsepiu, bje

NIIBE Yutaka wrote:
> 
> Hans-Peter Nilsson wrote:
>  > I'm not really sure about using "sh*eb-*-linux*" to denote a
>  > GNU/Linux system using big endian code and data.  Is this triple
>  > new or has it been used somewhere else?  I'm not sure I can
>  > approve it if it's new.  Do we need it; do you know of any
>  > GNU/Linux big endian variant?  It's not used in e.g. bfd.  Is
>  > there an existing (non-SH-based) port where sh* would collide?
>  > Can Ben Elliston, the config.* maintainer, shed some light?
> 
> It's not new (for me :-).  For GNU/Linux on SuperH Project
> ( http://www.m17n.org/linux-sh/ ), there're for targets:
> 
>         sh4-unknown-linux-gnu
>         sh4eb-unknown-linux-gnu
>         sh3-unknown-linux-gnu
>         sh3eb-unknown-linux-gnu

We patch binutils/gcc configure to support the following configurations:

         sh4el-unknown-linux-gnu
         sh4eb-unknown-linux-gnu
         sh3el-unknown-linux-gnu
         sh3eb-unknown-linux-gnu

I don't think that defaulting to big or little endian is a good idea.
It leads to unnecessary confusion.  (As if there ever is necessary
confusion. :-)) 

There is no preferred endianity, explicit is better, IMO.


--
Michael Eager     eager@mvista.com	408-328-8426	
MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA  94085

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-24 17:01     ` Michael Eager
@ 2001-10-24 17:13       ` Hans-Peter Nilsson
  2001-10-29  1:27       ` NIIBE Yutaka
  1 sibling, 0 replies; 17+ messages in thread
From: Hans-Peter Nilsson @ 2001-10-24 17:13 UTC (permalink / raw)
  To: Michael Eager; +Cc: NIIBE Yutaka, binutils, corsepiu, bje

On Wed, 24 Oct 2001, Michael Eager wrote:

> NIIBE Yutaka wrote:
> >
> > Hans-Peter Nilsson wrote:
> >  > I'm not really sure about using "sh*eb-*-linux*" to denote a
> >  > GNU/Linux system using big endian code and data.  Is this triple
> >  > new or has it been used somewhere else?  I'm not sure I can
> >  > approve it if it's new.  Do we need it; do you know of any
> >  > GNU/Linux big endian variant?  It's not used in e.g. bfd.  Is
> >  > there an existing (non-SH-based) port where sh* would collide?
> >  > Can Ben Elliston, the config.* maintainer, shed some light?
> >
> > It's not new (for me :-).  For GNU/Linux on SuperH Project
> > ( http://www.m17n.org/linux-sh/ ), there're for targets:
> >
> >         sh4-unknown-linux-gnu
> >         sh4eb-unknown-linux-gnu
> >         sh3-unknown-linux-gnu
> >         sh3eb-unknown-linux-gnu
>
> We patch binutils/gcc configure to support the following configurations:
>
>          sh4el-unknown-linux-gnu
>          sh4eb-unknown-linux-gnu
>          sh3el-unknown-linux-gnu
>          sh3eb-unknown-linux-gnu
>
> I don't think that defaulting to big or little endian is a good idea.
> It leads to unnecessary confusion.  (As if there ever is necessary
> confusion. :-))
>
> There is no preferred endianity, explicit is better, IMO.

Well, since FSF GCC defaults to little-endian for "sh-linux", it
is best for binutils to default to little endian too.

I'm sufficiently convinced that Niibe's changes are the way to
go, though they're not complete: we need patches for e.g. bfd as
well.  I'll commit
<URL: http://sources.redhat.com/ml/binutils/2001-10/msg00277.html >
in a day or two; hopefully enough time for people to react if
they please.

brgds, H-P

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

* Re: GAS patch for sh*-unknown-linux-gnu
  2001-10-24 17:01     ` Michael Eager
  2001-10-24 17:13       ` Hans-Peter Nilsson
@ 2001-10-29  1:27       ` NIIBE Yutaka
  1 sibling, 0 replies; 17+ messages in thread
From: NIIBE Yutaka @ 2001-10-29  1:27 UTC (permalink / raw)
  To: binutils; +Cc: Hans-Peter Nilsson, Michael Eager

Michael Eager wrote:
 > We patch binutils/gcc configure to support the following configurations:
 > 
 >          sh4el-unknown-linux-gnu
 >          sh4eb-unknown-linux-gnu
 >          sh3el-unknown-linux-gnu
 >          sh3eb-unknown-linux-gnu
 > 
 > I don't think that defaulting to big or little endian is a good idea.
 > It leads to unnecessary confusion.  (As if there ever is necessary
 > confusion. :-)) 
 > 
 > There is no preferred endianity, explicit is better, IMO.

It's somewhat too late to change CPU name in the triple.  Kernel does
return sh3 or sh4 (not sh3el or sh4el) and config.{guess,sub} support
them.  I mean, native configuration should work well and CPU name is
sh3/sh4/sh3eb/sh4eb.

Here's a patch to enable sh3/sh4/sh3eb/sh4eb.
Well, actually, it will work sh3el/sh4el/sh3eb/sh4eb...

And the documentation of SH options.

2001-10-29  NIIBE Yutaka  <gniibe@m17n.org>

	* configure.in: Handle sh*eb-*-linux* and sh*-*-linux*.
	* doc/c-sh.texi (SH Options): Added descriptions.

Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.80
diff -u -3 -p -r1.80 configure.in
--- configure.in	2001/10/17 05:38:41	1.80
+++ configure.in	2001/10/29 09:13:59
@@ -393,7 +393,8 @@ changequote([,])dnl
       s390x-*-linux-gnu*)   fmt=elf em=linux ;;
       s390-*-linux-gnu*)    fmt=elf em=linux ;;
 
-      sh-*-linux*)	    fmt=elf em=linux ;;
+      sh*eb-*-linux*)	    fmt=elf em=linux endian=big ;;
+      sh*-*-linux*)	    fmt=elf em=linux endian=little ;;
       sh-*-elf*)	    fmt=elf ;;
       sh-*-coff*)           fmt=coff bfd_gas=yes;;
       sh-*-pe*)             fmt=coff em=pe bfd_gas=yes endian=little ;;
Index: gas/doc/c-sh.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-sh.texi,v
retrieving revision 1.2
diff -u -3 -p -r1.2 c-sh.texi
--- c-sh.texi	2001/03/08 23:24:26	1.2
+++ c-sh.texi	2001/10/29 09:13:59
@@ -18,10 +18,28 @@
 @node SH Options
 @section Options
 
-@cindex SH options (none)
-@cindex options, SH (none)
-@code{@value{AS}} has no additional command-line options for the Hitachi
+@cindex SH options
+@cindex options, SH
+@code{@value{AS}} has following command-line options for the Hitachi
 SH family.
+
+@table @code
+@kindex -little
+@kindex -big
+@kindex -relax
+@kindex -small
+@kindex -dsp
+@item -little
+Generate little endian code.
+@item -big
+Generate big endian code.
+@item -relax
+Alter jump instructions for long displacements.
+@item -small
+Align sections to 4 byte boundaries, not 16.
+@item -dsp
+Enable sh-dsp insns, and disable sh3e / sh4 insns.
+@end table
 
 @node SH Syntax
 @section Syntax
-- 

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

end of thread, other threads:[~2001-10-29  1:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-03  2:34 GAS patch for sh*-unknown-linux-gnu NIIBE Yutaka
2001-10-03  4:22 ` Ralf Corsepius
2001-10-03  5:06   ` NIIBE Yutaka
2001-10-03  6:16     ` Ralf Corsepius
2001-10-03  6:59       ` NIIBE Yutaka
2001-10-03  7:36       ` M. R. Brown
2001-10-03  7:38       ` NIIBE Yutaka
2001-10-04  3:17 ` Hans-Peter Nilsson
2001-10-04 21:02   ` NIIBE Yutaka
2001-10-15 19:45 ` Hans-Peter Nilsson
2001-10-15 20:09 ` Hans-Peter Nilsson
2001-10-15 22:41   ` Ralf Corsepius
2001-10-16  7:48   ` Daniel Jacobowitz
2001-10-17  2:20   ` NIIBE Yutaka
2001-10-24 17:01     ` Michael Eager
2001-10-24 17:13       ` Hans-Peter Nilsson
2001-10-29  1:27       ` NIIBE Yutaka

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