From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [PATCH kvm-unit-tests 1/5] Makefile: Disable PIE as GCC enables it by default from 6.2.0-7 Date: Mon, 16 Jan 2017 14:38:24 +0100 Message-ID: <20170116133828.17908-2-drjones@redhat.com> References: <20170116133828.17908-1-drjones@redhat.com> Cc: pbonzini@redhat.com, Gavin Guo , Hsiangkai Wang , Cole Wang To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:47318 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751437AbdAPNic (ORCPT ); Mon, 16 Jan 2017 08:38:32 -0500 In-Reply-To: <20170116133828.17908-1-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Gavin Guo Build fail can be observed while the kvm-unit-tests builds on Ubuntu Yakkety/Zesty release: /usr/bin/ld: x86/cstart64.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC and can be fixed by adding "-fno-pic" and "-no-pie" option. There are other discussions: - gcc-6 6.2.0-7 breaks kernel build if stack protection is enabled https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841368 - [yakkety,RFC,v1] disable -pie when gcc has it enabled by default https://patchwork.ozlabs.org/patch/616621/ - https://wiki.ubuntu.com/YakketyYak/ReleaseNotes#GCC Signed-off-by: Gavin Guo Signed-off-by: Hsiangkai Wang Signed-off-by: Cole Wang Tested-by: Po-Hsu Lin --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index af4e3fdfc212..16ce2970d171 100644 --- a/Makefile +++ b/Makefile @@ -51,11 +51,14 @@ fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "") fnostack_protector := $(call cc-option, -fno-stack-protector, "") fnostack_protector_all := $(call cc-option, -fno-stack-protector-all, "") wno_frame_address := $(call cc-option, -Wno-frame-address, "") +fno_pic := $(call cc-option, -fno-pic, "") +no_pie := $(call cc-option, -no-pie, "") CFLAGS += $(fomit_frame_pointer) CFLAGS += $(fno_stack_protector) CFLAGS += $(fno_stack_protector_all) CFLAGS += $(wno_frame_address) CFLAGS += $(if $(U32_LONG_FMT),-D__U32_LONG_FMT__,) +CFLAGS += $(fno_pic) $(no_pie) CXXFLAGS += $(CFLAGS) -- 2.9.3