[llvmlinux] problem with "make dir/xxx.ll"

Peter Teoh htmldeveloper at gmail.com
Wed Sep 30 16:24:47 UTC 2015


When you enter "make help" you are told that "make dir/xxx.ll" will
generate a LLVM IR assembly listing of the C file.   But this is not the
case, in fact, the xxx.ll that is generated is a assembly listing generated
by objdump of the object file.    So is this going to be fixed?

Furthermore, if you do "make V=1 dir/xxx.ll" you will see that the gcc is
being used, which is shown below (removing lots of intermediate options),
and there is a "-emit-llvm" at the end of it:

  gcc -Wp,-MD,kernel/.workqueue.ll.d  -nostdinc -isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/include -I./arch/x86/include
-Iarch/x86/include/generated/uapi -Iarch/x86/include/generated  -Iinclude
-I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi
-I./include/uapi -Iinclude/generated/uapi -include
./include/linux/kconfig.h -D__KERNEL__ {SNIP-SNIP-SNIP} -emit-llvm -S -o
kernel/workqueue.ll kernel/workqueue.c

Of course if change gcc to "clang", the bitcode MAY SOMETIMES be generated,
and sometimes NOT, depending on error.    For kernel/workqueue.c itself
these are the errors:

kernel/workqueue.c:285:1: error: expected ';' after top level declarator
include/linux/moduleparam.h:147:2: note: expanded from macro
'module_param_named'
        module_param_cb(name, &param_ops_##type, &value, perm);            \
        ^
include/linux/moduleparam.h:167:22: note: expanded from macro
'module_param_cb'
        __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1,
0)
                            ^
include/linux/moduleparam.h:13:44: note: expanded from macro
'MODULE_PARAM_PREFIX'
#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
                                           ^
kernel/workqueue.c:289:1: error: use of undeclared identifier
'KBUILD_MODNAME'
module_param_named(power_efficient, wq_power_efficient, bool, 0444);
^
include/linux/moduleparam.h:147:2: note: expanded from macro
'module_param_named'
        module_param_cb(name, &param_ops_##type, &value, perm);            \
        ^
include/linux/moduleparam.h:167:22: note: expanded from macro
'module_param_cb'
        __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1,
0)
                            ^
include/linux/moduleparam.h:13:29: note: expanded from macro
'MODULE_PARAM_PREFIX'
#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
                            ^
kernel/workqueue.c:289:1: error: expected ';' after top level declarator
include/linux/moduleparam.h:147:2: note: expanded from macro
'module_param_named'
        module_param_cb(name, &param_ops_##type, &value, perm);            \


-- 
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/llvmlinux/attachments/20151001/e42b158a/attachment.html>


More information about the LLVMLinux mailing list