]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFS r352754: Add WITH_PIE knob to build Position Independent Executables
authorEd Maste <emaste@FreeBSD.org>
Thu, 26 Sep 2019 18:37:58 +0000 (18:37 +0000)
committerEd Maste <emaste@FreeBSD.org>
Thu, 26 Sep 2019 18:37:58 +0000 (18:37 +0000)
commit349a1e572466e410130570a575ee09fef5903f11
treefbd0b2afcefabe121dbc803b55b0e0916f4d2f82
parent642a35af1574e2354afe17cd265f6176acb0f031
MFS r352754: Add WITH_PIE knob to build Position Independent Executables

MFC r344179: 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.

MFC r344181: Fix Makefile conditional after r344179

MFC r344182: Use make's :tl instead of checking "no" and "NO"

MFC r344189: Fixup bsd.prog.mk after r344182

MFC r344211: wlandebug: disable PIE to fix build failure

libifconfig is built as a static-only PRIVATELIB (and there is no _pie.a
version) so disable PIE in libifconfig's consumer.

r345489: Fix GNU objdump build under WITH_PIE

Explicitly specified bare .a libraries need ${PIE_SUFFIX}.

r345490: Apply WITH_PIE changes to other binutils components

Followon to r345489, explicitly specified bare .a libraries need
${PIE_SUFFIX} (although these still built).

r345778: Fix gdb/kgdb build under WITH_PIE

Explicitly specified bare .a libraries need ${PIE_SUFFIX}.

Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
20 files changed:
gnu/usr.bin/binutils/as/Makefile
gnu/usr.bin/binutils/ld/Makefile
gnu/usr.bin/binutils/objcopy/Makefile
gnu/usr.bin/binutils/objdump/Makefile
gnu/usr.bin/gdb/gdb/Makefile
gnu/usr.bin/gdb/kgdb/Makefile
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
usr.sbin/wlandebug/Makefile