Re: [kvm-unit-tests PATCH v2 10/10] travis.yml: Add x86 build with clang 10

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

 



On 15/09/20 17:59, Roman Bolshakov wrote:
> So, a workaround for that could be adding '-Wl,--build-id=none' to the
> makefile rule for realmode.elf. Then multiboot magic is placed properly
> at 0x4000 instead of 0x4030. Unfortunately it doesn't help with the
> test :-)

Heh, weird.  I also tried adding

    /DISCARD/ : { *(.note.gnu.build-id) }

to the linker script and I got a very helpful (not) linker warning:

/usr/bin/ld: warning: .note.gnu.build-id section discarded, --build-id ignored.

... except that the --build-id was placed not by me but rather by gcc.
So we should probably simplify things doing this:

diff --git a/x86/Makefile.common b/x86/Makefile.common
index 090ce22..10c8a42 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -69,8 +69,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,-m,elf_i386 \
-	      -Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^
+	$(LD) -o $@ -m elf_i386 \
+	      -T $(SRCDIR)/$(TEST_DIR)/realmode.lds $^
 
 $(TEST_DIR)/realmode.o: bits = 32
 
diff --git a/x86/realmode.lds b/x86/realmode.lds
index 0ed3063..3220c19 100644
--- a/x86/realmode.lds
+++ b/x86/realmode.lds
@@ -1,5 +1,6 @@
 SECTIONS
 {
+    /DISCARD/ : { *(.note.gnu.build-id) }
     . = 16K;
     stext = .;
     .text : { *(.init) *(.text) }

which I will squash in your patch 3.

But the main issue is that clang does not support .code16gcc so it
writes 32-bit code that is run in 16-bit mode.  It'd be a start to
use -m16 instead of -m32, but then I think it still miscompiles the
(32-bit) code between "start" and the .code16gcc label.

Paolo




[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