<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span style="color: rgb(33, 33, 33); font-size: 12pt;">>I have just checked it, the startup.elf and realmode.elf are fine. Only few changes are required for mainline kernel and one >commit has to be reverted from lld and a few patches have to be applied.</span><br>
</p>
<div style="color: rgb(33, 33, 33);">
<div>
<div>> </div>
<div>>The only step when I have used BFD is linking vmlinux. I have manually set LD variable in vmlinux_link() function. The vmlinux >produced by lld doesn't work yet. I will compare it to the one produced by GNU ld and try to figure out what is wrong (maybe
 >you can suggest some useful objdump flags?)</div>
<div>> </div>
<div>>Regards,</div>
<div>>Dmitry<br>
</div>
<div><br>
</div>
<div>Just want to share latest results of investigation from my side. </div>
<div>I traced kernel linked with LLD to find where it fails.<br>
</div>
<div><br>
</div>
<div>LLD linked kernel starts execution and then <span style="font-size: 12pt;">I came up to </span><span style="font-size: 12pt;">protected_mode_jump</span><span style="font-size: 12pt;">​ fun</span><span style="font-size: 12pt;">ction, which intention to
 jump to </span><span style="font-size: 12pt;">startup_64</span><span style="font-size: 12pt;">:</span></div>
<div>    jmpl<span class="Apple-tab-span" style="white-space:pre"> </span>*%eax<span class="Apple-tab-span" style="white-space:pre">
</span># Jump to the 32-bit entrypoint<br>
</div>
<div>(<a href="https://github.com/torvalds/linux/blob/5924bbecd0267d87c24110cbe2041b5075173a25/arch/x86/boot/pmjump.S#L76" style="font-size: 12pt;">https://github.com/torvalds/linux/blob/5924bbecd0267d87c24110cbe2041b5075173a25/arch/x86/boot/pmjump.S#L76</a>)<br>
</div>
<div>(https://github.com/torvalds/linux/blob/5924bbecd0267d87c24110cbe2041b5075173a25/arch/x86/kernel/head_64.S#L48)<br>
</div>
<div><br>
</div>
<div>It does not happen. Code executes right before jmpl and then fail on this call for me, so <span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">startup_64</span>
 never called.<br>
</div>
<div><br>
</div>
<div>startup_64 is a part of vmlinux binary. So as you said vmlinux has troubles and a<span style="font-size: 12pt;">fter doi</span><span style="font-size: 12pt;">ng readelf -a on LLD linked and bfd linked ones, I found that LLD outputs <span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">vmlinux</span> as executable
 and bfd output is DSO. Had no chance to investigate why that happens, </span><span style="font-size: 12pt;">but pretty sure that is t</span><span style="font-size: 12pt;">he
</span><span style="font-size: 12pt;">not fine</span><span style="font-size: 12pt;">.</span></div>
<div><br>
</div>
<div>Invocation line for us does not contain -shared:<br>
</div>
<div><br>
</div>
<div>
<div>-m elf_x86_64</div>
<div>--script home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/vmlinux.lds</div>
<div>home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o</div>
<div>home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/misc.o</div>
<div>home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/string.o</div>
<div>home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/cmdline.o</div>
<div>home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/error.o</div>
<div>home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/piggy.o</div>
<div>home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/cpuflags.o</div>
<div>-o vmlinux<br>
</div>
</div>
<div><br>
</div>
<div>George.<br>
</div>
<div><br>
<br>
</div>
<div><br>
</div>
</div>
</div>
</body>
</html>