I think I have tracked down the cause of the problem.  It seems that the
extern declaration of __get_frame_address (in iomacros.h) causes the
compiler to assume that it really is an external call.  I assume this
doesn't affect the other builtins as they return void.  By removing this
declaration the correct code is generated, however this isn't really a fix
as the return type is undefined.

Regards

Phil Sambles.


Compiler is gcc-3.4.0 running under cygwin on Windows 2000.
Command line is: msp430-gcc -S test.c

The following code:

#include <iomacros.h>

   void *func1(void)
      {
      return GET_FRAME_ADDR_F();
      }

produces this assembler output:

func1:
.L__FrameSize_func1=0x0
.L__FrameOffset_func1=0x4
        push r5
        push r4
        call #__get_frame_address
        pop r4
        pop r5
        ret

Commenting out line 126 of iomacros.h (extern void
*__get_frame_address(void);) gives the following output:

func1:
.L__FrameSize_func1=0x0
.L__FrameOffset_func1=0x4
        push r5
        push r4
        mov .L__FrameOffset_func1(r1), r15
        pop r4
        pop r5
        ret



Philip Sambles wrote:

> Using gcc-3.4.0, calls to __get_frame_address are generating CALL
> instructions (and therefore undefined symbols at link).  They don't
> seem to be identified as a builtin.
> The other builtins (__bic_sr_irq and __bis_sr_irq) work as expected.
>
> Has anybody got any bright ideas as to where the problem might lie?


Reply via email to