I encountered this exact issue after creating my own CMake project using "-O0" optimization for my Debug build, and wasted time figuring out what was wrong (thank you, @greenwichmeanie for posting this topic, which saved me some time in confirming that the issue lies in the optimization level!). It appears that the issue may be related to the implementation of the "#pragma GCC section" patches NXP applies to GCC and how they behave with different optimization levels.
@VaneB: Above, you claim,
Additionally, each RTD release note specifies the optimization level used during development and testing; most RTD releases have been validated with -Os/-Osize.
While I understand you can't feasibly test and validate every possible combination of compilation flags, I believe it is reasonable to expect to be able to build and debug with no optimization (-O0). Being forced to debug a binary compiled with -Os is challenging, as the compiler inlines many functions and reorders code. I would appreciate it if you could pass on a request to support compiling with the "-O0" optimization level.