Thread (12 messages) flat view 12 messages, 3 authors, 2012-08-08

Re: [PATCH] net: force dst_default_metrics to const section

From: Eric Dumazet <hidden>
Date: 2012-08-07 22:10:04

On Tue, 2012-08-07 at 14:55 -0700, David Miller wrote:
From: Ben Hutchings <redacted>
Date: Tue, 7 Aug 2012 21:15:27 +0100
quoted
Some day the compiler may be smart enough to ignore the different
between explicit and implicit zero-initialisation, and put it back in
BSS.  Declaring this __cache_aligned_in_smp might be a better option.
I'm surprised it doesn't already do this.

It definitely puts scalar explicit zero initializers into the BSS.
Not a const :


# cat try.c
const int scalar_value = 0;
const int scalar_value_bss;
int scalar_value = 0;
int scalar_value_bss;
main(int argc, char *argv[])
{
return 0;
}
# gcc -o try try.c && nm -v try|grep scalar_value
00000000004005cc R cscalar_value
0000000000601028 B scalar_value
000000000060102c B scalar_value_bss
0000000000601030 B cscalar_value_bss


gcc 4.6.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help