Toolchains for STM32CubeMX IDE: what to choose from?
I know it's an old post, but this might help others...

Don't confuse toolchain with IDE. You might consider the IDE to be the last link in the toolchain, but a toolchain does not necessarily imply an IDE. Eclipse is an IDE that connects to many different toolchains. In my case (ARM gcc build [linker, compiler, assembler, etc] + automake) is my toolchain.

I don't use an IDE. I take the generated source code from CubeMX and write makefiles to compile it in the manner I choose. The toolchain option in my CubeMX options is TrueStudio because that option generates a nice linker script that I can easily change. This, despite the fact that I don't use (nor intend on using) TrueStudio.

If you want to use gcc, great. But IDE selection is largely an independent choice, unless the IDE you've chosen foists some other compiler on you. If you really want an IDE (IMO, they get in the way more than help), you might have to choose one that mates up with automake (Makefiles) or gcc directly. Eclipse is the only one I know of.

Some compilers have different conventions for handling preprocessor-level constructs (macros, pragmas, conditionals, etc...) but the actual source code won't vary much.