ARM GNU GCC doesn't support section pragmas

for ARMClang toolchain in ARM DS, it support section pragmas in the following format.

#pragma clang section bss = ".uncached_bss" data = ".uncached_data"
int test= 0;

int test2= 0;
#pragma clang section bss="" data="" text=""

however, it seems that ARM GNU toolchain doesn' support this similar feature, in deed, gcc support through attribute , for example,
int __attribute__((__section__(".uncached_bss"))) test= 0 ;

int __attribute__((__section__(".uncached_bss"))) test2= 0 ;

without section pragma,  programmer must add attributes for the variables one by one.

so I advise ARM GNU toolchain to add simlilar support.

Best Regards,
Zhang Shiping.

Parents
  • Hi there, some other, more conventional ideas that could result in code that is portable between GCC and Clang:

    Depending on your compiler options (-ffunction-sections, -fdata-sections, enabled), the variables will be put into sections with a predictable name, e.g. .data.test1  .data.test2. You could then catch those names in your linker script similar to TuAFBogey's thread and, since you can predict the names, you can use a wilcard like:


    SECTIONS
    {
    ...
    .uncached_bss <address for them> : { <filename.o>(.data.test*) }
    ...
    }

    Or even simpler if you have them in their own file:

    SECTIONS
    {
    ...
    .uncached_bss <address for them> : { my-file-with-only-uncached-bss-definitions.o>(*) }
    ...
    }

Reply
  • Hi there, some other, more conventional ideas that could result in code that is portable between GCC and Clang:

    Depending on your compiler options (-ffunction-sections, -fdata-sections, enabled), the variables will be put into sections with a predictable name, e.g. .data.test1  .data.test2. You could then catch those names in your linker script similar to TuAFBogey's thread and, since you can predict the names, you can use a wilcard like:


    SECTIONS
    {
    ...
    .uncached_bss <address for them> : { <filename.o>(.data.test*) }
    ...
    }

    Or even simpler if you have them in their own file:

    SECTIONS
    {
    ...
    .uncached_bss <address for them> : { my-file-with-only-uncached-bss-definitions.o>(*) }
    ...
    }

Children