[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2 General relaxing

If using a simple table is not suitable, you may implement arbitrarily complex relaxation semantics yourself. For example, the MIPS backend uses this to emit different instruction sequences depending upon the size of the symbol being accessed.

When you assemble an instruction that may need relaxation, you should allocate a frag using frag_var or frag_variant with a type of rs_machine_dependent. You should store some sort of information in the fr_subtype field so that you can figure out what to do with the frag later.

When GAS reaches the end of the input file, it will look through the frags and work out their final sizes.

GAS will first call md_estimate_size_before_relax on each rs_machine_dependent frag. This function must return an estimated size for the frag.

GAS will then loop over the frags, calling md_relax_frag on each rs_machine_dependent frag. This function should return the change in size of the frag. GAS will keep looping over the frags until none of the frags changes size.



This document was generated by system on December, 2 2004 using texi2html