[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] hvmloader: fix build with LLVM Linker



On Mon, Sep 03, 2018 at 05:33:26PM +0200, Roger Pau Monne wrote:
> The hvmloader binary generated when using LLVM LD doesn't work
> properly and seems to get stuck while trying to generate and load the
> ACPI tables. This is caused by the layout of the binary when linked
> with LLVM LD.
> 
> LLVM LD has a different default linker script that GNU LD, and the
> resulting hvmloader binary is slightly different:
> 
> LLVM LD:
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   PHDR           0x000034 0x000ff034 0x000ff034 0x00060 0x00060 R   0x4
>   LOAD           0x000000 0x000ff000 0x000ff000 0x38000 0x38000 RWE 0x1000
>   GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0
> 
> GNU LD:
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   LOAD           0x000080 0x00100000 0x00100000 0x36308 0x3fd74 RWE 0x10
>   GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4
> 
> Note that in the LLVM LD case (as with GNU LD) the .text section does
> indeed have the address set to 0x100000 as requested on the command
> line:
> 
> [ 1] .text             PROGBITS        00100000 001000 00dd10 00  AX  0   0 16
> 
> There's however the PHDR which is not present when using GNU LD.
> 
> Fix this by using a very simple linker script that generates the same
> binary regardless of whether LLVM or GNU LD is used. By using a linker
> script the usage of -Ttext can also be avoided by placing the desired
> .text load address directly in the linker script.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.