This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Section attribute ignored; why?

Hi,

I'm trying to make use of the 'section' attribute with v7.3.2 of the codegen tools. I've read the GCC documentation linked to from the compiler UG (http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Variable-Attributes.html#Variable-Attributes) but even a simple case (which appears to be compliant with the GCC documentation) such as:

int a[10] __attribute__ ((section("testSect"))) = {0};

results in:

"main.c", line 98: warning: attribute "section" ignored

What am I missing in trying to make use of this attribute?

Thanks,

SPH

  • Try to add extra "#" at the end of the section name:

    int a[10] __attribute__ ((section("testSect#"))) = {0};

    Also, you may try to get assembler source to check by adding "-S" argument to the gcc. Try to get object file ("-c" option) and then inspect it with objdump.

  • Anton,

    I gave this a go and it made no difference; I still got the warning. I checked the assembler output and it appears that the compiler is true to its word: the section attribute has been ignored and the variable 'a' has been put in ".fardata:a".

    Thanks,

    SPH

  • Could you please provide a complete compiler's command invocation?

    What compiler version do you use (option "-v")?

  • Anton Kachalov said:

    Could you please provide a complete compiler's command invocation?

    cl6x -qq -O3 -mi200 -mv6455 -mt -mw -oi -pdr <Lots of -I options> <Lots of -D options> --abi=eabi -k -fr <Tmp dir> -fs <Tmp dir> -ft <Tmp dir> main.c

    Anton Kachalov said:

    What compiler version do you use (option "-v")?

    '-v' doesn't appear to be a valid option but '-h' only gives the version of the cgtools that I stated in my opening mail:

    C:\BuildTools\ti_cgtools_v7_3\A\bin>cl6x -v
    >> WARNING: invalid compiler option -v (ignored)
    >> ERROR: no source files, nothing to do

    C:\BuildTools\ti_cgtools_v7_3\A\bin>cl6x -h
    TMS320C6x C/C++ Compiler                v7.3.2
    Tools Copyright (c) 1996-2011 Texas Instruments Incorporated

    Do you need a more accurate build number?

    Cheers,

    SPH

  • Try to add "--gcc" option to the cl6x to enable GCC C language extensions.

  • Thanks, this did the trick. I was already using the aligned attribute without it so I wrongly assumed that all attributes were supported without it. It is a shame that I can't have attributes without the other GCC extensions (for portability reasons) but at least this fixed my problem. Ta!

    SPH