2010-04-29 08:49:01     bug/problem gcc jumptables and L1-Ram

Document created by Aaronwu Employee on Sep 26, 2013
Version 1Show Document
  • View in full screen mode

2010-04-29 08:49:01     bug/problem gcc jumptables and L1-Ram

Thorsten Pohlmann (GERMANY)

Message: 89034   

 

Hi!

 

If you have a c-function mapped into L1-ram (eg like void func1(void) __attribute__ (l1_text) ) and there is a optimizable switch-statement in it, the compiler builds code that tries to read the jump-offsets out of the instruction-ram. What must fail :-)

 

Adding " -fno-jump-tables" to the compiler cmdline works around it.

 

gcc 4.1.2 (ADI svn), directly from "blackfin-toolchain-uclibc-full-09r1-10.i386.rpm" on a BF537

 

regards, Thorsten

TranslateQuoteReplyEditDelete

 

 

2010-04-29 11:40:28     Re: bug/problem gcc jumptables and L1-Ram

Robin Getz (UNITED STATES)

Message: 89036   

 

Thorsten:

 

The compiler doesn't really know about L1 or not - the attribute is just a command to the linker to put it in the correct section...

 

According to:

 

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes

 

You should be able to add an optimize attribute to things. Strings that begin with O are assumed to be an optimization option, while other options are assumed to be used with a -f prefix. - so that should just turn off that optimization in the L1 function, not the entire object file.

 

If you can test that out, I'll see about making it a default if the L1 attribute is selected.

 

-Robin

QuoteReplyEditDelete

 

 

2010-04-29 13:35:49     Re: bug/problem gcc jumptables and L1-Ram

Mike Frysinger (UNITED STATES)

Message: 89039   

 

this is clearly documented already:

http://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:on-chip_sram

QuoteReplyEditDelete

 

 

2010-04-30 02:18:32     Re: bug/problem gcc jumptables and L1-Ram

Thorsten Pohlmann (GERMANY)

Message: 89049   

 

Hi!

 

Thanks for your suggestion, you are right, it's a attribute for the linker not the compiler.

 

I tried your hint with the optimize-attribute, but it seems that "optimize" is only avaliable in newer gccs than 4.1.2, i get a

 

"warning: 'optimize' attribute directive ignored".

 

regards, Thorsten

TranslateQuoteReplyEditDelete

 

 

2010-04-30 03:10:48     Re: bug/problem gcc jumptables and L1-Ram

Thorsten Pohlmann (GERMANY)

Message: 89050   

 

Hi!

 

Ok, reading the manual helps sometimes :-) But a hint in the docs with some more information about the background would be nice.

 

regards, Thorsten

TranslateQuoteReplyEditDelete

 

 

2010-04-30 09:35:29     Re: bug/problem gcc jumptables and L1-Ram

Mike Frysinger (UNITED STATES)

Message: 89066   

 

the latest release contains a 4.3 compiler ...

 

at any rate, if you posted some example compilable code, we could test it as well

QuoteReplyEditDelete

 

 

2010-05-03 01:54:42     Re: bug/problem gcc jumptables and L1-Ram

Thorsten Pohlmann (GERMANY)

Message: 89087   

 

Hi!

 

This code reproduces the problem. Thanks!

 

regards, Thorsten

 

 

 

typedef enum

 

{

    v1=0,

    v2,

    v3,

    v4,

    v5,

    v6

}v_e;

 

static void func(v_e v) __attribute__ ((l1_text));

static void func(v_e v)

{

    int f = 0;

    switch(v)

    {

        case v1:

        case v2:

             f++;

        break;

      

        case v3:

            f += 3;

        break;

      

        case v4:

            f += 4;

        break;

      

        case v5:

            f += 5;

        break;

      

        case v6:

            f += 6;

        break;

    }

  

    printf("%i\r\n",f);

}

 

int main(int argc, const char*argv[])

{

    func(v1);

    func(v2);

 

    return(0);

 

}

TranslateQuoteReplyEditDelete

 

 

2010-05-10 18:18:31     Re: bug/problem gcc jumptables and L1-Ram

Mike Frysinger (UNITED STATES)

Message: 89295    the optimize attribute was added with gcc-4.4, so we'll have to wait

till the next gcc upgrade to implement that

QuoteReplyEditDelete

Attachments

    Outcomes