From: riku.voipio@linaro.org
To: kvm@vger.kernel.org
Cc: will.deacon@arm.com, Riku Voipio <riku.voipio@linaro.org>
Subject: [PATCH v2] kvmtool: Makefile: disable PIE build for bios and pre_init
Date: Fri, 4 Nov 2016 15:28:00 +0200 [thread overview]
Message-ID: <20161104132800.11786-1-riku.voipio@linaro.org> (raw)
From: Riku Voipio <riku.voipio@linaro.org>
Latest Debian and Ubuntu GCC default to PIE code. Disable
PIC for bios and PIE for pre_init. Since the flag -no-pie
is not available on older GCC's, make use of flag only if
the option is available. -fno-pic is more widely available
and should be safe to enable uncondionally.
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
v2: BIOS_FLAGS doesn't need -no-pie so don't set it
Makefile | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 1f0196f..eeb54a4 100644
--- a/Makefile
+++ b/Makefile
@@ -284,7 +284,7 @@ ifeq ($(call try-build,$(SOURCE_STATIC),$(CFLAGS),$(LDFLAGS) -static),y)
GUEST_INIT := guest/init
GUEST_OBJS = guest/guest_init.o
ifeq ($(ARCH_PRE_INIT),)
- GUEST_INIT_FLAGS += -static
+ GUEST_INIT_FLAGS += -static $(PIE_FLAGS)
else
CFLAGS += -DCONFIG_GUEST_PRE_INIT
GUEST_INIT_FLAGS += -DCONFIG_GUEST_PRE_INIT
@@ -307,6 +307,10 @@ ifeq (y,$(ARCH_WANT_LIBFDT))
endif
endif
+ifeq ($(call try-build,$(SOURCE_HELLO),$(CFLAGS),-no-pie),y)
+ PIE_FLAGS += -no-pie
+endif
+
ifneq ($(NOTFOUND),)
$(warning Skipping optional libraries: $(NOTFOUND))
endif
@@ -388,7 +392,7 @@ $(PROGRAM_ALIAS): $(PROGRAM)
ifneq ($(ARCH_PRE_INIT),)
$(GUEST_PRE_INIT): $(ARCH_PRE_INIT)
$(E) " LINK " $@
- $(Q) $(CC) -s -nostdlib $(ARCH_PRE_INIT) -o $@
+ $(Q) $(CC) -s $(PIE_FLAGS) -nostdlib $(ARCH_PRE_INIT) -o $@
$(Q) $(LD) -r -b binary -o guest/guest_pre_init.o $(GUEST_PRE_INIT)
endif
@@ -435,6 +439,7 @@ BIOS_CFLAGS += -march=i386
BIOS_CFLAGS += -mregparm=3
BIOS_CFLAGS += -fno-stack-protector
+BIOS_CFLAGS += -fno-pic
x86/bios.o: x86/bios/bios.bin x86/bios/bios-rom.h
--
2.10.1
reply other threads:[~2016-11-04 13:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161104132800.11786-1-riku.voipio@linaro.org \
--to=riku.voipio@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).