[llvm-dev] Linking Linux kernel with LLD

Sean Silva via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 2 16:23:00 PST 2017


On Thu, Feb 2, 2017 at 12:38 AM, George Rimar <grimar at accesssoftek.com>
wrote:

> >As far as the setup, I would recommend setting up qemu for actually
> running the LLD-linked kernel and custom bootloader etc. because then you
> can have a single >script that rebuilds the bootloader and kernel and
> copies the files to the VM. This reduces iteration time significantly.
> >Davide is the one that set that up and could probably provide more
> details, but qemu docs might be good enough that you can set things up
> without much effort
> >(not sure though).
> >
> >-- Sean Silva
>> By the way, yesterday I configured "smallest possible kernel", linked it
> with BFD and launched under QEMU.
> It is very small and takes a few seconds to build it from scratch for me,
> used next article:
> http://mgalgs.github.io/2015/05/16/how-to-build-a-custom-
> linux-kernel-for-qemu-2015-edition.html
>
> Now I am going to link it with LLD and check if it boots or now.
> I think that should be fastest way - boot that little core and then enable
> features
> one by one or group by group and fix other things on the road.
>

My experience with linker bugs is that usually when things are mis-linked,
they are in the "core". E.g. startup code. So linking a small kernel may
not avoid as many bugs as you expect. For example, for FreeBSD, I don't
think we hit any issues in anything that could have been configured out.

-- Sean Silva


>
> Previously I also worked on a patches for kernel but did not try to
> minimize it and used some default configuration,
> what probably was good for finding mutliple issues from all sides, but not
> ideal way to fix/test startup and things.
>
> George.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170202/b883b75b/attachment.html>


More information about the llvm-dev mailing list