[lkml]   [2018]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] libosd: Remove ignored __weak attribute
On Tue, 2018-10-02 at 15:33 -0700, Nick Desaulniers wrote:
> On Tue, Oct 2, 2018 at 10:57 AM Bart Van Assche <> wrote:
> > Explicitly initialized global and static variables end up in the .data
> > section and need space in that section.
> Unless the initial value is zero.
> So you don't wind up with an increase in binary size simply by having
> global variables initialized to zero, right? Instead the kernel knows
> to create a zero'd out mapping for bss. You don't need a run of zeros
> in the binary.
> So I disagree when you said earlier "zero initializers should be left
> out to minimize the size of object files." I assert they don't affect
> the size of the binary.
> If you had many global variables all initialized to zero, why would
> you encode that many zeros in a binary, when you can just set a size
> on the bss section and have the kernel create the appropriate sized
> and zero'd mapping?
> > That is not the case if the
> > initializer is left out and these variables end up in the .bss section.
> From my above link, gcc will put globals without initializers into "common."

No matter what particular compiler versions do with explicit initialization
to zero, the preferred kernel coding style is to leave out such explicit


 \ /
  Last update: 2018-10-03 01:06    [W:0.103 / U:1.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site