public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: "Michal Marek" <mmarek@suse.com>,
	"Emese Revfy" <re.emese@gmail.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Behan Webster" <behanw@converseincode.com>,
	"Luis R . Rodriguez" <mcgrof@kernel.org>,
	"Vinícius Tinti" <viniciustinti@gmail.com>,
	"Kyeongmin Cho" <korea.drzix@gmail.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Linux Kbuild mailing list" <linux-kbuild@vger.kernel.org>,
	"Grant Grundler" <grundler@chromium.org>,
	"Michael Davidson" <md@google.com>,
	"Greg Hackmann" <ghackmann@google.com>,
	"Peter Foley" <pefoley2@pefoley.com>
Subject: Re: [PATCH v3] kbuild: Add support to generate LLVM bitcode files
Date: Fri, 21 Apr 2017 12:55:02 -0700	[thread overview]
Message-ID: <20170421195502.GL128305@google.com> (raw)
In-Reply-To: <CAK7LNASfCFW4KZ72rYXQTpYFGf+KJcjK+L8wvHtiHmXNVYRtwg@mail.gmail.com>

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

  reply	other threads:[~2017-04-21 19:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 17:27 [PATCH v3] kbuild: Add support to generate LLVM bitcode files Matthias Kaehlcke
2017-04-20 18:04 ` Matthias Kaehlcke
2017-04-21  5:02 ` Masahiro Yamada
2017-04-21 19:55   ` Matthias Kaehlcke [this message]
2017-04-23  6:57     ` Masahiro Yamada
2017-04-24  2:21     ` Masahiro Yamada
  -- strict thread matches above, loose matches on Subject: below --
2014-07-23 12:00 [PATCH v2] kbuild: add " Tinti
2014-09-11 23:13 ` [PATCH v3] " Vinícius Tinti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170421195502.GL128305@google.com \
    --to=mka@chromium.org \
    --cc=behanw@converseincode.com \
    --cc=ghackmann@google.com \
    --cc=grundler@chromium.org \
    --cc=keescook@chromium.org \
    --cc=korea.drzix@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=md@google.com \
    --cc=mmarek@suse.com \
    --cc=pefoley2@pefoley.com \
    --cc=re.emese@gmail.com \
    --cc=viniciustinti@gmail.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox