https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100357
Sebastian Huber <sebastian.hu...@embedded-brains.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|attribute noinit with |unexpected behaviour of |-fdata-sections unexpected |attribute noinit |behaviour | --- Comment #1 from Sebastian Huber <sebastian.hu...@embedded-brains.de> --- Consider the following test code: __attribute__(( __noinit__ )) int a; __attribute__(( __noinit__ )) int b; On a target with a small data area (e.g. powerpc) this yields: powerpc-rtems6-gcc -O2 -S -o - test.c .file "test.c" .machine ppc .section ".text" .globl B .globl a .section .sbss,"aw",@nobits .align 2 .type B, @object .size B, 4 B: .zero 4 .type a, @object .size a, 4 a: .zero 4 .ident "GCC: (GNU) 10.2.1 20210113 (RTEMS 6, RSB 3d30ecae960152dd5a0e1be55de97dd46486ac53, Newlib 415fdd4)" .section .note.GNU-stack,"",@progbits On arm you get the expected result: arm-rtems6-gcc -O2 -S -o - test.c .cpu arm7tdmi .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 2 .eabi_attribute 30, 2 .eabi_attribute 34, 0 .eabi_attribute 18, 4 .file "test.c" .text .global B .global a .section .noinit,"aw" .align 2 .type B, %object .size B, 4 B: .space 4 .type a, %object .size a, 4 a: .space 4 .ident "GCC: (GNU) 10.2.1 20210113 (RTEMS 6, RSB 3d30ecae960152dd5a0e1be55de97dd46486ac53, Newlib 415fdd4)" However, with -fdata-sections you get: arm-rtems6-gcc -O2 -S -o - test.c -fdata-sections .cpu arm7tdmi .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 2 .eabi_attribute 30, 2 .eabi_attribute 34, 0 .eabi_attribute 18, 4 .file "test.c" .text .global B .global a .section .bss.B,"aw",%nobits .align 2 .type B, %object .size B, 4 B: .space 4 .section .bss.a,"aw",%nobits .align 2 .type a, %object .size a, 4 a: .space 4 .ident "GCC: (GNU) 10.2.1 20210113 (RTEMS 6, RSB 3d30ecae960152dd5a0e1be55de97dd46486ac53, Newlib 415fdd4)"