]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add WITH_PIE knob to build Position Independent Executables
authoremaste <emaste@FreeBSD.org>
Fri, 15 Feb 2019 22:22:38 +0000 (22:22 +0000)
committeremaste <emaste@FreeBSD.org>
Fri, 15 Feb 2019 22:22:38 +0000 (22:22 +0000)
commit33a9dab77f3c9a454837e0508d19e6565d7e8cbc
treea3403fbbbcf38f01ce5d3bdf75c704803286c5df
parentef7c318587febc4cc88884105728c8a0bd038750
Add WITH_PIE knob to build Position Independent Executables

Building binaries as PIE allows the executable itself to be loaded at a
random address when ASLR is enabled (not just its shared libraries).

With this change PIE objects have a .pieo extension and INTERNALLIB
libraries libXXX_pie.a.

MK_PIE is disabled for some kerberos5 tools, Clang, and Subversion, as
they explicitly reference .a libraries in their Makefiles.  These can
be addressed on an individual basis later.  MK_PIE is also disabled for
rtld-elf because it is already position-independent using bespoke
Makefile rules.

Currently only dynamically linked binaries will be built as PIE.

Discussed with: dim
Reviewed by: kib
MFC after: 1 month
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18423
13 files changed:
kerberos5/tools/asn1_compile/Makefile
kerberos5/tools/slc/Makefile
lib/clang/Makefile.inc
libexec/rtld-elf/Makefile
share/mk/bsd.lib.mk
share/mk/bsd.opts.mk
share/mk/bsd.prog.mk
share/mk/src.libnames.mk
stand/i386/Makefile.inc
tools/build/options/WITHOUT_PIE [new file with mode: 0644]
tools/build/options/WITH_PIE [new file with mode: 0644]
usr.bin/clang/Makefile.inc
usr.bin/svn/Makefile.inc