Messages in this thread | | | From | Keith Owens <> | Subject | Re: Questions on __initdata | Date | Tue, 06 Dec 2005 15:42:46 +1100 |
| |
On Sun, 4 Dec 2005 15:15:33 +0100, Jean Delvare <khali@linux-fr.org> wrote: >Hi all, > >I've been reading the heading comment of include/linux/init.h to learn >when and how __initdata can be used. Some of the help text doesn't seem >to match my observations, and some of it confused me and could probably >be made clearer. However, I don't feel completely comfortable with this >topic yet and would welcome comments. > >First, the comment goes: > >> /* These macros are used to mark some functions or >> * initialized data (doesn't apply to uninitialized data) >> * as `initialization' functions. The kernel can take this >> * as hint that the function is used only during the initialization >> * phase and free up used memory resources after > >My tests (on i386) seem to suggest that "doesn't apply to uninitialized >data" only holds for non-global variables. Tagging uninitialized global >variables __initdata works, and moves the variables from .bss to .data. >Is it correct? Does it work on all archs? If so, the comment above >needs to be fixed.
gcc version dependent. Older versions of gcc put all uninitialized global variables into .bss, even if there was an attribute like __initdata that tried to use a different section. So we got into the habit of '__initdata variables must be explicitly initialized'. Some platforms are using old versions of gcc where that restriction may still apply.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |