summaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/compressed/Makefile
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2016-05-17 21:12:50 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2016-05-17 21:12:50 -0400
commite7ca7f9fa2cda220ba807620c992ce77c33a32ea (patch)
treefb8a6c1abc638c5a79645f4b9f44ece7c67187b4 /arch/x86/boot/compressed/Makefile
parent5f0dfb7a9bcc8139958f59ecb9bbd7e738ae702d (diff)
parentd65c8fff867a6450c58ce31572e883148a445ddf (diff)
downloadblackbird-op-linux-e7ca7f9fa2cda220ba807620c992ce77c33a32ea.tar.gz
blackbird-op-linux-e7ca7f9fa2cda220ba807620c992ce77c33a32ea.zip
Merge branch 'fixes' into misc
Diffstat (limited to 'arch/x86/boot/compressed/Makefile')
-rw-r--r--arch/x86/boot/compressed/Makefile14
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 6915ff2bd996..8774cb23064f 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -26,7 +26,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
-KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
+KBUILD_CFLAGS += -fno-strict-aliasing $(call cc-option, -fPIE, -fPIC)
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
cflags-$(CONFIG_X86_32) := -march=i386
cflags-$(CONFIG_X86_64) := -mcmodel=small
@@ -40,6 +40,18 @@ GCOV_PROFILE := n
UBSAN_SANITIZE :=n
LDFLAGS := -m elf_$(UTS_MACHINE)
+ifeq ($(CONFIG_RELOCATABLE),y)
+# If kernel is relocatable, build compressed kernel as PIE.
+ifeq ($(CONFIG_X86_32),y)
+LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker)
+else
+# To build 64-bit compressed kernel as PIE, we disable relocation
+# overflow check to avoid relocation overflow error with a new linker
+# command-line option, -z noreloc-overflow.
+LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
+ && echo "-z noreloc-overflow -pie --no-dynamic-linker")
+endif
+endif
LDFLAGS_vmlinux := -T
hostprogs-y := mkpiggy
OpenPOWER on IntegriCloud