我試圖用llvm-gcc(llvm版本1.7)來編譯驅動程序(linux/drivers /淨/ zorro8390.c)爲研究目的的Linux內核源代碼(版本2.6.18.8),但我從jiffies.h得到了很多的錯誤:編譯與llvm-gcc驅動程序代碼時得到「錯誤:在#if中除零#」在編譯驅動程序代碼與llvm-gcc
bash-3.2$ llvm-gcc -D__GNUCC -E -I../../include zorro8390.c -o test.o
In file included from ../../include/linux/lockdep.h:12,
from ../../include/linux/spinlock_types.h:12,
from ../../include/linux/spinlock.h:78,
from ../../include/linux/module.h:10,
from zorro8390.c:22:
../../include/linux/list.h:887:2: warning: #warning "don't include kernel headers in userspace"
In file included from zorro8390.c:30:
../../include/linux/jiffies.h:210:31: error: division by zero in #if
../../include/linux/jiffies.h:210:31: error: division by zero in #if
...(a bunch of same errors)
../../include/linux/jiffies.h:432:28: error: division by zero in #if
我上GOOGLE了很多的討論這個錯誤,但很多都是關於用make命令構建內核的。直接使用llvm-gcc時我仍然不知道如何解決它。對此有何建議?非常感謝您的幫助!
丹尼爾