[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 00/31] Misc changes for 2016-05-27
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] [PULL 00/31] Misc changes for 2016-05-27 |
Date: |
Fri, 27 May 2016 14:38:58 +0100 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Fri, May 27, 2016 at 02:04:52PM +0100, Peter Maydell wrote:
> With V=1:
>
> i686-w64-mingw32-ld -m i386pe -Ttext 0 -e _start -s -o
> linuxboot_dma.img linuxboot_dma.o
> linuxboot_dma.o:linuxboot_dma.c:(.text+0x57): undefined reference to
> `load_kernel'
>
> Building an image for the target using our host compiler seems like
> an odd choice,
Which compiler should I be using?
> but the makefile obviously intends to support it
> since it has specific ifdef CONFIG_WIN32 code to adjust the linker
> command line.
>
> I suspect this is a mismatch between the symbol the native asm is
> using and the one that the C compiler wants:
>
> $ nm build/w32-new/pc-bios/optionrom/linuxboot_dma.o |grep load_kernel
> 000005dd T _load_kernel
> U load_kernel
>
> since name mangling rules are different for Linux and Windows ABIs.
One way to solve this (which works for me) is as below. There are
some other approaches, eg. using -fno-leading-underscore, or using a
conditional macro to mangle the name. However I have no idea if there
is some preferred way.
Rich.
diff --git a/pc-bios/optionrom/linuxboot_dma.c
b/pc-bios/optionrom/linuxboot_dma.c
index 86ef1ce..8509b28 100644
--- a/pc-bios/optionrom/linuxboot_dma.c
+++ b/pc-bios/optionrom/linuxboot_dma.c
@@ -213,6 +213,9 @@ static uint32_t get_e801_addr(void)
return ret;
}
+/* Force the asm name without leading underscore, even on Win32. */
+extern void load_kernel(void) asm("load_kernel");
+
void load_kernel(void)
{
void *setup_addr;
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
- [Qemu-devel] [PULL 25/31] scsi-disk: introduce scsi_disk_req_check_error, (continued)
- [Qemu-devel] [PULL 25/31] scsi-disk: introduce scsi_disk_req_check_error, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 26/31] scsi-block: always use SG_IO, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 23/31] scsi-disk: introduce dma_readv and dma_writev, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 27/31] scsi-generic: Merge block max xfer len in INQUIRY response, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 31/31] exec: hide mr->ram_addr from qemu_get_ram_ptr users, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 29/31] exec: remove ram_addr argument from qemu_ram_block_from_host, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 28/31] memory: remove qemu_get_ram_fd, qemu_set_ram_fd, qemu_ram_block_host_ptr, Paolo Bonzini, 2016/05/27
- [Qemu-devel] [PULL 30/31] memory: split memory_region_from_host from qemu_ram_addr_from_host, Paolo Bonzini, 2016/05/27
- Re: [Qemu-devel] [PULL 00/31] Misc changes for 2016-05-27, Peter Maydell, 2016/05/27