public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] gas/write: extend fx_pcrel_adjust to 16 bits
@ 2022-05-11 17:59 Dmitry Selyutin
  2022-05-11 18:13 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Selyutin @ 2022-05-11 17:59 UTC (permalink / raw)
  To: binutils; +Cc: gdb-patches, Alan Modra, Luke Kenneth Casson Leighton

PowerPC code stores operand index into fx_pcrel_adjust field of fix
struct. Once count of PowerPC operands exceeds an 8-bit integer, the
code won't be able to store operand index anymore.
This patch extends the aforementioned field to 16 bits, exactly like
the ppc_opindex_t type; the missing 8 bits are taken from the fx_unused
field.
---
 gas/write.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gas/write.h b/gas/write.h
index 501bdd828f..e31a0f5955 100644
--- a/gas/write.h
+++ b/gas/write.h
@@ -73,10 +73,10 @@ struct fix
   unsigned fx_tcbit2 : 1;

   /* Spare bits.  */
-  unsigned fx_unused : 10;
+  unsigned fx_unused : 2;

   /* pc-relative offset adjust (only used by some CPU specific code) */
-  int fx_pcrel_adjust : 8;
+  int fx_pcrel_adjust : 16;

   /* How many bytes are involved? */
   unsigned fx_size : 8;
--
2.36.0

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

* Re: [PATCH 2/2] gas/write: extend fx_pcrel_adjust to 16 bits
  2022-05-11 17:59 [PATCH 2/2] gas/write: extend fx_pcrel_adjust to 16 bits Dmitry Selyutin
@ 2022-05-11 18:13 ` Andreas Schwab
  2022-05-12  7:47   ` Dmitry Selyutin
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2022-05-11 18:13 UTC (permalink / raw)
  To: Dmitry Selyutin via Binutils
  Cc: Dmitry Selyutin, Luke Kenneth Casson Leighton, gdb-patches

On Mai 11 2022, Dmitry Selyutin via Binutils wrote:

> diff --git a/gas/write.h b/gas/write.h
> index 501bdd828f..e31a0f5955 100644
> --- a/gas/write.h
> +++ b/gas/write.h
> @@ -73,10 +73,10 @@ struct fix
>    unsigned fx_tcbit2 : 1;
>
>    /* Spare bits.  */
> -  unsigned fx_unused : 10;
> +  unsigned fx_unused : 2;
>
>    /* pc-relative offset adjust (only used by some CPU specific code) */
> -  int fx_pcrel_adjust : 8;
> +  int fx_pcrel_adjust : 16;
>
>    /* How many bytes are involved? */
>    unsigned fx_size : 8;

It's probably better to swap the fx_size and fx_pcrel_adjust fields, so
that fx_pcrel_adjust is aligned on a 16 bit boundary.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: [PATCH 2/2] gas/write: extend fx_pcrel_adjust to 16 bits
  2022-05-11 18:13 ` Andreas Schwab
@ 2022-05-12  7:47   ` Dmitry Selyutin
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Selyutin @ 2022-05-12  7:47 UTC (permalink / raw)
  To: Andreas Schwab, binutils; +Cc: Luke Kenneth Casson Leighton, gdb-patches

On Wed, May 11, 2022 at 9:13 PM Andreas Schwab <schwab@linux-m68k.org> wrote:
> It's probably better to swap the fx_size and fx_pcrel_adjust fields, so
> that fx_pcrel_adjust is aligned on a 16 bit boundary.

Thank you for your suggestion! After thinking about it for a while, I
suggest moving the fx_pcrel_adjust (16 bits) field to the top, then
putting fx_size (8 bits), then the rest.
Also, I'd replace `unsigned fx_unused : 2` with a simple `unsigned :
2`, I think this way we can make it even clearer that these bits are
spare. But perhaps this should go as a separate change.

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

end of thread, other threads:[~2022-05-12  7:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 17:59 [PATCH 2/2] gas/write: extend fx_pcrel_adjust to 16 bits Dmitry Selyutin
2022-05-11 18:13 ` Andreas Schwab
2022-05-12  7:47   ` Dmitry Selyutin

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