All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm-unit-tests: Build changes for illumos.
@ 2022-05-12 20:45 Dan Cross
  2022-05-12 22:05 ` Sean Christopherson
  0 siblings, 1 reply; 31+ messages in thread
From: Dan Cross @ 2022-05-12 20:45 UTC (permalink / raw)
  To: kvm; +Cc: Dan Cross

We have begun using kvm-unit-tests to test Bhyve under
illumos.  We started by cross-compiling the tests on Linux
and transfering the binary artifacts to illumos machines,
but it proved more convenient to build them directly on
illumos.

This change modifies the build infrastructure to allow
building on illumos; I have also tested it on Linux.  The
required changes were pretty minimal: the most invasive
was switching from using the C compiler as a linker driver
to simply invoking the linker directly in two places.
This allows us to easily use gold instead of the Solaris
linker.

Signed-off-by: Dan Cross <cross@oxidecomputer.com>
---
 configure           | 5 +++--
 x86/Makefile.common | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 86c3095..7193811 100755
--- a/configure
+++ b/configure
@@ -15,6 +15,7 @@ objdump=objdump
 ar=ar
 addr2line=addr2line
 arch=$(uname -m | sed -e 's/i.86/i386/;s/arm64/aarch64/;s/arm.*/arm/;s/ppc64.*/ppc64/')
+os=$(uname -s)
 host=$arch
 cross_prefix=
 endian=""
@@ -317,9 +318,9 @@ EOF
   rm -f lib-test.{o,S}
 fi
 
-# require enhanced getopt
+# require enhanced getopt everywhere except illumos
 getopt -T > /dev/null
-if [ $? -ne 4 ]; then
+if [ $? -ne 4 ] && [ "$os" != "SunOS" ]; then
     echo "Enhanced getopt is not available, add it to your PATH?"
     exit 1
 fi
diff --git a/x86/Makefile.common b/x86/Makefile.common
index b903988..0a0f7b9 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -62,7 +62,7 @@ else
 .PRECIOUS: %.elf %.o
 
 %.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o)
-	$(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,$(SRCDIR)/x86/flat.lds \
+	$(LD) -T $(SRCDIR)/x86/flat.lds -nostdlib -o $@ \
 		$(filter %.o, $^) $(FLATLIBS)
 	@chmod a-x $@
 
@@ -98,8 +98,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) -m elf_i386 -nostdlib -o $@ \
+	      -T $(SRCDIR)/$(TEST_DIR)/realmode.lds $^
 
 $(TEST_DIR)/realmode.o: bits = $(if $(call cc-option,-m16,""),16,32)
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2022-06-02 11:32 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 20:45 [PATCH] kvm-unit-tests: Build changes for illumos Dan Cross
2022-05-12 22:05 ` Sean Christopherson
2022-05-13  1:07   ` [PATCH 0/2] kvm-unit-tests: Build changes to support illumos Dan Cross
2022-05-13  1:07     ` [PATCH 1/2] kvm-unit-tests: invoke $LD explicitly in Dan Cross
2022-05-13  1:07     ` [PATCH 2/2] kvm-unit-tests: configure changes for illumos Dan Cross
2022-05-13 14:34       ` Sean Christopherson
2022-05-19  9:53         ` Thomas Huth
2022-05-24 21:20           ` Dan Cross
2022-05-25  7:41             ` Thomas Huth
2022-05-24 21:22         ` Dan Cross
2022-05-25  7:44           ` Thomas Huth
2022-05-26  7:11             ` Andrew Jones
2022-05-26 17:39               ` [PATCH 0/2] kvm-unit-tests: Build changes to support illumos Dan Cross
2022-05-26 17:39                 ` [PATCH 1/2] kvm-unit-tests: invoke $LD explicitly in Dan Cross
2022-05-26 21:17                   ` Sean Christopherson
2022-06-01  7:03                   ` Thomas Huth
2022-06-01 17:09                     ` Dan Cross
2022-06-01 17:43                       ` Andrew Jones
2022-06-01 21:51                         ` Dan Cross
2022-06-01 21:57                           ` [PATCH v4 0/2] kvm-unit-tests: Build changes to support illumos Dan Cross
2022-06-01 21:57                             ` [PATCH v4 1/2] kvm-unit-tests: configure changes for illumos Dan Cross
2022-06-01 21:57                             ` [PATCH v4 2/2] kvm-unit-tests: invoke $LD explicitly Dan Cross
2022-06-02 10:53                             ` [PATCH v4 0/2] kvm-unit-tests: Build changes to support illumos Thomas Huth
2022-06-02 11:32                               ` Dan Cross
2022-05-26 17:39                 ` [PATCH 2/2] kvm-unit-tests: configure changes for illumos Dan Cross
2022-05-26 21:23                   ` Sean Christopherson
2022-05-26 22:17                     ` Dan Cross
2022-05-27 14:41                       ` Sean Christopherson
2022-05-31 17:02                         ` Dan Cross
2022-05-26 17:40               ` Dan Cross
     [not found]   ` <CAA9fzEGdi0k8bkyXQwvt6gFd-gwHNNFF7A89U4DhtGHjKqe4AQ@mail.gmail.com>
2022-05-13  1:27     ` Fwd: [PATCH] kvm-unit-tests: Build " Dan Cross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.