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

Re: [Minios-devel] [UNIKRAFT PATCH 7/9] build: Add a macro to check and add gcc flags for target CPU





On 15.03.2018 04:39, Wei Chen wrote:
In later patches, we will add gcc flags for new added ARM64 CPUs.
We have to check and add flags for each target CPU. So it's better
to add a macro to reduce redundancy Makefile codes.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
  arch/arm/Makefile.uk | 12 ++++++++++++
  1 file changed, 12 insertions(+)

diff --git a/arch/arm/Makefile.uk b/arch/arm/Makefile.uk
index 780a035..e7f7b49 100644
--- a/arch/arm/Makefile.uk
+++ b/arch/arm/Makefile.uk
@@ -1,3 +1,15 @@
+# define a macro to check the GCC version and add optimization flags
+# for target CPU:
+# $(1): The flag for -march
+# $(2): The flag for -mcpu and -mtune
+# $(3): The minimum GCC major number for target CPU
+# $(4): The minimum GCC minor number for target CPU
+define set_cc_flags =
+$(call check_valid_gcc_version,$(3),$(4),$(2))
+CFLAGS-y   += -march=$(1) -mcpu=$(2) -mtune=$(2)
+CXXFLAGS-y += -march=$(1) -mcpu=$(2) -mtune=$(2)
+endef
+

In order to avoid any definition clashes in the future, I prefer to have this in support/build/Makefile.rules . The name "set_cc_flags" is also too generic, it could mean setting of any type of cc flag. Can you choose something that is closer? It checks that GCC supports a target cpu and sets the GCC parameters.

  # Setup compiler flags and objects for arm32
  ifeq ($(UK_ARCH),arm)

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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