On 03/28/2012 09:10 AM, Ajinkya Dhobale wrote:
Ok. So the fundamental difference is your version of function_vector is
programmer directed. ie, the programmer explicitly assigns slots for
functions to call through the function vector.
Thank you for replying to the post.
How is this different than the function vector support that is
already in GCC for the H8/300 series processors?
Current H8/300 implementation of function vector seems inappropriate.
This patch fixes following problems from it.
1. Attribute syntax:
The function vector attribute is expected to accept one argument i.e.
However, with H8/300 target, it does not accept any argument and test case
compilation fails with an error message:
error: wrong number of arguments specified for function_vector attribute
This patch fixes this problem.
The existing implementation relies upon the linker to handle assignment
of a specific slot.
The problem with installing your patch as-is is it will break existing
code which utilizes the linker driven assignment of slots.
ISTM that you either need to use a different attribute name or find a
way to make the argument optional.
I think you need to investigate further since functions marked with the
attribute should be called through the function vector.
2. Addressing mode support:
Currently, even for function vectors, GCC generates instruction 'jsr'
in absolute addressing mode which is incorrect. Instead of that, it should be
generating 'jsr' in indirect memory addressing mode (@@aa:8).
When the linker assigns the slot, the proper syntax is jsr <name>:8
Obviously for the programmer assigned slots, you'll need to use a
different syntax. But simply removing the linker assigned slot support