summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVinícius Tinti <viniciustinti@gmail.com>2017-04-24 13:04:58 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-27 16:07:58 +0100
commitf0ea0fe278c5b87d637be0cae0680b61c183e7bd (patch)
tree8bd3116e7c3deb4a6ec5e7a56a70aa4482e84547 /scripts
parentc8250381e987589874ef68223446a5cbebac1076 (diff)
kbuild: Add support to generate LLVM assembly files
commit 433db3e260bc8134d4a46ddf20b3668937e12556 upstream. Add rules to kbuild in order to generate LLVM assembly files with the .ll extension when using clang. # from c code make CC=clang kernel/pid.ll Signed-off-by: Vinícius Tinti <viniciustinti@gmail.com> Signed-off-by: Behan Webster <behanw@converseincode.com> Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> [nc: Fix conflicts due to lack of commit 6b90bd4ba40b3 in linux-4.4.y] Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 18209917e379..42aef001dfdd 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -175,6 +175,14 @@ cmd_cc_symtypes_c = \
$(obj)/%.symtypes : $(src)/%.c FORCE
$(call cmd,cc_symtypes_c)
+# LLVM assembly
+# Generate .ll files from .c
+quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@
+ cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $<
+
+$(obj)/%.ll: $(src)/%.c FORCE
+ $(call if_changed_dep,cc_ll_c)
+
# C (.c) files
# The C file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)