This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH H8300] Add function_vector attribute

Hello Jeff,

>> So the fundamental difference is your version of function_vector is 
>> programmer directed.

Yes, programmer will need to assign function vector number manually 
during declaration of the attribute.

>> I think you need to investigate further since functions marked with 
>> the attribute should be called through the function vector.
>> When the linker assigns the slot, the proper syntax is jsr <name>:8

Even I was looking for same. However, when I checked the object dump of
the generated binary it had 'jsr' instruction in absolute addressing format.

Generated assembly was like:
mov.w   r7,r6  
jsr     @_foo  
mov.w   @r7+,r6

And object dump of output file was like:
0d 76           mov.w   r7,r6
5e 00 02 30     jsr     @0x230:24
6d 76           mov.w   @r7+,r6

Do I need to pass any additional command line options during compilation 
to generate 'jsr' in format 'jsr <name>:8'?

>> ISTM that you either need to use a different attribute name or find a 
>> way to make the argument optional.

Because of the 'jsr' generated in absolute addressing format, 
I thought current implementation might be broken and hence I modified it.
However, if current implementation is to be kept as is then I will prefer
making argument passing optional. In that case, I will repost the modified 

Meanwhile, I have modified the previous patch for following two things:
1. Initially I was generating 'jsr' as 'jsr @@vect-number:8'.
However, I found it was not working on hardware. 

H8 programming manuals mention, 'jsr' instruction in memory indirect 
format expects 8-bit absolute address to be encoded in instruction code. 
Hence I modified the patch to generate it as: 
'jsr @@<vect-number x pointer size>:8'.

Now it is working appropriately on hardware.

2. In H8, pointer size is 2 bytes in 'normal' CPU mode and 4 bytes in 
other modes. I modified the patch to vary 'jsr' destination generation 

Thanks and Regards,

Attachment: modified-h8300-func-vect.patch
Description: modified-h8300-func-vect.patch

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