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

Re: [Minios-devel] [UNIKRAFT PATCH v2 2/2] build: Provide LTO as build option



Hey Sharan,

On 14.05.2018 14:17, Sharan Santhanam wrote:
Hello Simon,

Please find the comments below:

On 05/11/2018 04:24 PM, Simon Kuenzer wrote:
Introduces a build option that enables link time optmizations (LTO).
When enabled, GCC is doing code optimization also while linking.
Although the overall building time is increased, more efficient
Unikraft images can be created.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
  Config.uk   | 8 ++++++++
  Makefile.uk | 6 ++++++
  2 files changed, 14 insertions(+)

diff --git a/Config.uk b/Config.uk
index eea961e..21cec9b 100644
--- a/Config.uk
+++ b/Config.uk
@@ -78,6 +78,14 @@ config OPTIMIZE_DEADELIM
  comment "Hint: Enable dropping of unused code to further reduce target image size"
      depends on OPTIMIZE_SIZE && !OPTIMIZE_DEADELIM
+config OPTIMIZE_LTO
+    bool "Link time optimizations (LTO)"
+    default n
+    help
+        Enables GCC to do code optimizations during linking. This option
+        will increase overall building time but creates more efficient
+        Unikraft binaries.
+

gcc support stable LTO option since version 4.7. We may have to add checks to verify if the LTO option can be enabled with the gcc version.


Yes, this is true. For now we are not doing any checks about the used GCC version. ARM's patch series is going to introducing a GCC version checking subsystem. We could make use of this one as soon this series is in. We can then force the user to use GCC >= 4.7 for compiling with LTO.

  config DEBUG_SYMBOLS
      bool "Debugging information"
      default n
diff --git a/Makefile.uk b/Makefile.uk
index c540ada..1964563 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -34,6 +34,12 @@ CFLAGS-$(OPTIMIZE_DEADELIM)        += -fdata-sections -ffunction-sections   CXXFLAGS-$(OPTIMIZE_DEADELIM)      += -fdata-sections -ffunction-sections
  LDFLAGS-$(OPTIMIZE_DEADELIM)       += -Wl,--gc-sections
+# LTO requires the compiler flags to be handed over also for linking
+CFLAGS-$(OPTIMIZE_LTO)             += -flto
+CXXFLAGS-$(OPTIMIZE_LTO)           += -flto
+LIBLDFLAGS-$(OPTIMIZE_LTO)         += $(CFLAGS) $(CFLAGS-y)
+LDFLAGS-$(OPTIMIZE_LTO)            += $(CFLAGS) $(CFLAGS-y)
+
  ifneq ($(DEBUG_SYMBOLS),y)
  CFLAGS                             += -g0
  CXXFLAGS                           += -g0

The rest of the patch is fine.


Thanks & Regards
Sharan Santhanam

Thanks,

Simon

_______________________________________________
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®.