[gas,documentation] Describe handling of opcodes for relaxation a bit better

Message ID baf3b8d6-a257-7bc7-5dfa-2a8f578c2c93@netcologne.de
State Accepted
Headers
Series [gas,documentation] Describe handling of opcodes for relaxation a bit better |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Thomas Koenig April 16, 2023, 7:47 p.m. UTC
  Hi,

here's a patch for the documentation that I wish had been in there
before I started looking at this :-) I've also left in the original
advice, although that is much more complex than what I found in
the ports mentioned in the patch.

I've tested this patch with "texi2pdf internals.texi" and
"makeinfo internals.texi" (not sure how to convince the
build script to generate the file).

OK?  And if this (or a modified version) is OK, could somebody
commit this for me?

Best regards

	Thomas
  

Comments

Nick Clifton April 18, 2023, 10:23 a.m. UTC | #1
Hi Thomas,

> here's a patch for the documentation that I wish had been in there
> before I started looking at this :-) I've also left in the original
> advice, although that is much more complex than what I found in
> the ports mentioned in the patch.

Thanks very much.  I have applied your patch to the sources.

Cheers
   Nick
  

Patch

diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi
index cb568d6edfd..aecf3a08718 100644
--- a/gas/doc/internals.texi
+++ b/gas/doc/internals.texi
@@ -1824,9 +1824,11 @@  opcode field from the relaxable frag.  It is not guaranteed to be the same frag.
 If you need to emit fixups for the opcode field from inspection of the
 relaxable frag, then you need to generate a common frag for both the basic
 opcode and relaxable fields, or you need to provide the frag for the opcode to
-pass to @code{fix_new}.  The latter can be done for example by defining
-@code{TC_FRAG_TYPE} to include a pointer to it and defining @code{TC_FRAG_INIT}
-to set the pointer.
+pass to @code{fix_new}.  The latter can be done by passing a pointer to the
+opcode in the call to @code{frag_var} or @code{frag_variant}, and accessing
+it via @code{fr_opcode}.  See the @file{tc-vax.c}  and @file{tc-m68k.c} for
+examples. It is also possible for  @code{TC_FRAG_TYPE} to include a pointer to
+the opcode and defining @code{TC_FRAG_INIT} to set the pointer.
 
 Sometimes @code{fr_var} is increased instead, and @code{frag_wane} is not
 called.  I'm not sure, but I think this is to keep @code{fr_fix} referring to