[llvm-dev] Linking Linux kernel with LLD

George Rimar via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 25 08:18:57 PST 2017


Hi !

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.

George.


More information about the llvm-dev mailing list