Skip to contentSkip to conversation

fix warning in syscall.c

PATCH In review Robert Reif 2 participants 3 messages Jul 3, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix warning in syscall.c

/home/wine/qemu/linux-user/syscall.c: In function `do_fork':
/home/wine/qemu/linux-user/syscall.c:2790: warning: implicit declaration of function `qemu_mallocz' /home/wine/qemu/linux-user/syscall.c:2790: warning: assignment makes pointer from integer without a cast

syscall.c +1 -0
@@ -72,6 +72,7 @@
 #include "linux_loop.h"
 
 #include "qemu.h"
+#include "qemu-common.h"
 
 #if defined(USE_NPTL)
 #include <linux/futex.h>
#1 lore raw

[Qemu-devel] problem when building arm host

Hi,
I am trying to build qemu for arm host. I got below error:

......
make -C i386-linux-user all
make[1]: Entering directory `/media/system/u/SW/src/qemu-arm-host/i386-linux-user'
arm-linux-gcc -g -Wl,-T,/u/SW/src/qemu-arm-host/arm.ld -o qemu-i386 main.o syscall.o strace.o mmap.o signal.o path.o thunk.o elfload.o linuxload.o uaccess.o vm86.o gdbstub.o libqemu.a ../libqemu_user.a -lm -lrt -lpthread
libqemu.a(cpu-exec.o): In function `cpu_x86_exec':
/u/SW/src/qemu-arm-host/cpu-exec.c:615: relocation truncated to fit: R_ARM_PC24 against symbol `code_gen_prologue' defined in COMMON section in libqemu.a(exec.o) /media/system/u/SW/usr/local/arm/gcc-4.0.2-glibc-2.3.5/arm-unknown-linux-gnu/bin/../lib/gcc/arm-unknown-linux-gnu/4.0.2/../../../../arm-unknown-linux-gnu/bin/ld: warning: .preinit_array section has zero size /media/system/u/SW/usr/local/arm/gcc-4.0.2-glibc-2.3.5/arm-unknown-linux-gnu/bin/../lib/gcc/arm-unknown-linux-gnu/4.0.2/../../../../arm-unknown-linux-gnu/bin/ld: warning: .init_array section has zero size /media/system/u/SW/usr/local/arm/gcc-4.0.2-glibc-2.3.5/arm-unknown-linux-gnu/bin/../lib/gcc/arm-unknown-linux-gnu/4.0.2/../../../../arm-unknown-linux-gnu/bin/ld: warning: .fini_array section has zero size
collect2: ld returned 1 exit status
make[1]: *** [qemu-i386] Error 1
make[1]: Leaving directory `/media/system/u/SW/src/qemu-arm-host/i386-linux-user'
make: *** [subdir-i386-linux-user] Error 2

in old post of andrzej zaborowski, he said

"Yes, arm-linux-user fails with the same error because gcc doesn't manage to make the call to code_gen_prologue. One solution is to wrap the #define tcg_qemu_tb_exec in tcg/tcg.h in an #ifndef, and override it tcg/arm/tcg-target.h with the same kind of call as was used before introduction of prologue/epilogue which was possibly more optimal."

but I don't understand above clearly. What I did is

in tcg/tcg.h

#ifdef __powerpc__

#define tcg_qemu_tb_exec(tb_ptr) \
    ((long REGPARM __attribute__ ((longcall)) (*)(void *))code_gen_prologue)(tb_ptr)

#else
#ifndef tcg_qemu_tb_exec
#define tcg_qemu_tb_exec(tb_ptr) ((long REGPARM (*)(void *))code_gen_prologue)(tb_ptr) #endif
#endif

and add
#ifndef tcg_qemu_tb_exec
#define tcg_qemu_tb_exec(tb_ptr) ((long REGPARM (*)(void *))code_gen_prologue)(tb_ptr) #endif

in the end of tcg/arm/tcg-target.h

But seems no effect. Did I mis-understand?

In old post Paul also pointed out:

"Or tweak the linker script to place code_gen_prologue near to the code segment."

Can anyone teach me how to do this?

Best Regards!

#2 lore raw

Re: [Qemu-devel] problem when building arm host

I got it. I added below line

  code_gen_prologue = .;

after the

  .text      :
  {
    *(.text)
    /* .gnu.warning sections are handled specially by elf32.em.  */
    *(.gnu.warning)
    *(.gnu.linkonce.t*)
  } =0x47ff041f

----- Original Message -----
From: "Cai Qiang" <[email protected]>
To: <[email protected]>
Sent: Thursday, July 03, 2008 11:49 AM
Subject: [Qemu-devel] problem when building arm host

Quoted 60 lines

Hi,
I am trying to build qemu for arm host. I got below error:

......
make -C i386-linux-user all
make[1]: Entering directory `/media/system/u/SW/src/qemu-arm-host/i386-linux-user'
arm-linux-gcc -g -Wl,-T,/u/SW/src/qemu-arm-host/arm.ld -o qemu-i386 main.o syscall.o strace.o mmap.o signal.o path.o thunk.o elfload.o linuxload.o uaccess.o vm86.o gdbstub.o libqemu.a ../libqemu_user.a -lm -lrt -lpthread
libqemu.a(cpu-exec.o): In function `cpu_x86_exec':
/u/SW/src/qemu-arm-host/cpu-exec.c:615: relocation truncated to fit: R_ARM_PC24 against symbol `code_gen_prologue' defined in COMMON section in libqemu.a(exec.o) /media/system/u/SW/usr/local/arm/gcc-4.0.2-glibc-2.3.5/arm-unknown-linux-gnu/bin/../lib/gcc/arm-unknown-linux-gnu/4.0.2/../../../../arm-unknown-linux-gnu/bin/ld: warning: .preinit_array section has zero size /media/system/u/SW/usr/local/arm/gcc-4.0.2-glibc-2.3.5/arm-unknown-linux-gnu/bin/../lib/gcc/arm-unknown-linux-gnu/4.0.2/../../../../arm-unknown-linux-gnu/bin/ld: warning: .init_array section has zero size /media/system/u/SW/usr/local/arm/gcc-4.0.2-glibc-2.3.5/arm-unknown-linux-gnu/bin/../lib/gcc/arm-unknown-linux-gnu/4.0.2/../../../../arm-unknown-linux-gnu/bin/ld: warning: .fini_array section has zero size
collect2: ld returned 1 exit status
make[1]: *** [qemu-i386] Error 1
make[1]: Leaving directory `/media/system/u/SW/src/qemu-arm-host/i386-linux-user'
make: *** [subdir-i386-linux-user] Error 2

in old post of andrzej zaborowski, he said

"Yes, arm-linux-user fails with the same error because gcc doesn't manage to make the call to code_gen_prologue. One solution is to wrap the #define tcg_qemu_tb_exec in tcg/tcg.h in an #ifndef, and override it tcg/arm/tcg-target.h with the same kind of call as was used before introduction of prologue/epilogue which was possibly more optimal."

but I don't understand above clearly. What I did is

in tcg/tcg.h

#ifdef __powerpc__

#define tcg_qemu_tb_exec(tb_ptr) \
   ((long REGPARM __attribute__ ((longcall)) (*)(void *))code_gen_prologue)(tb_ptr)

#else
#ifndef tcg_qemu_tb_exec
#define tcg_qemu_tb_exec(tb_ptr) ((long REGPARM (*)(void *))code_gen_prologue)(tb_ptr) #endif
#endif

and add
#ifndef tcg_qemu_tb_exec
#define tcg_qemu_tb_exec(tb_ptr) ((long REGPARM (*)(void *))code_gen_prologue)(tb_ptr) #endif

in the end of tcg/arm/tcg-target.h

But seems no effect. Did I mis-understand?

In old post Paul also pointed out:

"Or tweak the linker script to place code_gen_prologue near to the code segment."

Can anyone teach me how to do this?

Best Regards!