Re: [PATCH 2/2] powerpc: make 'boot_text_mapped' static

From: Segher Boessenkool
Date: Fri Apr 09 2021 - 08:05:50 EST


Hi!

On Thu, Apr 08, 2021 at 07:04:35AM +0200, Christophe Leroy wrote:
> Le 08/04/2021 à 03:18, Yu Kuai a écrit :
> >-int boot_text_mapped __force_data = 0;
> >+static int boot_text_mapped __force_data;
>
> Are you sure the initialisation to 0 can be removed ? Usually
> initialisation to 0 is not needed because not initialised variables go in
> the BSS section which is zeroed at startup. But here the variable is
> flagged with __force_data so it is not going in the BSS section.

Any non-automatic (i.e. function-scope, not static) variable is
initialised to 0. See e.g. C11 6.7.9/10 (this has been like that since
times immemorial, C90 anyway).


Segher