Hi all!
Recently there was a discussion on this mailing list about linking Linux and GRUB with LLD.
I have actually tried to link Linux kernel with LLD and (with some modifications) it linked successfully (but didn't run well).
Here is the list of modifications I had to do in order to link the kernel (I have used llvmlinux with clang and mainline with gcc, the results are similar):
1. LLD patches:
- D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
- D28857 (Allow relative relocations to a absolute value defined in linker script)
- [not actually used] D28612 (Added support for --emit-relocs)
2. Kernel configuration. I tried "make tinyconfig" and then changed to CONFIG_64BIT=y with menuconfig. I wanted the minimal kernel configuration for x86_64. After I get it working, I will try defconfig.
3. In arch/x86/Makefile changed the M16_CFLAGS to just "-m16". I think that cc-option should test if compiler supports '-m16' option and if it does, use it, if it doesn't use '-m32 -Wa,./arch/x86/boot/code16gcc.h' instead. I don't know why, but this test failed for me and LLD didn't accept this header, so I just simply changed the flag to '-m16' because I didn't want to investigate why did the test failed. It's just a quick workaround, but it works.
3. In arch/x86/boot/Makefile and arch/x86/realmode/rm/Makefile added "-m elf_i386" to LDFLAGS_setup.elf and LDFLAGS_realmode.elf accordingly. The problem is that the linker is invoked as "ld.lld -m elf_x86_64" and it ignores the OUTPUT_FORMAT from linker scripts. Being invoked as "ld.lld -m elf_x86_64 -m elf_i386" doesn't break anything and LLD even produces the right format of the binaries. Again a quick workaround, but it works.
4. In arch/x86/realmode/rm/Makefile removed "--emit-relocs" from LDFLAGS_realmode.elf. This is the problem with D28612 — I applied the patch to support --emit-relocs option, but LLD segfaulted. Reported here: https://llvm.org/bugs/show_bug.cgi?id=31579#c8
5. In arch/x86/kernel/vmlinux.lds.S commented out the "CONSTRUCTORS", because LLD doesn't support it.
6. In arch/x86/boot/setup.ld replaced 5*512 with precalculated value of 2560 because it doesn't seem that LLD supports math inside ASSERT in linker scripts.
7. In arch/x86/boot/setup.ld commented out the line ". = ASSERT(_end <= 0x8000, "Setup too big!");" because it seems to always fire this assertion, and the kernel is not going to be working anyway, so I just want it linked even if it will be unusable.
8. In arch/x86/lib/copy_user_64.S removed the line "bad_from_user:" (probably it was just a mistake), in arch/x86/kernel/vmlinux.lds.S removed semicolon after "*(.apicdrivers)" (also probably just a mistake).
Finally the kernel was built and it obviously didn't run (only printed out "No setup signature found..." but this is some result as well). Probably, the result could be better if the --emit-relocs option didn't fail and CONSTRUCTORS were supported. I really don't know what to do about the assertion that I have commented out.
I also tried using tools provided by LLVM instead of binutils (HOSTCC=clang HOSTLD=ld.lld CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm), it seems to work with llvmlinux, but clang will not work with the mainline. Clang doesn't seem to use integrated assembler, so I had to write a simple wrapper script around llvm-mc to use instead GNU as. I also have few patches to make llvm-objcopy to work with latest LLVM and support needed subset of flags, will publish it soon.
You can find my workarounds as a patch (the kernel will not work with this applied!) and my kernel config attached.
Regards,
Dmitry
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
thanls for sharing. Few comments/questions below:
>Here is the list of modifications I had to do in order to link the kernel (I have used llvmlinux with clang and mainline with gcc, the >results are similar):
>
>1. LLD patches:
> - D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
Do you remember where it was used ?
>5. In arch/x86/kernel/vmlinux.lds.S commented out the "CONSTRUCTORS", because LLD doesn't support it.
It is https://reviews.llvm.org/D28951. CONSTRUCTORS can be just removed, they do nothing for ELF.
>6. In arch/x86/boot/setup.ld replaced 5*512 with precalculated value of 2560 because it doesn't seem that LLD supports math inside >ASSERT in linker scripts.
It is actually not relative with ASSERT. LLD does not support "symbol = 5*6", but accepts "symbol = 5 * 6" currently.
Not sure what is easy fix here.
>Finally the kernel was built and it obviously didn't run (only printed out "No setup signature found..." but this is some result as well). >Probably, the result could be better if the --emit-relocs option didn't fail and CONSTRUCTORS were supported. I really don't know what >to do about the assertion that I have commented out.
I updated patch for --emit-relocs, now they do not fail: https://reviews.llvm.org/D28612
It looks to be important feature for self relocations, so it is not surprising it did not run without :)
George.
Hi Dmitry,
thanls for sharing. Few comments/questions below:
>Here is the list of modifications I had to do in order to link the kernel (I have used llvmlinux with clang and mainline with gcc, the >results are similar):
>
>1. LLD patches:
> - D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
Do you remember where it was used ?
>5. In arch/x86/kernel/vmlinux.lds.S commented out the "CONSTRUCTORS", because LLD doesn't support it.
It is https://reviews.llvm.org/D28951. CONSTRUCTORS can be just removed, they do nothing for ELF.
>6. In arch/x86/boot/setup.ld replaced 5*512 with precalculated value of 2560 because it doesn't seem that LLD supports math inside >ASSERT in linker scripts.
It is actually not relative with ASSERT. LLD does not support "symbol = 5*6", but accepts "symbol = 5 * 6" currently.
Not sure what is easy fix here.
> CONSTRUCTORS can be just removed, they do nothing for ELF.
Okay, this is what I did (I thought it will break things, but it is okay). I will apply the patch.
> LLD does not support "symbol = 5*6", but accepts "symbol = 5 * 6" currently. Not sure what is easy fix here.
Just ignore it for now, it's not really a big deal.
> I updated patch for --emit-relocs, now they do not fail: https://reviews.llvm.org/D28612
Thank you, I will apply the updated patch and hope that it will boot.
Regards,
Dmitry
20.01.2017, 18:36, "George Rimar" <gri...@accesssoftek.com>:
On Fri, Jan 20, 2017 at 8:35 AM, George Rimar via llvm-dev <llvm...@lists.llvm.org> wrote:Hi Dmitry,
thanls for sharing. Few comments/questions below:
>Here is the list of modifications I had to do in order to link the kernel (I have used llvmlinux with clang and mainline with gcc, the >results are similar):
>
>1. LLD patches:
> - D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
Do you remember where it was used ?
>5. In arch/x86/kernel/vmlinux.lds.S commented out the "CONSTRUCTORS", because LLD doesn't support it.
It is https://reviews.llvm.org/D28951. CONSTRUCTORS can be just removed, they do nothing for ELF.
>6. In arch/x86/boot/setup.ld replaced 5*512 with precalculated value of 2560 because it doesn't seem that LLD supports math inside >ASSERT in linker scripts.
It is actually not relative with ASSERT. LLD does not support "symbol = 5*6", but accepts "symbol = 5 * 6" currently.
Not sure what is easy fix here.I'm not sure if it is easy, but I think that it's clear that the linkerscript lexer needs to be improved. I think that is the source of the problems with `*(.apicdrivers);` as well.
Hi all!
Recently there was a discussion on this mailing list about linking Linux and GRUB with LLD.
I have actually tried to link Linux kernel with LLD and (with some modifications) it linked successfully (but didn't run well).
Here is the list of modifications I had to do in order to link the kernel (I have used llvmlinux with clang and mainline with gcc, the results are similar):
1. LLD patches:
- D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
- D28857 (Allow relative relocations to a absolute value defined in linker script)
- [not actually used] D28612 (Added support for --emit-relocs)
2. Kernel configuration. I tried "make tinyconfig" and then changed to CONFIG_64BIT=y with menuconfig. I wanted the minimal kernel configuration for x86_64. After I get it working, I will try defconfig.
3. In arch/x86/Makefile changed the M16_CFLAGS to just "-m16". I think that cc-option should test if compiler supports '-m16' option and if it does, use it, if it doesn't use '-m32 -Wa,./arch/x86/boot/code16gcc.h' instead. I don't know why, but this test failed for me and LLD didn't accept this header, so I just simply changed the flag to '-m16' because I didn't want to investigate why did the test failed. It's just a quick workaround, but it works.
3. In arch/x86/boot/Makefile and arch/x86/realmode/rm/Makefile added "-m elf_i386" to LDFLAGS_setup.elf and LDFLAGS_realmode.elf accordingly. The problem is that the linker is invoked as "ld.lld -m elf_x86_64" and it ignores the OUTPUT_FORMAT from linker scripts. Being invoked as "ld.lld -m elf_x86_64 -m elf_i386" doesn't break anything and LLD even produces the right format of the binaries. Again a quick workaround, but it works.
4. In arch/x86/realmode/rm/Makefile removed "--emit-relocs" from LDFLAGS_realmode.elf. This is the problem with D28612 — I applied the patch to support --emit-relocs option, but LLD segfaulted. Reported here: https://llvm.org/bugs/show_bug.cgi?id=31579#c8
5. In arch/x86/kernel/vmlinux.lds.S commented out the "CONSTRUCTORS", because LLD doesn't support it.
6. In arch/x86/boot/setup.ld replaced 5*512 with precalculated value of 2560 because it doesn't seem that LLD supports math inside ASSERT in linker scripts.
7. In arch/x86/boot/setup.ld commented out the line ". = ASSERT(_end <= 0x8000, "Setup too big!");" because it seems to always fire this assertion, and the kernel is not going to be working anyway, so I just want it linked even if it will be unusable.
8. In arch/x86/lib/copy_user_64.S removed the line "bad_from_user:" (probably it was just a mistake), in arch/x86/kernel/vmlinux.lds.S removed semicolon after "*(.apicdrivers)" (also probably just a mistake).
Finally the kernel was built and it obviously didn't run (only printed out "No setup signature found..." but this is some result as well). Probably, the result could be better if the --emit-relocs option didn't fail and CONSTRUCTORS were supported. I really don't know what to do about the assertion that I have commented out.
I also tried using tools provided by LLVM instead of binutils (HOSTCC=clang HOSTLD=ld.lld CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm), it seems to work with llvmlinux, but clang will not work with the mainline. Clang doesn't seem to use integrated assembler, so I had to write a simple wrapper script around llvm-mc to use instead GNU as. I also have few patches to make llvm-objcopy to work with latest LLVM and support needed subset of flags, will publish it soon.
You can find my workarounds as a patch (the kernel will not work with this applied!) and my kernel config attached.
Regards,
Dmitry
>> - D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
> Do you remember where it was used ?
setup.elf:
ld.lld -m elf_i386 -T arch/x86/boot/setup.ld arch/x86/boot/a20.o arch/x86/boot/bioscall.o arch/x86/boot/cmdline.o arch/x86/boot/copy.o arch/x86/boot/cpu.o arch/x86/boot/cpuflags.o arch/x86/boot/cpucheck.o arch/x86/boot/early_serial_console.o arch/x86/boot/edd.o arch/x86/boot/header.o arch/x86/boot/main.o arch/x86/boot/mca.o arch/x86/boot/memory.o arch/x86/boot/pm.o arch/x86/boot/pmjump.o arch/x86/boot/printf.o arch/x86/boot/regs.o arch/x86/boot/string.o arch/x86/boot/tty.o arch/x86/boot/video.o arch/x86/boot/video-mode.o arch/x86/boot/version.o arch/x86/boot/video-vga.o arch/x86/boot/video-vesa.o arch/x86/boot/video-bios.o -o arch/x86/boot/setup.elf
ld.lld: error: do not know how to handle relocation 'R_386_PC8' (23)
> I updated patch for --emit-relocs, now they do not fail.
Thanks, applied it, doesn't fail.
I still didn't do anything with "Setup too big!" problem, just commented out the assert. Tried booting the resulting bzImage and vmlinux with qemu. The bzImage only did reboot over and over, but the vmlinux did show an adorable picture (attached).
Thanks, I'll take a look and probably resurrect that abandoned patch then.
>I still didn't do anything with "Setup too big!" problem, just commented out the assert.
I did not get to that step yet, but just as a guess: you probably can try to add -N option for that place.
>Tried booting the resulting bzImage and vmlinux with qemu. The bzImage only did reboot over and over, but the vmlinux did show an adorable picture (attached).
>
That is interesting information, thanks.
I am not familar with linux kernel, but testing with qemu helped a lot when we worked on booting freebsd loaders.
I hope to get to that step soon, after finishing with other already known issues.
>Our tokenizer recognize
>Our tokenizer recognize
> Well, maybe, we should just change the Linux kernel instead of tweaking our tokenizer too hard.
I agree, for now I am inclined to do that and watch for other scripts.
George.
I am observing next issue when linking with WIP patches applied:
ld: warning: cannot find entry symbol _start; defaulting to 0x1000
RELOCS arch/x86/realmode/rm/realmode.relocs
OBJCOPY arch/x86/realmode/rm/realmode.bin
objcopy:arch/x86/realmode/rm/realmode.elf: Bad value
arch/x86/realmode/rm/Makefile:61: recipe for target 'arch/x86/realmode/rm/realmode.bin' failed
make[5]: *** [arch/x86/realmode/rm/realmode.bin] Error 1
It seems to be objcopy version specific.
With GNU objcopy (GNU Binutils for Ubuntu) 2.26.1 and GNU objcopy (GNU Binutils) 2.27 I have the same errors,
GNU objcopy (GNU Binutils) 2.17.50.20070806 produces output fine.
What version of binutils do you use ?
Also I am observing that we do not produce correct output for realmode.elf anyways.
It has next script:
(arch/x86/realmode/rm/realmode.lds.S)
.rodata : {
*(.rodata)
*(.rodata.*)
. = ALIGN(16);
video_cards = .;
*(.videocards)
video_cards_end = .;
}
But symbols video_cards == video_cards_end in LLD output (realmode.elf),
what does not seems to be correct.
So I believe realmode.elf, bin are broken, even if objcopy runs fine.
I am investigating it now.
I used objcopy from GNU Binutils 2.27 and I didn't have this error. Maybe it's something new, so I will build a new version of LLD and try to reproduce.
Sorry, I accidentally used "Reply" instead of "Reply all", so the message didn't get to the mailing list.
Regards,
Dmitry
25.01.2017, 18:19, "George Rimar" <gri...@accesssoftek.com>:
Well, maybe, we should just change the Linux kernel instead of tweaking our tokenizer too hard.
On Tue, Jan 24, 2017 at 11:29 AM, Rui Ueyama <ru...@google.com> wrote:Well, maybe, we should just change the Linux kernel instead of tweaking our tokenizer too hard.This is silly. Writing a simple and maintainable lexer is not hard (look e.g. at https://reviews.llvm.org/D10817). There are some complicated context-sensitive cases in linker scripts that break our approach of tokenizing up front (so we might want to hold off on), but we aren't going to die from implementing enough to lex basic arithmetic expressions independent of whitespace.
George.
>The lexical format of linker scripts requires a context-sensitive lexer.
George.
I like that idea. I first thought of always having '*' as a token, but
then space has to be a token, which is an incredible pain.
I then thought of having a "setLexMode" method, but the lex mode can
always be implicit from where we are in the parser. The parser should
always know if it should call next or nextArithmetic.
And I agree we should probably implement this. Even if it is not common,
it looks pretty silly to not be able to handle 2*5.
Cheers,
Rafael
Sean,So as you noticed that linker script tokenization rule is not very trivial -- it is context sensitive. The current lexer is extremely simple and almost always works well. Improving "almost always" to "perfect" is not high priority because we have many more high priority things, but I'm fine if someone improves it. If you are interested, please take it. Or maybe I'll take a look at it. It shouldn't be hard. It's probably just a half day work.
As far as I know, the grammar is LL(1), so it needs only one push-back buffer. Handling INCLUDE directive can be a bit tricky though.Maybe we should rename ScriptParserBase ScriptLexer.
,
>At this point I'm able to link Linux kernel with LLD and objcopy doen't give me any errors.
.rodata : { *(.rodata) *(.rodata.*) . = ALIGN(16); video_cards = .; *(.videocards) video_cards_end = .;
>> I have a question also. You added -m
elf_i386 to workaround emulation conflict issue in LLD, do you know
The problem with the linker script grammar is that "foo *" and "foo*"
can't both tokenize to IDENTIFIER STAR, since in the context of a
wildcard expression they mean different things. It certainly can be
dealt with by making the tokens whitespace sensitive or doing post
processing, but it is certainly not a nice grammar.
Joerg
At this point I'm able to link Linux kernel with LLD and objcopy doen't give me any errors.The versions are:Linux 4.10.0-rc5 (+ applied the patch from my previous message)LLD 5.0.0 (https://github.com/llvm-mirror/lld db83a5cc3968b3aac1dbe3270190bd3282862e74) (+ applied D28612)GNU objcopy (GNU Binutils) 2.27The problem is that the resulting kernel doesn't boot. Does anybody have any suggestions on how to debug it or any guesses what did go wrong while linking?
At this point I'm able to link Linux kernel with LLD and objcopy doen't give me any errors.The versions are:Linux 4.10.0-rc5 (+ applied the patch from my previous message)LLD 5.0.0 (https://github.com/llvm-mirror/lld db83a5cc3968b3aac1dbe3270190bd3282862e74) (+ applied D28612)GNU objcopy (GNU Binutils) 2.27The problem is that the resulting kernel doesn't boot. Does anybody have any suggestions on how to debug it or any guesses what did go wrong while linking?
>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.
So I investigated this today.
(It is about https://github.com/torvalds/linux/blob/master/arch/x86/boot/setup.ld#L52)
Script ends with:
.bss :
{
__bss_start = .;
*(.bss)
__bss_end = .;
}
. = ALIGN(16);
_end = .;
/DISCARD/ : { *(.note*) }
. = ASSERT(_end <= 0x8000, "Setup too big!");
And what LLD do here. It makes command list to be:
Place .bss, Place non-allocated orphans, Assign _end.
So places command "_end = " after commands for orphan sections.
There are plenty of them: debug_*, .comment, .shstrtab, .symtab, .strtab.
And _end value is set to not what expected finally.
Fix on script side can be very easy, just add one more line before "/DISCARD/":
.debug_info : { *(.debug_info) }
That way LLD will attach that non-allocated orphans after .debug_info section.
And _end will be calculated earlier and be correct.
I just had a quick look about how to fix that. We have shouldSkip(const BaseCommand &Cmd) with comment:
// We don't want to go over alignments, since doing so in
// rx_sec : { *(rx_sec) }
// . = ALIGN(0x1000);
// /* The RW PT_LOAD starts here*/
// rw_sec : { *(rw_sec) }
// would mean that the RW PT_LOAD would become unaligned.
I think probably fix could be to allow go over alignments if we placing non-allocatable orphans,
them are placed the last and should not cause such issue to happen.
That will not work so simple. I'll take another look.
>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:
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.
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.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?)
>On Fri, Jan 27, 2017 at 1:31 PM, Rui Ueyama <ru...@google.com> wrote:
>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.
>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.
>>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?)>>Regards,>Dmitry
Just want to share latest results of investigation from my side.I traced kernel linked with LLD to find where it fails.
LLD linked kernel starts execution and then I came up to protected_mode_jump function, which intention to jump to startup_64:jmpl *%eax # Jump to the 32-bit entrypoint
It does not happen. Code executes right before jmpl and then fail on this call for me, so startup_64 never called.
startup_64 is a part of vmlinux binary. So as you said vmlinux has troubles and after doing readelf -a on LLD linked and bfd linked ones, I found that LLD outputs vmlinux as executable and bfd output is DSO. Had no chance to investigate why that happens, but pretty sure that is the not fine.
Invocation line for us does not contain -shared:
-m elf_x86_64--script home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/vmlinux.ldshome/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.ohome/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/misc.ohome/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/string.ohome/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/cmdline.ohome/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/error.ohome/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/piggy.ohome/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/cpuflags.o-o vmlinux
George.
>>I think you can also get DSO with -pie I think, but I don't see that either. This is quite mysterious. I also did a quick look at the >>linker script and didn't see anything at first glance that would
cause DSO output (can linker scripts even control EType?). The >>bootloader might not even look at the EType though.
>That address seems to come from >here: https://github.com/torvalds/linux/blob/5924bbecd0267d87c24110cbe2041b5075173a25/arch/x86/boot/pm.c#L124
>>```>protected_mode_jump(boot_params.hdr.code32_start,> (u32)&boot_params + (ds() << 4));>```
>>That boot_params.hdr.code32_start field is probably either invalid (bad reloc or something else causing the bootloader to >calculate the wrong address) or valid but the thing it thinks it is pointing to wasn't loaded (missing PT_LOAD etc.).
boot_params.hdr.code32_start field is valid :) It is 0x100000, like expected
(btw thanks for those links on info how kernel boots, they were pretty useful).
I checked it is valid using trace:
void go_to_protected_mode(void){if (boot_params.hdr.code32_start == 0x100000)puts("go_to_protected_mode 1\n");else
puts("go_to_protected_mode 2\n");
while (1) {};
I had to use infinite loop here, because QEMU does not crash for me, but do domething what looks like reboot and clears all my traces output. Infinite loop helps to see traces text, if placed before dead point.
>
>Btw, how did you narrow it down to that specific instruction? That's pretty handy.
I used very simple approach, did not know how to do that properly :), so inserted infinite loops in asm code:foo:
jmp foo
>Then I suspect that that segment isn't being loaded. Is there a PT_LOAD that covers that address? Is the bootloader loading it?
>I think you can also get DSO with -pie I think, but I don't see that either. This is quite mysterious. I also did a quick look at the >linker
script and didn't see anything at first glance that would cause DSO output (can linker scripts even control EType?). The >bootloader might not even look at the EType though.
>>>That boot_params.hdr.code32_start field is probably either invalid (bad reloc or something else causing the bootloader to >>>calculate the wrong address) or valid but the thing it thinks it is pointing to wasn't loaded (missing PT_LOAD etc.).
George.
Thanks for your ideas, Sean !
>The bug is not likely to be corrupted data in the decompressed output (that is just calling into a gzip routine or something). You shouldn't have to dump/printf->trace from memory during boot to see that data since the "real" kernel binary that is being decompressed into that memory region is probably already somewhere > in your build tree (arch/x86/boot/compressed/Makefile seems like it has the details;
I found that bug finally :)
I dumped output for kernel and observed that LLD output starts from ELF header, while BFD points to some code data it seems, what is expected since execution flow makes jmp there.
That means decompressed kernel was not copied properly and issue is at one of points you sent earlier:
Looking on readelf output for vmlinux, BFD loads has correct LMAs:
George.
George.
>Thank you! It worked and I finally got a working kernel. Here is the kernel boot log:
Did you see something alike ? Looks there is nothing in your log about these timers. I suppose you disabled those ?