[PATCH 1/3] Fix "noinit" attribute being ignored for -O0 and -fdata-sections

Jeff Law law@redhat.com
Sat Nov 21 15:59:54 GMT 2020



On 11/15/20 3:03 PM, Jozef Lawrynowicz wrote:
> Variables with the "noinit" attribute are ignored at -O0 because they
> are treated like a regular bss variable and placed in the .bss section.
>
> With -fdata-sections they are ignored because they are not handled in
> resolve_unique_section.
>
> Successfully regtested for arm-none-eabi.
>
> Ok for trunk?
>
> 0001-Fix-noinit-attribute-being-ignored-for-O0-and-fdata-.patch
>
> From d501b36fc92f1506427836ded69997cc576beda4 Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> Date: Sun, 15 Nov 2020 21:43:22 +0000
> Subject: [PATCH 1/3] Fix "noinit" attribute being ignored for -O0 and
>  -fdata-sections
>
> Variables with the "noinit" attribute are ignored at -O0 because they
> are treated like a regular bss variable and placed in the .bss section.
>
> With -fdata-sections they are ignored because they are not handled in
> resolve_unique_section.
>
> gcc/ChangeLog:
>
> 	* tree.h (DECL_NOINIT_P): Define.
> 	* varasm.c (DECL_NOINIT_P): Check DECL_NOINIT_P before using
> 	unnamed bss/lcomm sections for bss_initializer variables.
> 	(default_elf_select_section): Use DECL_NOINIT_P instead of
> 	looking up attribute for .noinit section selection.
> 	(default_unique_section): Check DECL_NOINIT_P for .noinit
> 	section selection.
>
> gcc/testsuite/ChangeLog:
>
> 	* gcc.c-torture/execute/noinit-attribute.c: Don't override
> 	optimization options set by torture test harness.
> 	* lib/target-supports.exp (check_effective_target_noinit): Adjust
> 	comment formatting.
OK
jeff



More information about the Gcc-patches mailing list