WARNING: modpost: Found 1 section mismatch(es).

对于已经可以正常编译的内核linux-2.6.28.4,在加了自己写的一个rtc驱动后,再编译,出现warning:

make ARCH=arm; make ARCH=arm uImage

.......

WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'

感觉有问题,但是实际测试结果,驱动也是可以正常工作的。

【解决过程】

1。至今未找到根本原因是啥。去掉那个rtc驱动,再编译,就是正常的,加上它,编译就出现上述警告。

2.这里:

说,在make的时候,加上参数CONFIG_DEBUG_SECTION_MISMATCH=y',然后应该可以看到具体错在哪里,是哪里mismatch了。

自己去试了下:

make ARCH=arm CONFIG_DEBUG_SECTION_MISMATCH=y

然后,导致整个kernel都要重新编译。。。漫长的等待啊。。。。

最后编译过程中,输出了对应的错误原因:

LD      drivers/rtc/built-in.o
WARNING: drivers/rtc/built-in.o(.data+0xe4): Section mismatch in reference from the variable as353x_rtc to the function .devexit.text:as353x_rtc_remove()
The variable as353x_rtc references
the function __devexit as353x_rtc_remove()
If the reference is valid then annotate the
variable with __exit* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

去看了下代码,具体涉及的代码为:

static int __devexit as353x_rtc_remove(struct platform_device *pdev)
{
。。。
}

static struct platform_driver as353x_rtc ={
.probe = as353x_rtc_probe,
.remove = __devexit_p(as353x_rtc_remove),
.driver = {
   .name ="as353x-rtc",
   .owner = THIS_MODULE,
},
};
意思就是,一个正常的变量as353x_rtc,去引用了as353x_rtc_remove函数,而这个函数是前面加了__devexit 修饰,即此驱动模块卸载的时候,就释放其内存占用,就不存在的函数,因此觉得mismatch,不匹配,其建议我们应该在这个变量as353x_rtc前面加上对应的修饰,比如__exit。

其说得,听起来,很在理,但是问题在于,我去搜索了一下内核的其他驱动模块,N多的驱动,都是这种做法,但是都是编译正常,没有警告的,为何只有我这个rtc驱动,对此提出了警告,说是mismatch了呢?很是不解。。。

 

__devexit可以换成__devinit 这是一个办法

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值