0

I am having a problem,

ARM GNU GCC is trying to 'zero' the .bss section , I dont want it to do it as my startup code is doing it already. Due to this the final image size is increased by the bss size filled with zero's .

I am already using NOLOAD in the linker script for bss section and -fno-zero-initialized-in-bss as part of CFLAGS for gcc.

How do I tell ARM GNU GCC not to zero out that section ?Am I missing something?

user2807984
  • 23
  • 2
  • 7

1 Answers1

0

Here is the answer directly from ARM: How to prevent uninitialized data from being initialized to zero

You can prevent uninitialized data from being initialized to zero by placing that data in a different section. This can be achieved using #pragma arm section, or with the GNU compiler extension attribute((section("name"))).

#pragma arm section zidata = “non_initialized”
int i, j; // uninitialized data in non_initialized section (without the pragma, would be in .bss section by default)
#pragma arm section zidata // back to default (.bss section)
int k = 0, l = 0; // zero-initialized data in .bss section
fukanchik
  • 2,811
  • 24
  • 29