Skip to contentSkip to conversation

ARM host compile fix

Qemu-devel Blue Swirl 3 participants 4 messages May 30, 2008

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

I needed this patch to get sparc-softmmu compile on ARM host. It looks like the code generator is not finished, tcg_abort() is called immediately on start.

Also sparc-linux-user final link fails:
/src/qemu/cpu-exec.c:609: relocation truncated to fit: R_ARM_PC24 against symbol `code_gen_prologue' defined in COMMON section in libqemu.a(exec.o)
collect2: ld returned 1 exit status

cpu-exec.c +4 -0
Index: qemu/cpu-exec.c
===================================================================
@@ -1320,7 +1320,11 @@
     unsigned long pc;
     int is_write;
 
+#if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
+    pc = uc->uc_mcontext.gregs[R15];
+#else
     pc = uc->uc_mcontext.arm_pc;
+#endif
     /* XXX: compute is_write */
     is_write = 0;
     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
#1 lore raw
Quoted 1 line · Blue Swirl

I needed this patch to get sparc-softmmu compile on ARM host.

Thanks for the patch. I guess it applies to all glibcs below 2.3 or 2.4 so I'll make this check a "<= 3" - I've only built for glibc 2.5. I'll commit it tomorrow unless you do.

Quoted 3 lines

It looks
like the code generator is not finished, tcg_abort() is called immediately on start.

I think this is due to the recent change making code_gen_buffer dynamic and requiring an absolute jump on ARM, which I had #if 0'ed in tcg-target.c because I had not tested it.

TCG is a bit of a moving target and I'll be trying to keep arm host support updated, but without putting an excessive effort in being quick.

Quoted 6 lines

Also sparc-linux-user final link fails:
/src/qemu/cpu-exec.c:609: relocation truncated to fit: R_ARM_PC24 against symbol `code_gen_prologue' defined in COMMON section in libqemu.a(exec.o)
collect2: ld returned 1 exit status

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.

Regards

#2 lore raw
Quoted 11 lines
Quoted 5 lines

Also sparc-linux-user final link fails:
/src/qemu/cpu-exec.c:609: relocation truncated to fit: R_ARM_PC24 against symbol `code_gen_prologue' defined in COMMON section in libqemu.a(exec.o)
collect2: ld returned 1 exit status

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.

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

Paul

author
#3 lore raw
In reply to andrzej zaborowski
Quoted 7 lines · andrzej zaborowski
Quoted 1 line · Blue Swirl

I needed this patch to get sparc-softmmu compile on ARM host.

Thanks for the patch. I guess it applies to all glibcs below 2.3 or
2.4 so I'll make this check a "<= 3" - I've only built for glibc 2.5. I'll commit it tomorrow unless you do.

I know nothing of ARM, so you should do it.

Quoted 5 lines
Quoted 3 lines

It looks
like the code generator is not finished, tcg_abort() is called immediately on start.

Quoted 7 lines

I think this is due to the recent change making code_gen_buffer
dynamic and requiring an absolute jump on ARM, which I had #if 0'ed in tcg-target.c because I had not tested it.

TCG is a bit of a moving target and I'll be trying to keep arm host support updated, but without putting an excessive effort in being quick.

Same goes for Sparc host.