Chinaunix首页 | 论坛 | 博客
  • 博客访问: 55133
  • 博文数量: 19
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 177
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-25 21:11
文章分类

全部博文(19)

文章存档

2011年(1)

2009年(18)

我的朋友

分类: LINUX

2009-04-12 20:31:34

前几天刚装上号称能与windows相媲美的openSUSE11.1。openSUSE的桌面的确挺漂亮的,使用起来有种舒适的感觉。系统上的Pidgin还可以上qq。由于学习的需要,我下载2.6.23内核,并给内核打上rtai-3.6.2的实时补丁。然后make menuconfig, make编译内核。但是在编译的过程中出现了这样的错误:
kernel/built-in.o: In function `timespec_add_ns':
/home/wbs/source/linux/include/linux/time.h:174: undefined reference to `__udivdi3'
/home/wbs/source/linux/include/linux/time.h:179: undefined reference to `__umoddi3'
/home/wbs/source/linux/include/linux/time.h:174: undefined reference to `__udivdi3'
/home/wbs/source/linux/include/linux/time.h:179: undefined reference to `__umoddi3'
/home/wbs/source/linux/include/linux/time.h:174: undefined reference to `__udivdi3'
/home/wbs/source/linux/include/linux/time.h:179: undefined reference to `__umoddi3'
make: *** [.tmp_vmlinux1] 错误 1

在网上搜了一下,据说是gcc的问题。因为系统使用的是gcc4.3,gcc4.3据说不能编译内核。因为它会用到libgcc未定义的函数。现在有两种解决方案。
一种是:
QUOTE:static inline void timespec_add_ns(struct timespec *a, u64 ns)
{
        ns += a->tv_nsec;
        while(unlikely(ns >= NSEC_PER_SEC)) {
+               /* The following asm() prevents the compiler from
+                * optimising this loop into a modulo operation.  */
+               asm("" : "+r"(ns));
+
                ns -= NSEC_PER_SEC;
                a->tv_sec++;
        }
在原先include/linux/time.h中的该函数中增加:asm("" : "+r"(ns));用来防止编译器对while循环进行优化。
另一种解决方法是:
QUOTE:edit kernel Makefile
add to KBUILD_CFLAGS -fno-tree-scev-cprop

QUOTE:Linux 2.6 tree as of this minute doesn't compile with gcc 4.3 trunk. You need
to add -fno-tree-scev-cprop to the KBUILD_CFLAGS, but this is not upstreamed
yet and I am not sure if it'll be accepted in case it results in a performance
regression.

即在Makefile中的CFLAGS中添加-fno-tree-scev-cprop 即可。
阅读(965) | 评论(0) | 转发(0) |
0

上一篇:per-CPU variables

下一篇:bash执行权限问题

给主人留下些什么吧!~~