Search code examples
gccmemory-managementlinkerarmembedded

variable attributes changes between GCC versions - "nobits"


I was using an older version of GCC (version 6.3.0) for my project - arm processor. I then moved to a newer version (version 10.2.1 20201103) - arm processor.

when I wanted that a specific section will only be a "space holder", for working memory, for example, I used an attribute

__attribute__((section(".sctionName,\"aw\",@nobits#")))

when using the new GCC version I get an error:

Error: junk at end of line, first unrecognized character is `,'

is there an option to do this in the new GCC version?


Solution

  • The section attribute syntax has not changed between gcc 6 and gcc 10. The parameter for section is just the section name; the ,\"aw\",@nobits# part appears to be a "dirty-trick" (according to What does the "aw" flag in the section attribute mean?) to inject qualifiers into the generated assembler code. However gcc 10 is clearly checking for valid section names where gcc 6 allowed any old text and simply inserted it into the code.

    You perhaps need a more "official" means of defining the behaviour of the section. Through the linker script perhaps?