Two minor gcc gotchas

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

While upgrading to newer gcc version, my colleague had to solve two issues. While these are related to the x86-targeted gcc, they are marginally related to AVRs and I believe this post may save some head-scratching if anybody else comes across these issues.

1. This one is strictly C++ and in my belief it may occur on avr-gcc (avr-g++) too: for functions specified as "inline", the compiler issues a separate section, but for each such function it issues another section when debugging is switched on. If there is a large number of such functions (in the order of 10,000 - my colleague used large libraries with such functions), the *assembler* fails with "too many sections" message. If a non-debug build passes, an interim solution is to use -fno-dwarf2-cfi-asm .

2. This one is strictly x86-gcc, but has implications if data are exchanged with avr-gcc-compiled program using common headers to share data structures: there is an alternative method to pack structs (bitfields) for Microsoft compilers compatibility, different from the native gcc method, and some binary distributions of gcc (namely some of the newer MinGW) have it switched on by default. According to the gcc manual, "Currently -m[no-]ms-bitfields is provided for the Microsoft Windows X86 compilers to match the native Microsoft compiler."

JW