kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: cartercheng@gmail.com (Carter Cheng)
To: kernelnewbies@lists.kernelnewbies.org
Subject: link time analysis for the kernel.
Date: Fri, 12 Oct 2018 14:49:27 +0800	[thread overview]
Message-ID: <CALS6=qXWGfZE32ZqVNEUazkBFPHV18LLYxBHPTtTdTiJnxCt2Q@mail.gmail.com> (raw)
In-Reply-To: <6309.1539310803@turing-police.cc.vt.edu>

I managed to find some information on this from Prof John Criswell who did
something similar for his dissertation but I do wonder how complicated the
make files for building the kernel are since the method he used would
require using llvm-link to stitch together all the different object
files(bitcode) into a single file and then convert them into machine code
at one go.

On Fri, Oct 12, 2018 at 10:20 AM <valdis.kletnieks@vt.edu> wrote:

> On Thu, 11 Oct 2018 21:45:16 +0800, Carter Cheng said:
>
> > There are some detaills about the current procedures for linking the
> kernel
> > that I am unfamiliar with. My understanding is that GCC and Clang both
> have
> > the ability to do link time analysis and transforms on code but is it
> > possible to write link time passes that will run on the kernel since the
> > linking phase is a bit different (i.e. doesnt produce an ELF file)?
>
> The fact that the kernel gets linked is an existence proof that it is
> possible
> to do link time processing on the kernel.
>
> There's no LTO support in the stock 4.19 tree, but Andi Kleen did a
> patchset
> for 4.15, and there's another patchset to enable LTO when using Clang
> rather
> than gcc. (I haven't tried either one, don't use on a production machine,
> as
> the resulting kernel may crash, eat filesystems, and/or turn your dog
> green...)
>
> Note that 'vmlinux' is a statically linked ELF binary. That  plus a
> bootstrap
> code gets merged to create a bzImage or similar thing that can be loaded by
> Grub2 or whatever boot loader.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181012/2a86a44a/attachment.html>

  reply	other threads:[~2018-10-12  6:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11 13:45 link time analysis for the kernel Carter Cheng
2018-10-11 18:02 ` o at goosey.org
2018-10-11 18:55   ` Carter Cheng
2018-10-11 19:04     ` Ozgur
2018-10-11 19:07     ` Ozgur
2018-10-11 19:46     ` Carter Cheng
2018-10-12  2:20 ` valdis.kletnieks at vt.edu
2018-10-12  6:49   ` Carter Cheng [this message]
2018-10-12  7:05     ` Ozgur

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='CALS6=qXWGfZE32ZqVNEUazkBFPHV18LLYxBHPTtTdTiJnxCt2Q@mail.gmail.com' \
    --to=cartercheng@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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;
as well as URLs for NNTP newsgroup(s).