-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path0004-UBUNTU-SAUCE-no-up-disable-pie-when-gcc-has-it-enabl.patch
52 lines (45 loc) · 2.04 KB
/
0004-UBUNTU-SAUCE-no-up-disable-pie-when-gcc-has-it-enabl.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From f1768c44584f107377952ad527c77abcded4bcc3 Mon Sep 17 00:00:00 2001
From: Steve Beattie <[email protected]>
Date: Tue, 10 May 2016 12:44:04 +0100
Subject: [PATCH 4/6] UBUNTU: SAUCE: (no-up) disable -pie when gcc has it
enabled by default
In Ubuntu 16.10, gcc's defaults have been set to build Position
Independent Executables (PIE) on amd64 and ppc64le (gcc was configured
this way for s390x in Ubuntu 16.04 LTS). This breaks the kernel build on
amd64. The following patch disables pie for x86 builds (though not yet
verified to work with gcc configured to build PIE by default i386 --
we're not planning to enable it for that architecture).
The intent is for this patch to go upstream after expanding it to
additional architectures where needed, but I wanted to ensure that
we could build 16.10 kernels first. I've successfully built kernels
and booted them with this patch applied using the 16.10 compiler.
Patch is against yakkety.git, but also applies with minor movement
(no fuzz) against current linus.git.
Signed-off-by: Steve Beattie <[email protected]>
[[email protected]: shifted up so works in arch/<arch/Makefile.]
BugLink: http://bugs.launchpad.net/bugs/1574982
Signed-off-by: Andy Whitcroft <[email protected]>
Acked-by: Tim Gardner <[email protected]>
Acked-by: Stefan Bader <[email protected]>
Signed-off-by: Kamal Mostafa <[email protected]>
---
Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile b/Makefile
index 9c60120..a0948f1 100644
--- a/Makefile
+++ b/Makefile
@@ -609,6 +609,12 @@ endif # $(dot-config)
# Defaults to vmlinux, but the arch makefile usually adds further targets
all: vmlinux
+# force no-pie for distro compilers that enable pie by default
+KBUILD_CFLAGS += $(call cc-option, -fno-pie)
+KBUILD_CFLAGS += $(call cc-option, -no-pie)
+KBUILD_AFLAGS += $(call cc-option, -fno-pie)
+KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)
+
# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
# values of the respective KBUILD_* variables
ARCH_CPPFLAGS :=
--
2.7.4