This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Alignment issue between debug and release builds on windows

Hello,

I am storing a structure in the flash of my cortex M0+ MCU.

I have been trying this with gcc 9-2020-q2-update and 8-2019-q3-update (8.3.1) on Windows and the debug build linking fails. Building and linking on linux using gcc 8-2019-q3-update everything works fine.

Linker script:

Stored structure size 22 in the blHeader section

It seems that the aligned(1) attribute is not taken into account in the windows debug build, the section size ends up 24  instead of 22 (so the blHeader section overflows because of those 2 bytes alignment) . I suppose that some flag in the release build fixes that (I use -Os). Though I know that there is no difference in the optimization flags between linux and windows gcc 8.3.1.

So I am a bit stuck by this different behavior and I am not sure where to report it.

0