lkml.org 
[lkml]   [2010]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] Show version information for built-in modules in sysfs
    On Tue, Dec 21, 2010 at 05:48:45PM -0800, Rusty Russell wrote:
    > On Wed, 22 Dec 2010 11:47:12 am Dmitry Torokhov wrote:
    > > On Tue, Dec 21, 2010 at 05:02:40PM -0800, Rusty Russell wrote:
    > > > On Thu, 16 Dec 2010 08:30:19 am Dmitry Torokhov wrote:
    > > > > +
    > > > > +#ifdef MODULE
    > > > > #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
    > > > > +#else
    > > > > +#define MODULE_VERSION(_version) \
    > > > > + extern ssize_t __modver_version_show(struct module_attribute *, \
    > > > > + struct module *, char *); \
    > > > > + static struct module_version_attribute __modver_version_attr \
    > > > > + __used \
    > > > > + __attribute__ ((unused,__section__ ("__modver"),aligned(sizeof(void *)))) \
    > > >
    > > > __used and unused seems overkill, and confused.
    > > >
    > >
    > > Must admit that I copied used/unused verbatim from linux/moduleparam.h:
    > >
    > > /* This is the fundamental function for registering boot/module
    > > parameters. */
    > > #define __module_param_call(prefix, name, ops, arg, isbool, perm) \
    > > /* Default value instead of permissions? */ \
    > > static int __param_perm_check_##name __attribute__((unused)) = \
    > > BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
    > > + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \
    > > static const char __param_str_##name[] = prefix #name; \
    > > static struct kernel_param __moduleparam_const __param_##name \
    > > __used \
    > > __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
    > > = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \
    > > { arg } }
    > >
    > >
    > > So should it be removed from here as well?
    >
    > I think so, but (as always!) check git blame.
    >

    Whew, found it:

    commit 4d62364652499ef106d1c0737968a879ef077bd4
    Author: akpm <akpm>
    Date: Tue Jan 20 05:13:24 2004 +0000

    [PATCH] make gcc 3.4 compilation work

    From: David Mosberger <davidm@napali.hpl.hp.com>

    With gcc-3.4 we need "attribute((used))" declarations to get "make
    modules_install" to work.

    Otherwise these sections get dropped from the final image (I assume).

    BKrev: 400cb8f4ByHxZCElstAaZ3mBZ2oflQ

    ...

    diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
    index 0a5becb..cbca007 100644
    --- a/include/linux/moduleparam.h
    +++ b/include/linux/moduleparam.h
    @@ -52,6 +52,7 @@ struct kparam_array
    #define __module_param_call(prefix, name, set, get, arg, perm) \
    static char __param_str_##name[] __initdata = prefix #name; \
    static struct kernel_param const __param_##name \
    + __attribute_used__ \
    __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
    = { __param_str_##name, perm, set, get, arg }

    Since we still claim to support GCC 3.4 I guess __used is still
    needed...

    Thanks,

    Dmitry


    \
     
     \ /
      Last update: 2010-12-23 01:41    [W:0.322 / U:152.920 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site