This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[rfa:] [patch:] gas/doc/internals.texi: Caveats with generatingfixups.


Then funny thing is that if you do this wrong (calling fix_new with the
"wrong" frag as described), the error can silently propagate into an
invalid offset for a relocation in an object file.  If CGEN is used, it
expects the target to define a TC_CGEN_MAX_RELAX but it admits in
gas/cgen.c that "having to do this seems like a hack".

Ok to commit?

	* doc/internals.texi (Relaxing with a table) <after relaxation>:
	Point out caveats with generating fixups for the opcode in a frag.

Index: internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.19
diff -p -c -r1.19 internals.texi
*** internals.texi	2000/12/29 18:32:47	1.19
--- internals.texi	2000/12/29 18:42:16
*************** called to convert the frag to an @code{r
*** 1601,1606 ****
--- 1601,1616 ----
  Sometimes changing addressing modes may also require rewriting the instruction.
  It can be accessed via @code{fr_opcode} or @code{fr_fix}.
  
+ If you generate frags separately for the basic insn opcode and any relaxable
+ operands, do not call @code{fix_new} thinking you can emit fixups for the
+ opcode field from the relaxable frag.  It is not garanteed 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.
+ 
  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
  an earlier byte, and @code{fr_subtype} set to @code{rs_machine_dependent} so

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]