カーネル再構築時に出たエラー(Kernel 2.6.18) その2

  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
kernel/built-in.o: In function `do_gettimeofday':
(.text+0x23048): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0x23068): undefined reference to `__umoddi3'
kernel/built-in.o: In function `getnstimeofday':
(.text+0x23248): undefined reference to `__umoddi3'
kernel/built-in.o: In function `getnstimeofday':
(.text+0x23269): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_timer':
(.text+0x248e4): undefined reference to `__umoddi3'
kernel/built-in.o: In function `do_timer':
(.text+0x24902): undefined reference to `__udivdi3'
make[1]: *** [.tmp_vmlinux1] エラー 1
make[1]: ディレクトリ `/usr/src/kernel/linux-2.6.18.4' から出ます
make: *** [debian/stamp-build-kernel] エラー 2


調べてみるとどうやらGCC4.3が悪戯しているようで(^^;

ちなみにうちのGCCさん。

supistar@snowdrop:$ gcc -v
...
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11)

ということで、以下のようにMakefileを修正してあげましょう。

修正箇所はだいたい516〜534行目くらいにあります。


Kernel2.6.23以下のバージョンでは以下のように。

 # disable pointer signed / unsigned warnings in gcc 4.0
 CFLAGS += $(call cc-option,-Wno-pointer-sign,)

+ # workaround to avoid gcc 4.3 emitting libgcc calls (see gcc bug #32044)
+ CFLAGS += $(call cc-option,-fno-tree-scev-cprop,)

Kernel2.6.24以上のバージョンでは以下のように。

 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
+# workaround to avoid gcc 4.3 emitting libgcc calls (see gcc bug #32044)
+KBUILD_CFLAGS += $(call cc-option,-fno-tree-scev-cprop,)


やっかいものだな・・・。

参考ページ。thanks!

GCC 4.3 情報

http://d.hatena.ne.jp/pyopyopyo/20071208/p1