All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Kaiser <nikai@nikai.net>
To: "Carlos Manuel Duclos Vergara"@redhat.com, carlos@embedded.cl
Cc: kernel-janitors@lists.osdl.org, dm-devel@redhat.com
Subject: Re: [KJ] [PATCH] dm: uninitialize static variables
Date: Mon, 5 Dec 2005 19:00:29 +0100	[thread overview]
Message-ID: <20051205190029.4b29e759@lucky.kitzblitz> (raw)
In-Reply-To: <50993.206.49.219.34.1133786860.squirrel@webmail.embedded.cl>

* "Carlos Manuel Duclos Vergara" <carlos@embedded.cl>:
> > uninitialize static variables initialized to 0, to make them go
> > to .bss instead of .data.
> >
> 
> if you want that why not explicitely put them in .bss?
> something like:
> 
> > -static unsigned int major = 0;
> > +static unsigned int major; /* = 0 */
> 
> static unsigned int major = 0 __attribute__ ((section(".bss"));

I personally like the idea of explicitly expressing this intention,
but I didn't manage to achieve this together with initialization.
I tried

 static unsigned int __attribute__((__section__(".bss"))) major = 0;
 static unsigned int __attribute__((__section__(".bss"))) _major = 0;

but they appear not to end up in .bss nevertheless, compared with the
uninitialized version:

--- dm-mod.ko1.txt      2005-12-05 18:40:00.000000000 +0100
+++ dm-mod.ko2.txt      2005-12-05 18:39:52.000000000 +0100
@@ -27,7 +27,7 @@
 [22] .rel.init.data       REL          00000000 00b174 000028  8       29  21  4
 [23] .gnu.linkonce.this_module PROGBITS     00000000 0087c0 000160  0 WA     0   0 32
 [24] .rel.gnu.linkonce.this_module REL          00000000 00b19c 000010  8       29  23  4
-[25] .bss                 NOBITS       00000000 008920 00049c  0 WA     0   0 32
+[25] .bss                 NOBITS       00000000 008920 000498  0 WA     0   0 32
 [26] .comment             PROGBITS     00000000 008920 00022e  0        0   0  1
 [27] .note.GNU-stack      PROGBITS     00000000 008b4e 000000  0        0   0  1
 [28] .shstrtab            STRTAB       00000000 008b4e 00011e  0        0   0  1

If you could tell me how to achieve this in a fancy way which also works,
I'm all ears. Maybe the janitorial steering committee might also like the
idea enough to adjust their current TODO list.
( http://janitor.kernelnewbies.org/TODO - 10th task in 6th section)

Cheers,
n.

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Kaiser <nikai@nikai.net>
To: "Carlos Manuel Duclos Vergara"@redhat.com, carlos@embedded.cl
Cc: kernel-janitors@lists.osdl.org, dm-devel@redhat.com
Subject: Re: [KJ] [PATCH] dm: uninitialize static variables
Date: Mon, 05 Dec 2005 17:49:22 +0000	[thread overview]
Message-ID: <20051205190029.4b29e759@lucky.kitzblitz> (raw)
In-Reply-To: <50993.206.49.219.34.1133786860.squirrel@webmail.embedded.cl>

[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]

* "Carlos Manuel Duclos Vergara" <carlos@embedded.cl>:
> > uninitialize static variables initialized to 0, to make them go
> > to .bss instead of .data.
> >
> 
> if you want that why not explicitely put them in .bss?
> something like:
> 
> > -static unsigned int major = 0;
> > +static unsigned int major; /* = 0 */
> 
> static unsigned int major = 0 __attribute__ ((section(".bss"));

I personally like the idea of explicitly expressing this intention,
but I didn't manage to achieve this together with initialization.
I tried

 static unsigned int __attribute__((__section__(".bss"))) major = 0;
 static unsigned int __attribute__((__section__(".bss"))) _major = 0;

but they appear not to end up in .bss nevertheless, compared with the
uninitialized version:

--- dm-mod.ko1.txt      2005-12-05 18:40:00.000000000 +0100
+++ dm-mod.ko2.txt      2005-12-05 18:39:52.000000000 +0100
@@ -27,7 +27,7 @@
 [22] .rel.init.data       REL          00000000 00b174 000028  8       29  21  4
 [23] .gnu.linkonce.this_module PROGBITS     00000000 0087c0 000160  0 WA     0   0 32
 [24] .rel.gnu.linkonce.this_module REL          00000000 00b19c 000010  8       29  23  4
-[25] .bss                 NOBITS       00000000 008920 00049c  0 WA     0   0 32
+[25] .bss                 NOBITS       00000000 008920 000498  0 WA     0   0 32
 [26] .comment             PROGBITS     00000000 008920 00022e  0        0   0  1
 [27] .note.GNU-stack      PROGBITS     00000000 008b4e 000000  0        0   0  1
 [28] .shstrtab            STRTAB       00000000 008b4e 00011e  0        0   0  1

If you could tell me how to achieve this in a fancy way which also works,
I'm all ears. Maybe the janitorial steering committee might also like the
idea enough to adjust their current TODO list.
( http://janitor.kernelnewbies.org/TODO - 10th task in 6th section)

Cheers,
n.

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  reply	other threads:[~2005-12-05 18:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05 12:28 [KJ] [PATCH] dm: uninitialize static variables Nicolas Kaiser
2005-12-05 12:28 ` Nicolas Kaiser
2005-12-05 12:47 ` Carlos Manuel Duclos Vergara
2005-12-05 12:47   ` Carlos Manuel Duclos Vergara
2005-12-05 17:49   ` Nicolas Kaiser [this message]
2005-12-05 18:00     ` Nicolas Kaiser
2005-12-05 18:06     ` Carlos Manuel Duclos Vergara
2005-12-05 18:06       ` Carlos Manuel Duclos Vergara
2005-12-10 15:35     ` Alexey Dobriyan
2005-12-10 15:35       ` Alexey Dobriyan
2005-12-12  7:17     ` Jaco Kroon
2005-12-12  7:17       ` Jaco Kroon
2005-12-10 15:31 ` Alexey Dobriyan
2005-12-10 15:31   ` Alexey Dobriyan
2005-12-10 19:32   ` [KJ] [PATCH] dm: uninitialize static variables v2 Nicolas Kaiser
2005-12-10 19:32     ` Nicolas Kaiser
2005-12-13 16:52 ` [KJ] [PATCH] dm: uninitialize static variables Jesse Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051205190029.4b29e759@lucky.kitzblitz \
    --to=nikai@nikai.net \
    --cc="Carlos Manuel Duclos Vergara"@redhat.com \
    --cc=carlos@embedded.cl \
    --cc=dm-devel@redhat.com \
    --cc=kernel-janitors@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.