[PATCH] tools: Makefile: hande compilers that default to pie

17 views
Skip to first unread message

Henning Schild

unread,
Jun 22, 2017, 8:45:43 AM6/22/17
to jailho...@googlegroups.com, florian, Henning Schild
From: Henning Schild <henning...@siemens.com>

Some distros enable their compilers to default to building
position independant executables. The linux kernel just
disables that when set, also for its tools.
In the inmates subdir we already have -no-pic so that is not
affected.

Reported-by: florian <flol...@googlemail.com>
Signed-off-by: Henning Schild <henning...@siemens.com>

diff --git a/tools/Makefile b/tools/Makefile
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -13,7 +13,7 @@
# includes installation-related variables and definitions
include $(src)/../scripts/include.mk

-LD = $(CC)
+LD = $(CC) $(KBUILD_CFLAGS)
NOSTDINC_FLAGS :=
LINUXINCLUDE := -I$(src)/../driver
KBUILD_CFLAGS := -g -O3 -DLIBEXECDIR=\"$(libexecdir)\" \
@@ -22,6 +22,10 @@ KBUILD_CFLAGS := -g -O3 -DLIBEXECDIR=\"$
LDFLAGS :=
GCOV_PROFILE := n

+# 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)
+
BINARIES := jailhouse

HELPERS := \

Ralf Ramsauer

unread,
Jun 22, 2017, 9:47:57 AM6/22/17
to Henning Schild, jailho...@googlegroups.com, florian
Hi Henning,

On 06/22/2017 02:47 PM, Henning Schild wrote:
> From: Henning Schild <henning...@siemens.com>
>
> Some distros enable their compilers to default to building
> position independant executables. The linux kernel just
> disables that when set, also for its tools.
> In the inmates subdir we already have -no-pic so that is not
> affected.
>
> Reported-by: florian <flol...@googlemail.com>
Didn't "mike <diede...@gmail.com>" report that?

Ralf

Henning Schild

unread,
Jun 22, 2017, 12:00:20 PM6/22/17
to Ralf Ramsauer, jailho...@googlegroups.com, florian
Am Thu, 22 Jun 2017 15:47:56 +0200
schrieb Ralf Ramsauer <ralf.r...@oth-regensburg.de>:

> Hi Henning,
>
> On 06/22/2017 02:47 PM, Henning Schild wrote:
> > From: Henning Schild <henning...@siemens.com>
> >
> > Some distros enable their compilers to default to building
> > position independant executables. The linux kernel just
> > disables that when set, also for its tools.
> > In the inmates subdir we already have -no-pic so that is not
> > affected.
> >
> > Reported-by: florian <flol...@googlemail.com>
> Didn't "mike <diede...@gmail.com>" report that?

Indeed, Thanks!
Henning

Henning Schild

unread,
Jun 22, 2017, 12:02:46 PM6/22/17
to jailho...@googlegroups.com, mike, Henning Schild
From: Henning Schild <henning...@siemens.com>

Some distros enable their compilers to default to building
position independant executables. The linux kernel just
disables that when set, also for its tools.
In the inmates subdir we already have -no-pic so that is not
affected.

Reported-by: mike <diede...@gmail.com>

Jan Kiszka

unread,
Jul 3, 2017, 2:29:38 AM7/3/17
to Henning Schild, jailho...@googlegroups.com, mike
Thanks, applied.

Jan

--
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
Reply all
Reply to author
Forward
0 new messages