Re: MIPS: Handle manual calls of MIPS16 functions with a call stub

Daniel Jacobowitz
2008-01-31T22:03:39Z

On Thu, Jan 31, 2008 at 05:57:57PM +0000, Maciej W. Rozycki wrote:
> Hello,
>
> There is a problem with GDB calling some of MIPS16 functions manually.
> It happens when such a function has a call stub (which is needed due to an
> ABI difference when passing floating-point arguments when called from
> standard MIPS code) and DWARF-2 information is available for the function.
> In this case the stub, which is prepended to the function itself, is made
> a part of the function's DWARF-2 subprogram block. The PC range of the
> block is determined by two labels that are put at the beginning and the
> end of the block each. GDB applies the least significant bit (LSB) of the
> start address of a DWARF-2 block to its internal block structure
> associated with a function and uses it to determine whether the function
> is MIPS16 code (when set) or standard MIPS code (if clear).
>
> The bit in the start address is set in the DWARF-2 record by BFD at the
> link time based on the STO_MIPS16 annotation of the symbol at the same
> address in the ELF symbol table. If the start address is the same as the
> regular entry point of the function, which is the case when no call stub
> has been generated for the function in question, then the DWARF-2 record
> gets updated accordingly and the bit is correctly set. However, when the
> call stub indeed is there, the function's entry point is at a different
> location, and the stub's entry point point is standard MIPS code and
> therefore bearing no STO_MIPS16 annotation. In this case the bit in the
> DWARF-2 record remains clear.

Does this mean the DWARF block describes the MIPS16 parts, but the
function's minimal symbol points to the call stub, which is
elsewhere)? Maybe mips_write_pc should use mips_pc_is_mips16; that's
how Thumb works, by always consulting the minimal symbol table to find
out whether an address should be called as MIPS16 or MIPS32.

--
Daniel Jacobowitz
CodeSourcery