[kvm-unit-tests PATCH 3/7] x86: Makefile: Fix linkage of realmode on x86_64-elf binutils

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

 



link spec [1][2] is empty on x86_64-elf-gcc, i.e. -m32 is not propogated
to the linker as "-m elf_i386" and that causes the error:

  /usr/local/opt/x86_64-elf-binutils/bin/x86_64-elf-ld: i386 architecture
  of input file `x86/realmode.o' is incompatible with i386:x86-64 output

1. https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html
2. https://gcc.gnu.org/onlinedocs/gccint/Driver.html

Cc: Cameron Esfahani <dirty@xxxxxxxxx>
Signed-off-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx>
---
 x86/Makefile.common | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/x86/Makefile.common b/x86/Makefile.common
index 2ea9c9f..8230ac0 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -66,7 +66,8 @@ test_cases: $(tests-common) $(tests)
 $(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/x86 -I lib
 
 $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o
-	$(CC) -m32 -nostdlib -o $@ -Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^
+	$(CC) -m32 -nostdlib -o $@ -Wl,-m,elf_i386 \
+	      -Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^
 
 $(TEST_DIR)/realmode.o: bits = 32
 
-- 
2.26.1




[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