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

[mini-os master] x86: fix building with Clang



commit 078cba0bc93f48132a66764b36e95740b9e5630d
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Dec 13 10:48:41 2023 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Dec 13 10:48:41 2023 +0100

    x86: fix building with Clang
    
    It doesn't understand -fno-reorder-blocks. Whether without that option
    the resulting binary is actually functional I can't tell, though.
    
    For $(cc-option ...) to be usable in arch.mk, at least CC needs setting
    earlier in Config.mk. Move up the entire "Set tools" section.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
 Config.mk        | 54 +++++++++++++++++++++++++++---------------------------
 arch/x86/arch.mk |  3 ++-
 2 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/Config.mk b/Config.mk
index bfdf885..f2d1f0a 100644
--- a/Config.mk
+++ b/Config.mk
@@ -86,6 +86,33 @@ TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FAM)
 export TARGET_ARCH_DIR
 export TARGET_ARCH_FAM
 
+# Set tools
+AS         = $(CROSS_COMPILE)as
+LD         = $(CROSS_COMPILE)ld
+ifeq ($(clang),y)
+CC         = $(CROSS_COMPILE)clang
+LD_LTO     = $(CROSS_COMPILE)llvm-ld
+else
+CC         = $(CROSS_COMPILE)gcc
+LD_LTO     = $(CROSS_COMPILE)ld
+endif
+CPP        = $(CC) -E
+AR         = $(CROSS_COMPILE)ar
+RANLIB     = $(CROSS_COMPILE)ranlib
+NM         = $(CROSS_COMPILE)nm
+STRIP      = $(CROSS_COMPILE)strip
+OBJCOPY    = $(CROSS_COMPILE)objcopy
+OBJDUMP    = $(CROSS_COMPILE)objdump
+SIZEUTIL   = $(CROSS_COMPILE)size
+
+# Allow git to be wrappered in the environment
+GIT        ?= git
+
+INSTALL      = install
+INSTALL_DIR  = $(INSTALL) -d -m0755 -p
+INSTALL_DATA = $(INSTALL) -m0644 -p
+INSTALL_PROG = $(INSTALL) -m0755 -p
+
 # This is used for architecture specific links.
 # This can be overwritten from arch specific rules.
 ARCH_LINKS =
@@ -119,33 +146,6 @@ DEF_CPPFLAGS += -isystem $(LWIPDIR)/src/include
 DEF_CPPFLAGS += -isystem $(LWIPDIR)/src/include/ipv4
 endif
 
-# Set tools
-AS         = $(CROSS_COMPILE)as
-LD         = $(CROSS_COMPILE)ld
-ifeq ($(clang),y)
-CC         = $(CROSS_COMPILE)clang
-LD_LTO     = $(CROSS_COMPILE)llvm-ld
-else
-CC         = $(CROSS_COMPILE)gcc
-LD_LTO     = $(CROSS_COMPILE)ld
-endif
-CPP        = $(CC) -E
-AR         = $(CROSS_COMPILE)ar
-RANLIB     = $(CROSS_COMPILE)ranlib
-NM         = $(CROSS_COMPILE)nm
-STRIP      = $(CROSS_COMPILE)strip
-OBJCOPY    = $(CROSS_COMPILE)objcopy
-OBJDUMP    = $(CROSS_COMPILE)objdump
-SIZEUTIL   = $(CROSS_COMPILE)size
-
-# Allow git to be wrappered in the environment
-GIT        ?= git
-
-INSTALL      = install
-INSTALL_DIR  = $(INSTALL) -d -m0755 -p
-INSTALL_DATA = $(INSTALL) -m0644 -p
-INSTALL_PROG = $(INSTALL) -m0755 -p
-
 BOOT_DIR ?= /boot
 
 SOCKET_LIBS =
diff --git a/arch/x86/arch.mk b/arch/x86/arch.mk
index 00028a0..72d03f3 100644
--- a/arch/x86/arch.mk
+++ b/arch/x86/arch.mk
@@ -14,7 +14,8 @@ EXTRA_SRC += arch/$(EXTRA_INC)
 endif
 
 ifeq ($(MINIOS_TARGET_ARCH),x86_64)
-ARCH_CFLAGS := -m64 -mno-red-zone -fno-reorder-blocks
+ARCH_CFLAGS := -m64 -mno-red-zone
+ARCH_CFLAGS += $(call cc-option,$(CC),-fno-reorder-blocks)
 ARCH_CFLAGS += -fno-asynchronous-unwind-tables
 ARCH_ASFLAGS := -m64
 ARCH_LDFLAGS := -m elf_x86_64
--
generated by git-patchbot for /home/xen/git/mini-os.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.