Re: Bug#827525: kvmtool: FTBFS on mips64el: guest/guest_init.o: linking 32-bit code with 64-bit code

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

 



On 17 June 2016 at 15:04, Dejan Latinovic <Dejan.Latinovic@xxxxxxxxxx> wrote:
> Package kvmtool FTBFS for mips64el with the following error:
>
>> LINK     lkvm
>> /usr/bin/ld: guest/guest_init.o: warning: linking abicalls files with non-abicalls files
>> /usr/bin/ld: guest/guest_init.o: linking 32-bit code with 64-bit code
>> /usr/bin/ld: failed to merge target specific data of file guest/guest_init.o
>> collect2: error: ld returned 1 exit status
>> Makefile:381: recipe for target 'lkvm' failed
>> make[1]: *** [lkvm] Error 1
>
> Full build log:
> https://buildd.debian.org/status/fetch.php?pkg=kvmtool&arch=mips64el&ver=0.20160419-1&stamp=1463209003
>
> The reason for that is behaviour is the way of creation guest_init.o.
>> ld -r -b binary -o guest/guest_init.o guest/init
>
> Resulting file is "MIPS-I" instead of expected "MIPS64 rel2".
>> file guest/guest_init.o.cp
>> guest/guest_init.o.cp: ELF 64-bit LSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
>
> If options "-r -b binary" are used, linker will ignore flags of input file "Flags: 0x80000006, pic, cpic, mips64r2",
> and flags of resulting guest_init.o file will be  "Flags: 0x0".
>
> Solution for this issue could be using different method for creation guest_init.o.
> If xxd and gcc are used instead of ld, resulting file will have regular flags.
>> xxd -i guest/init | $(CC) -c -x c - -o guest/guest_init.o
> Here are proposed changes for this issue.
> http://www.spinics.net/lists/kvm/msg118016.html
>
> I have created a patch that fixes this issue modeled on mentioned solution.
> Using this patch I was able to build kvmtool for mips64el, mipsel, i386, amd64.
> The patch is attached.
>
> Could you please consider including this patch.

I think the patch is better applied directly upstream, I'm sure there
are non-Debian users who would like to use kvmtool on mips64el.

Riku
--- kvmtool-0.20160419.orig/Makefile
+++ kvmtool-0.20160419/Makefile
@@ -395,8 +395,7 @@ endif
 $(GUEST_INIT): guest/init.c
 	$(E) "  LINK    " $@
 	$(Q) $(CC) $(GUEST_INIT_FLAGS) guest/init.c -o $@
-	$(Q) $(LD) -r -b binary -o guest/guest_init.o $(GUEST_INIT)
-
+	$(Q) xxd -i $@ | $(CC) -c -x c - -o guest/guest_init.o
 %.s: %.c
 	$(Q) $(CC) -o $@ -S $(CFLAGS) -fverbose-asm $<
 
--- kvmtool-0.20160419.orig/builtin-setup.c
+++ kvmtool-0.20160419/builtin-setup.c
@@ -146,8 +146,8 @@ static int extract_file(const char *gues
 	return 0;
 }
 
-extern char _binary_guest_init_start;
-extern char _binary_guest_init_size;
+extern char guest_init;
+extern char guest_init_len;
 extern char _binary_guest_pre_init_start;
 extern char _binary_guest_pre_init_size;
 
@@ -163,8 +163,8 @@ int kvm_setup_guest_init(const char *gue
 		return err;
 #endif
 	err = extract_file(guestfs_name, "virt/init",
-				&_binary_guest_init_start,
-				&_binary_guest_init_size);
+				&guest_init,
+				&guest_init_len);
 	return err;
 }
 #else

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux