|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v2 1/2] build: Use GCC for linking
Hi Sharan, On 14.05.2018 14:12, Sharan Santhanam wrote: Hello Simon, Please find the review comments below: On 05/11/2018 04:24 PM, Simon Kuenzer wrote:Instead of using `ld` directly, `gcc` is used for linking. `gcc` is going to call `ld` but provides further optimizations options that could be used for building images later (e.g., LTO).* The gcc wiki suggests this: https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ#ar.2C_nm_and_ranlib"If you try to build bigger projects with -flto you have to make sure that you use a version of binutils that supports gcc's liblto_plugin. Since version 4.9 gcc produces slim object files that only contain the intermediate representation. In order to handle archives of these objects you have to use the gcc wrappers: gcc-ar, gcc-nm and gcc-ranlib. (The next version of binutils will support automatic loading of the liblto_plugin.) "If we using the changing ld to gcc, we should also use the rest of the binutils utility as suggested. Thanks for pointing this out. I agree, we should use also the rest of the build tools. I am going to prepare a v2 where I replace nm with gcc-nm, and ar with gcc-ar. We are not using ranlib for now. * The following gcc documentation list the possible optimization options. https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.htmlThe -flto and -fwhole-program option are incompatible. There are also other compiler optimization option used in combination with -flto. Do we consider those option as a part of this patch or do we support those options. I think this comment is related to patch 2/2 that introduces LTO, right? I intended to introduce initial LTO support as a trial first (default is off) and I am expecting to have patches later that provide more configuration options if needed. Signed-off-by: Simon Kuenzer<simon.kuenzer@xxxxxxxxx> --- Makefile | 2 +- Makefile.uk | 8 ++++---- plat/kvm/Linker.uk | 8 ++++---- plat/linuxu/Linker.uk | 2 +- plat/xen/Linker.uk | 16 ++++++++-------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index b177bff..23ebe21 100644 --- a/Makefile +++ b/Makefile @@ -387,7 +387,7 @@ CROSS_COMPILE := $(CROSS_COMPILE:"%"=%) include $(UK_BASE)/arch/$(UK_ARCH)/Compiler.uk# Make variables (CC, etc...)-LD := $(CROSS_COMPILE)ld +LD := $(CROSS_COMPILE)gcc CC := $(CROSS_COMPILE)gcc CPP := $(CC) CXX := $(CPP) diff --git a/Makefile.uk b/Makefile.uk index 5855b40..c540ada 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -20,8 +20,8 @@ CXXINCLUDES += -nostdinc -nostdlib -I$(UK_BASE)/include # Set the text and data sections to be readable and writable. Also, # do not page-align the data segment. If the output format supports # Unix style magic numbers, mark the output as OMAGIC. -LIBLDFLAGS += --omagic -r -LDFLAGS += --omagic +LIBLDFLAGS += -nostdinc -nostdlib -Wl,--omagic -Wl,-r +LDFLAGS += -nostdinc -nostdlib -Wl,--omagic -Wl,--build-id=noneCFLAGS-$(OPTIMIZE_NONE) += -O0 -fno-optimize-sibling-calls -fno-tree-vectorizeCXXFLAGS-$(OPTIMIZE_NONE) += -O0 -fno-optimize-sibling-calls -fno-tree-vectorize @@ -32,12 +32,12 @@ CXXFLAGS-$(OPTIMIZE_SIZE) += -OsCFLAGS-$(OPTIMIZE_DEADELIM) += -fdata-sections -ffunction-sectionsCXXFLAGS-$(OPTIMIZE_DEADELIM) += -fdata-sections -ffunction-sections -LDFLAGS-$(OPTIMIZE_DEADELIM) += --gc-sections +LDFLAGS-$(OPTIMIZE_DEADELIM) += -Wl,--gc-sectionsifneq ($(DEBUG_SYMBOLS),y)CFLAGS += -g0 CXXFLAGS += -g0 -LDFLAGS-y += --strip-debug +LDFLAGS-y += -Wl,--strip-debug else CFLAGS-$(DEBUG_SYMBOLS_LVL1) += -g1 CXXFLAGS-$(DEBUG_SYMBOLS_LVL1) += -g1 diff --git a/plat/kvm/Linker.uk b/plat/kvm/Linker.uk index 7957b7a..a91a786 100644 --- a/plat/kvm/Linker.uk +++ b/plat/kvm/Linker.uk @@ -1,6 +1,6 @@ ifeq (x86_64,$(UK_ARCH)) -KVM_LDSCRIPT := $(UK_BASE)/plat/kvm/x86/link64.ld -KVM_LDFLAGS-y += -m elf_x86_64 +KVM_LDSCRIPT := -Wl,-T,$(UK_BASE)/plat/kvm/x86/link64.ld +KVM_LDFLAGS-y += -Wl,-m,elf_x86_64 endif##@@ -10,12 +10,12 @@ KVM_IMAGE := $(BUILD_DIR)/$(UK_NAME)_kvm-$(UK_ARCH)$(KVM_IMAGE): $(KVM_LINK) $(KVM_LINK-y) $(UK_LINK) $(UK_LINK-y) Thanks, Simon _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |