Re: [PATCH] kbuild: add support to generate LLVM bitcode files
> > Sure. But in fact I was not able to create the .ll from .S and neither > create the .s > from the .S in some assembly files on kernel. Do you know how it works? make arch/x86/kernel/preempt.s Works for me. Something broke in your setup? Sam -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
1) Can we drop the test for $(COMPILER) here? Yes. 2) And help section should be updated to list .ll too. I will be adding it too. 3) This chunk belongs together with the other chunk. There is no reason to separate .S => .ll and .c => .ll rules. Sure. But in fact I was not able to create the .ll from .S and neither create the .s from the .S in some assembly files on kernel. Do you know how it works? 4) Also $(DISABLE_LTO) looks like a left-over. Remove $(DISABLE_LTO) 5) quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ cmd_cc_ll_c = $(CC) $(c_flags) Understood. Thanks. On Sun, Jul 20, 2014 at 6:30 PM, Sam Ravnborg wrote: > On Sun, Jul 20, 2014 at 11:04:58PM +0200, Sam Ravnborg wrote: >> > > >> > > +ifeq ($(COMPILER),clang) >> > > +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ >> > > +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm >> > > -emit-llvm -S -o $@ $< >> > >> > Can we drop the test for COMPILER here too? >> > Do -fverbose-asm make sense when generating .ll files? >> > It looks like a leftover from what you copied. >> >> Also $(DISABLE_LTO) looks like a left-over. >> It was added to avoid LTO when generating asm-offstes.s which >> the original rule is also used for. >> So this should be skipped too. > Third thing. > In some places we indent the assignmnet like this: > quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ > cmd_cc_ll_c = $(CC) $(c_flags) > > This makes it more obvious that the "cmd_cc_ll_c" is actually the same. > Makefile.build does not do this much but please do for these targets. > > Sam -- Simplicity is the ultimate sophistication -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
1) Can we drop the test for $(COMPILER) here? Yes. 2) And help section should be updated to list .ll too. I will be adding it too. 3) This chunk belongs together with the other chunk. There is no reason to separate .S = .ll and .c = .ll rules. Sure. But in fact I was not able to create the .ll from .S and neither create the .s from the .S in some assembly files on kernel. Do you know how it works? 4) Also $(DISABLE_LTO) looks like a left-over. Remove $(DISABLE_LTO) 5) quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ cmd_cc_ll_c = $(CC) $(c_flags) Understood. Thanks. On Sun, Jul 20, 2014 at 6:30 PM, Sam Ravnborg s...@ravnborg.org wrote: On Sun, Jul 20, 2014 at 11:04:58PM +0200, Sam Ravnborg wrote: +ifeq ($(COMPILER),clang) +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -emit-llvm -S -o $@ $ Can we drop the test for COMPILER here too? Do -fverbose-asm make sense when generating .ll files? It looks like a leftover from what you copied. Also $(DISABLE_LTO) looks like a left-over. It was added to avoid LTO when generating asm-offstes.s which the original rule is also used for. So this should be skipped too. Third thing. In some places we indent the assignmnet like this: quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ cmd_cc_ll_c = $(CC) $(c_flags) This makes it more obvious that the cmd_cc_ll_c is actually the same. Makefile.build does not do this much but please do for these targets. Sam -- Simplicity is the ultimate sophistication -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
Sure. But in fact I was not able to create the .ll from .S and neither create the .s from the .S in some assembly files on kernel. Do you know how it works? make arch/x86/kernel/preempt.s Works for me. Something broke in your setup? Sam -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
On Sun, Jul 20, 2014 at 11:04:58PM +0200, Sam Ravnborg wrote: > > > > > > +ifeq ($(COMPILER),clang) > > > +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ > > > +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm > > > -emit-llvm -S -o $@ $< > > > > Can we drop the test for COMPILER here too? > > Do -fverbose-asm make sense when generating .ll files? > > It looks like a leftover from what you copied. > > Also $(DISABLE_LTO) looks like a left-over. > It was added to avoid LTO when generating asm-offstes.s which > the original rule is also used for. > So this should be skipped too. Third thing. In some places we indent the assignmnet like this: quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ cmd_cc_ll_c = $(CC) $(c_flags) This makes it more obvious that the "cmd_cc_ll_c" is actually the same. Makefile.build does not do this much but please do for these targets. Sam -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
> > > > +ifeq ($(COMPILER),clang) > > +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ > > +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm > > -emit-llvm -S -o $@ $< > > Can we drop the test for COMPILER here too? > Do -fverbose-asm make sense when generating .ll files? > It looks like a leftover from what you copied. Also $(DISABLE_LTO) looks like a left-over. It was added to avoid LTO when generating asm-offstes.s which the original rule is also used for. So this should be skipped too. Sam -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
On Fri, Jul 18, 2014 at 10:34:37PM -0300, Vinícius Tinti wrote: > Allows kbuild to generate LLVM bitcode files with the .ll extension when > building with Clang. > > # c code > CC=clang make kernel/pid.ll > > # asm code > CC=clang make arch/arm/kernel/calls.ll > > Signed-off-by: Vinícius Tinti > Signed-off-by: Behan Webster > --- > Makefile | 7 +++ > scripts/Makefile.build | 18 ++ > 2 files changed, 25 insertions(+) > > diff --git a/Makefile b/Makefile > index f3c543d..4eb0d14 100644 > --- a/Makefile > +++ b/Makefile > @@ -1484,6 +1484,13 @@ endif > %.symtypes: %.c prepare scripts FORCE > $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) > > +ifeq ($(COMPILER),clang) > +%.ll: %.c prepare scripts FORCE > + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) > +%.ll: %.S prepare scripts FORCE > + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) > +endif Can we drop the test for $(COMPILER) here? If one try this with gcc then gcc will just fail if it do not support the clang flags supplied. And help section should be updated to list .ll too. > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index bf3e677..9ea19d6 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -174,6 +174,14 @@ cmd_cc_symtypes_c = >\ > $(obj)/%.symtypes : $(src)/%.c FORCE > $(call cmd,cc_symtypes_c) > > +ifeq ($(COMPILER),clang) > +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ > +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -emit-llvm > -S -o $@ $< Can we drop the test for COMPILER here too? Do -fverbose-asm make sense when generating .ll files? It looks like a leftover from what you copied. > +# LLVM bitcode > +# --- > +ifeq ($(COMPILER),clang) > +quiet_cmd_as_ll_S = CPP $(quiet_modtag) $@ > +cmd_as_ll_S = $(CPP) $(a_flags) -o $@ $< > + > +$(obj)/%.ll: $(src)/%.S FORCE > + $(call if_changed_dep,as_ll_S) > +endif This chunk belongs together with the other chunk. There is no reason to separate .S => .ll and .c => .ll rules. The current rules for .c => .lst etc is a mess and not something to be too much inspired from. Sam -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
On Fri, Jul 18, 2014 at 10:34:37PM -0300, Vinícius Tinti wrote: Allows kbuild to generate LLVM bitcode files with the .ll extension when building with Clang. # c code CC=clang make kernel/pid.ll # asm code CC=clang make arch/arm/kernel/calls.ll Signed-off-by: Vinícius Tinti viniciusti...@gmail.com Signed-off-by: Behan Webster beh...@converseincode.com --- Makefile | 7 +++ scripts/Makefile.build | 18 ++ 2 files changed, 25 insertions(+) diff --git a/Makefile b/Makefile index f3c543d..4eb0d14 100644 --- a/Makefile +++ b/Makefile @@ -1484,6 +1484,13 @@ endif %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +ifeq ($(COMPILER),clang) +%.ll: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.ll: %.S prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +endif Can we drop the test for $(COMPILER) here? If one try this with gcc then gcc will just fail if it do not support the clang flags supplied. And help section should be updated to list .ll too. diff --git a/scripts/Makefile.build b/scripts/Makefile.build index bf3e677..9ea19d6 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -174,6 +174,14 @@ cmd_cc_symtypes_c = \ $(obj)/%.symtypes : $(src)/%.c FORCE $(call cmd,cc_symtypes_c) +ifeq ($(COMPILER),clang) +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -emit-llvm -S -o $@ $ Can we drop the test for COMPILER here too? Do -fverbose-asm make sense when generating .ll files? It looks like a leftover from what you copied. +# LLVM bitcode +# --- +ifeq ($(COMPILER),clang) +quiet_cmd_as_ll_S = CPP $(quiet_modtag) $@ +cmd_as_ll_S = $(CPP) $(a_flags) -o $@ $ + +$(obj)/%.ll: $(src)/%.S FORCE + $(call if_changed_dep,as_ll_S) +endif This chunk belongs together with the other chunk. There is no reason to separate .S = .ll and .c = .ll rules. The current rules for .c = .lst etc is a mess and not something to be too much inspired from. Sam -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
+ifeq ($(COMPILER),clang) +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -emit-llvm -S -o $@ $ Can we drop the test for COMPILER here too? Do -fverbose-asm make sense when generating .ll files? It looks like a leftover from what you copied. Also $(DISABLE_LTO) looks like a left-over. It was added to avoid LTO when generating asm-offstes.s which the original rule is also used for. So this should be skipped too. Sam -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] kbuild: add support to generate LLVM bitcode files
On Sun, Jul 20, 2014 at 11:04:58PM +0200, Sam Ravnborg wrote: +ifeq ($(COMPILER),clang) +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -emit-llvm -S -o $@ $ Can we drop the test for COMPILER here too? Do -fverbose-asm make sense when generating .ll files? It looks like a leftover from what you copied. Also $(DISABLE_LTO) looks like a left-over. It was added to avoid LTO when generating asm-offstes.s which the original rule is also used for. So this should be skipped too. Third thing. In some places we indent the assignmnet like this: quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ cmd_cc_ll_c = $(CC) $(c_flags) This makes it more obvious that the cmd_cc_ll_c is actually the same. Makefile.build does not do this much but please do for these targets. Sam -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] kbuild: add support to generate LLVM bitcode files
Allows kbuild to generate LLVM bitcode files with the .ll extension when building with Clang. # c code CC=clang make kernel/pid.ll # asm code CC=clang make arch/arm/kernel/calls.ll Signed-off-by: Vinícius Tinti Signed-off-by: Behan Webster --- Makefile | 7 +++ scripts/Makefile.build | 18 ++ 2 files changed, 25 insertions(+) diff --git a/Makefile b/Makefile index f3c543d..4eb0d14 100644 --- a/Makefile +++ b/Makefile @@ -1484,6 +1484,13 @@ endif %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +ifeq ($(COMPILER),clang) +%.ll: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.ll: %.S prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +endif + # Modules /: prepare scripts FORCE $(cmd_crmodverdir) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index bf3e677..9ea19d6 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -174,6 +174,14 @@ cmd_cc_symtypes_c = \ $(obj)/%.symtypes : $(src)/%.c FORCE $(call cmd,cc_symtypes_c) +ifeq ($(COMPILER),clang) +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -emit-llvm -S -o $@ $< + +$(obj)/%.ll: $(src)/%.c FORCE + $(call if_changed_dep,cc_ll_c) +endif + # 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) @@ -315,6 +323,16 @@ quiet_cmd_asn1_compiler = ASN.1 $@ $(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler $(call cmd,asn1_compiler) +# LLVM bitcode +# --- +ifeq ($(COMPILER),clang) +quiet_cmd_as_ll_S = CPP $(quiet_modtag) $@ +cmd_as_ll_S = $(CPP) $(a_flags) -o $@ $< + +$(obj)/%.ll: $(src)/%.S FORCE + $(call if_changed_dep,as_ll_S) +endif + # Build the compiled-in targets # --- -- 2.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] kbuild: add support to generate LLVM bitcode files
Allows kbuild to generate LLVM bitcode files with the .ll extension when building with Clang. # c code CC=clang make kernel/pid.ll # asm code CC=clang make arch/arm/kernel/calls.ll Signed-off-by: Vinícius Tinti viniciusti...@gmail.com Signed-off-by: Behan Webster beh...@converseincode.com --- Makefile | 7 +++ scripts/Makefile.build | 18 ++ 2 files changed, 25 insertions(+) diff --git a/Makefile b/Makefile index f3c543d..4eb0d14 100644 --- a/Makefile +++ b/Makefile @@ -1484,6 +1484,13 @@ endif %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +ifeq ($(COMPILER),clang) +%.ll: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.ll: %.S prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +endif + # Modules /: prepare scripts FORCE $(cmd_crmodverdir) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index bf3e677..9ea19d6 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -174,6 +174,14 @@ cmd_cc_symtypes_c = \ $(obj)/%.symtypes : $(src)/%.c FORCE $(call cmd,cc_symtypes_c) +ifeq ($(COMPILER),clang) +quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ +cmd_cc_ll_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -emit-llvm -S -o $@ $ + +$(obj)/%.ll: $(src)/%.c FORCE + $(call if_changed_dep,cc_ll_c) +endif + # 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) @@ -315,6 +323,16 @@ quiet_cmd_asn1_compiler = ASN.1 $@ $(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler $(call cmd,asn1_compiler) +# LLVM bitcode +# --- +ifeq ($(COMPILER),clang) +quiet_cmd_as_ll_S = CPP $(quiet_modtag) $@ +cmd_as_ll_S = $(CPP) $(a_flags) -o $@ $ + +$(obj)/%.ll: $(src)/%.S FORCE + $(call if_changed_dep,as_ll_S) +endif + # Build the compiled-in targets # --- -- 2.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/