Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1627969 > unrolled thread
| Started by | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| First post | 2017-04-21 07:10 +0200 |
| Last post | 2017-04-24 04:30 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v3] kbuild: Add support to generate LLVM bitcode files Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-04-21 07:10 +0200
Re: [PATCH v3] kbuild: Add support to generate LLVM bitcode files Matthias Kaehlcke <mka@chromium.org> - 2017-04-21 22:00 +0200
Re: [PATCH v3] kbuild: Add support to generate LLVM bitcode files Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-04-23 09:00 +0200
Re: [PATCH v3] kbuild: Add support to generate LLVM bitcode files Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-04-24 04:30 +0200
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2017-04-21 07:10 +0200 |
| Subject | Re: [PATCH v3] kbuild: Add support to generate LLVM bitcode files |
| Message-ID | <tyyZt-1MT-43@gated-at.bofh.it> |
Hi Matthias,
2017-04-05 2:27 GMT+09:00 Matthias Kaehlcke <mka@chromium.org>:
> From: Vinícius Tinti <viniciustinti@gmail.com>
>
> Add rules to kbuild in order to generate LLVM bitcode files with the .ll
> extension when using clang.
First, I'd like to be sure about the terminology "LLVM bitcode"
because "bitcode" sounds like human-unreadable binary.
For example, 'man llvm-as' says:
llvm-as is the LLVM assembler. It reads a file containing
human-readable LLVM assembly language, translates it to LLVM
bitcode, and writes the result into a file or to standard output.
As far as I understood:
*.ll - LLVM assembly (human readable file)
*.bc - LLVM bitcode (binary file)
Is this correct?
> # from c code
> CC=clang make kernel/pid.ll
This does not work because CC is overridden in the top-level Makefile.
It should be
make CC=clang kernel/pid.ll
> # from asm code
> CC=clang make arch/x86/kernel/preempt.ll
arch/x86/kernel/preempt.* does not exist
(at least in the latest tree).
> +
> +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)
> +
I could not understand how this rule can convert
architecture-specific assembly to LLVM intermediate expression.
This is just pre-processing *.S file.
Actually, this is completely the same as the rule *.S -> *.s
quiet_cmd_cpp_s_S = CPP $(quiet_modtag) $@
cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $<
$(obj)/%.s: $(src)/%.S FORCE
$(call if_changed_dep,cpp_s_S)
--
Best Regards
Masahiro Yamada
[toc] | [next] | [standalone]
| From | Matthias Kaehlcke <mka@chromium.org> |
|---|---|
| Date | 2017-04-21 22:00 +0200 |
| Message-ID | <tyMSK-1qO-23@gated-at.bofh.it> |
| In reply to | #1627969 |
Hi Masahiro, El Fri, Apr 21, 2017 at 02:02:46PM +0900 Masahiro Yamada ha dit: > 2017-04-05 2:27 GMT+09:00 Matthias Kaehlcke <mka@chromium.org>: > > From: Vinícius Tinti <viniciustinti@gmail.com> > > > > Add rules to kbuild in order to generate LLVM bitcode files with the .ll > > extension when using clang. > > > First, I'd like to be sure about the terminology "LLVM bitcode" > because "bitcode" sounds like human-unreadable binary. > > > For example, 'man llvm-as' says: > llvm-as is the LLVM assembler. It reads a file containing > human-readable LLVM assembly language, translates it to LLVM > bitcode, and writes the result into a file or to standard output. > > > As far as I understood: > > *.ll - LLVM assembly (human readable file) > *.bc - LLVM bitcode (binary file) > > Is this correct? Yes, the terminology should be changed to talk about 'LLVM assembly'. > > # from c code > > CC=clang make kernel/pid.ll > > This does not work because CC is overridden in the top-level Makefile. > It should be > make CC=clang kernel/pid.ll Will change > > # from asm code > > CC=clang make arch/x86/kernel/preempt.ll > > arch/x86/kernel/preempt.* does not exist > (at least in the latest tree). > > > > > > + > > +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) > > + > > I could not understand how this rule can convert > architecture-specific assembly to LLVM intermediate expression. > > This is just pre-processing *.S file. > > > Actually, this is completely the same as the rule *.S -> *.s > > quiet_cmd_cpp_s_S = CPP $(quiet_modtag) $@ > cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $< > > $(obj)/%.s: $(src)/%.S FORCE > $(call if_changed_dep,cpp_s_S) Indeed, unsurprisingly the content of a .ll file generated from a .S is the same as the corresponding .s. Besides the Makefile rules it isn't clear to me how assembly would be converted to LLVM IR. I suggest to remove the rules for assembly. Cheers Matthias
[toc] | [prev] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2017-04-23 09:00 +0200 |
| Message-ID | <tzjEZ-53L-1@gated-at.bofh.it> |
| In reply to | #1628567 |
Hi Matthias, 2017-04-22 4:55 GMT+09:00 Matthias Kaehlcke <mka@chromium.org>: > Hi Masahiro, > > El Fri, Apr 21, 2017 at 02:02:46PM +0900 Masahiro Yamada ha dit: > >> 2017-04-05 2:27 GMT+09:00 Matthias Kaehlcke <mka@chromium.org>: >> > From: Vinícius Tinti <viniciustinti@gmail.com> >> > >> > Add rules to kbuild in order to generate LLVM bitcode files with the .ll >> > extension when using clang. >> >> >> First, I'd like to be sure about the terminology "LLVM bitcode" >> because "bitcode" sounds like human-unreadable binary. >> >> >> For example, 'man llvm-as' says: >> llvm-as is the LLVM assembler. It reads a file containing >> human-readable LLVM assembly language, translates it to LLVM >> bitcode, and writes the result into a file or to standard output. >> >> >> As far as I understood: >> >> *.ll - LLVM assembly (human readable file) >> *.bc - LLVM bitcode (binary file) >> >> Is this correct? > > Yes, the terminology should be changed to talk about 'LLVM assembly'. > >> > # from c code >> > CC=clang make kernel/pid.ll >> >> This does not work because CC is overridden in the top-level Makefile. >> It should be >> make CC=clang kernel/pid.ll > > Will change > >> > # from asm code >> > CC=clang make arch/x86/kernel/preempt.ll >> >> arch/x86/kernel/preempt.* does not exist >> (at least in the latest tree). >> >> >> >> >> > + >> > +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) >> > + >> >> I could not understand how this rule can convert >> architecture-specific assembly to LLVM intermediate expression. >> >> This is just pre-processing *.S file. >> >> >> Actually, this is completely the same as the rule *.S -> *.s >> >> quiet_cmd_cpp_s_S = CPP $(quiet_modtag) $@ >> cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $< >> >> $(obj)/%.s: $(src)/%.S FORCE >> $(call if_changed_dep,cpp_s_S) > > Indeed, unsurprisingly the content of a .ll file generated from a .S > is the same as the corresponding .s. > > Besides the Makefile rules it isn't clear to me how assembly would be > converted to LLVM IR. I suggest to remove the rules for assembly. > I agree. This rule should be removed. -- Best Regards Masahiro Yamada
[toc] | [prev] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2017-04-24 04:30 +0200 |
| Message-ID | <tzBVf-A4-3@gated-at.bofh.it> |
| In reply to | #1628567 |
Hi Matthias,
2017-04-22 4:55 GMT+09:00 Matthias Kaehlcke <mka@chromium.org>:
> Hi Masahiro,
>
> El Fri, Apr 21, 2017 at 02:02:46PM +0900 Masahiro Yamada ha dit:
>
>> 2017-04-05 2:27 GMT+09:00 Matthias Kaehlcke <mka@chromium.org>:
>> > From: Vinícius Tinti <viniciustinti@gmail.com>
>> >
>> > Add rules to kbuild in order to generate LLVM bitcode files with the .ll
>> > extension when using clang.
>>
>>
>> First, I'd like to be sure about the terminology "LLVM bitcode"
>> because "bitcode" sounds like human-unreadable binary.
>>
>>
>> For example, 'man llvm-as' says:
>> llvm-as is the LLVM assembler. It reads a file containing
>> human-readable LLVM assembly language, translates it to LLVM
>> bitcode, and writes the result into a file or to standard output.
>>
One more thing:
Please add '*.ll' pattern to the following clean target.
clean: $(clean-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '*.ko.*' \
-o -name '*.dwo' \
-o -name '*.su' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
-o -name '*.c.[012]*.*' \
-o -name '*.gcno' \) -type f -print | xargs rm -f
--
Best Regards
Masahiro Yamada
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web