public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] gas: microblaze: Add mlittle-endian and mbig-endian flags
@ 2023-09-25 10:12 Neal Frager
  2023-09-27 14:00 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Neal Frager @ 2023-09-25 10:12 UTC (permalink / raw)
  To: binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali, Neal Frager

Added support in gas for mlittle-endian and mbig-endian flags
as options.

Updated show usage for MicroBlaze specific assembler options
to include new entries.

This patch has been tested for years of AMD Xilinx Yocto
releases as part of the following patch set:

https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/binutils/binutils

Signed-off-by:nagaraju <nagaraju.mekala@amd.com>
Signed-off-by: Neal Frager <neal.frager@amd.com>
---
 gas/config/tc-microblaze.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
index 564e0b786e2..3cba3f02673 100644
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -37,6 +37,8 @@
 
 #define OPTION_EB (OPTION_MD_BASE + 0)
 #define OPTION_EL (OPTION_MD_BASE + 1)
+#define OPTION_LITTLE (OPTION_MD_BASE + 2)
+#define OPTION_BIG (OPTION_MD_BASE + 3)
 
 void microblaze_generate_symbol (char *sym);
 static bool check_spl_reg (unsigned *);
@@ -1854,6 +1856,8 @@ struct option md_longopts[] =
 {
   {"EB", no_argument, NULL, OPTION_EB},
   {"EL", no_argument, NULL, OPTION_EL},
+  {"mlittle-endian", no_argument, NULL, OPTION_LITTLE},
+  {"mbig-endian", no_argument, NULL, OPTION_BIG},
   { NULL,          no_argument, NULL, 0}
 };
 
@@ -2507,9 +2511,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
   switch (c)
     {
     case OPTION_EB:
+    case OPTION_BIG:
       target_big_endian = 1;
       break;
     case OPTION_EL:
+    case OPTION_LITTLE:
       target_big_endian = 0;
       break;
     default:
@@ -2524,6 +2530,9 @@ md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
   /*  fprintf(stream, _("\
       MicroBlaze options:\n\
       -noSmall         Data in the comm and data sections do not go into the small data section\n")); */
+  fprintf (stream, _(" MicroBlaze specific assembler options:\n"));
+  fprintf (stream, "  -%-23s%s\n", "mbig-endian", N_("assemble for a big endian cpu"));
+  fprintf (stream, "  -%-23s%s\n", "mlittle-endian", N_("assemble for a little endian cpu"));
 }
 
 
-- 
2.25.1


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

* Re: [PATCH v1 1/1] gas: microblaze: Add mlittle-endian and mbig-endian flags
  2023-09-25 10:12 [PATCH v1 1/1] gas: microblaze: Add mlittle-endian and mbig-endian flags Neal Frager
@ 2023-09-27 14:00 ` Nick Clifton
  2023-09-27 14:50   ` Frager, Neal
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2023-09-27 14:00 UTC (permalink / raw)
  To: Neal Frager, binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali

Hi Neal,

> Added support in gas for mlittle-endian and mbig-endian flags
> as options.

Thanks for contributing this patch.  There are a few things however
that need to be fixed/tidied up:

>   #define OPTION_EB (OPTION_MD_BASE + 0)
>   #define OPTION_EL (OPTION_MD_BASE + 1)
> +#define OPTION_LITTLE (OPTION_MD_BASE + 2)
> +#define OPTION_BIG (OPTION_MD_BASE + 3)

There is no need to have new values for the new options, you
can just reuse the existing ones.  ie:

> @@ -1854,6 +1856,8 @@ struct option md_longopts[] =
>   {
>     {"EB", no_argument, NULL, OPTION_EB},
>     {"EL", no_argument, NULL, OPTION_EL},
> +  {"mlittle-endian", no_argument, NULL, OPTION_LITTLE},
> +  {"mbig-endian", no_argument, NULL, OPTION_BIG},
>     { NULL,          no_argument, NULL, 0}
>   };

Change this to:

 >     {"EB", no_argument, NULL, OPTION_EB},
 >     {"EL", no_argument, NULL, OPTION_EL},
 > +  {"mlittle-endian", no_argument, NULL, OPTION_EL},
 > +  {"mbig-endian", no_argument, NULL, OPTION_EB},
 >     { NULL,          no_argument, NULL, 0}
 >   };


Then you can also delete:

> @@ -2507,9 +2511,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
>     switch (c)
>       {
>       case OPTION_EB:
> +    case OPTION_BIG:
>         target_big_endian = 1;
>         break;
>       case OPTION_EL:
> +    case OPTION_LITTLE:
>         target_big_endian = 0;
>         break;
>       default:

As this change is no longer needed.


More importantly however, since you are adding new MicroBlaze specific
command line options you need to update the gas/doc/as.texi file to
mention them (search for "Target MICROBLAZE options") and the
gas/doc/c-microblaze.texi file to add a "MicroBlaze Options" node.

Cheers
   Nick


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

* RE: [PATCH v1 1/1] gas: microblaze: Add mlittle-endian and mbig-endian flags
  2023-09-27 14:00 ` Nick Clifton
@ 2023-09-27 14:50   ` Frager, Neal
  0 siblings, 0 replies; 3+ messages in thread
From: Frager, Neal @ 2023-09-27 14:50 UTC (permalink / raw)
  To: Nick Clifton, binutils
  Cc: Erkiaga Elorza, Ibai, Mekala, Nagaraju, Hatle, Mark, Mutyala,
	Sadanand, Nali, Appa Rao

Hi Nick,


> Added support in gas for mlittle-endian and mbig-endian flags as 
> options.

> Thanks for contributing this patch.  There are a few things however that need to be fixed/tidied up:

>   #define OPTION_EB (OPTION_MD_BASE + 0)
>   #define OPTION_EL (OPTION_MD_BASE + 1)
> +#define OPTION_LITTLE (OPTION_MD_BASE + 2) #define OPTION_BIG 
> +(OPTION_MD_BASE + 3)

> There is no need to have new values for the new options, you can just reuse the existing ones.  ie:

Thank you for the simplification!

> @@ -1854,6 +1856,8 @@ struct option md_longopts[] =
>   {
>     {"EB", no_argument, NULL, OPTION_EB},
>     {"EL", no_argument, NULL, OPTION_EL},
> +  {"mlittle-endian", no_argument, NULL, OPTION_LITTLE},  
> + {"mbig-endian", no_argument, NULL, OPTION_BIG},
>     { NULL,          no_argument, NULL, 0}
>   };

> Change this to:

 >     {"EB", no_argument, NULL, OPTION_EB},
 >     {"EL", no_argument, NULL, OPTION_EL},
 > +  {"mlittle-endian", no_argument, NULL, OPTION_EL},  > +  {"mbig-endian", no_argument, NULL, OPTION_EB},
 >     { NULL,          no_argument, NULL, 0}
 >   };

Changed with v2.

> Then you can also delete:

> @@ -2507,9 +2511,11 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
>     switch (c)
>       {
>       case OPTION_EB:
> +    case OPTION_BIG:
>         target_big_endian = 1;
>         break;
>       case OPTION_EL:
> +    case OPTION_LITTLE:
>         target_big_endian = 0;
>         break;
>       default:

> As this change is no longer needed.

Changed with v2.

> More importantly however, since you are adding new MicroBlaze specific command line options you need to update the gas/doc/as.texi file to mention them (search for "Target MICROBLAZE options") and the gas/doc/c-microblaze.texi file to add a "MicroBlaze Options" node.

As it is my first time modifying .texi files, I hope I did it correctly.  Could you review v2 and let me know what changes need to be made?

Best regards,
Neal Frager
AMD

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

end of thread, other threads:[~2023-09-27 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25 10:12 [PATCH v1 1/1] gas: microblaze: Add mlittle-endian and mbig-endian flags Neal Frager
2023-09-27 14:00 ` Nick Clifton
2023-09-27 14:50   ` Frager, Neal

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