Skip to content

Commit

Permalink
Build clang and other llvm executables as PIE
Browse files Browse the repository at this point in the history
There is no reason anymore to not build these as PIE. Unfortunately
bsd.lib.mk does not allow for building _only_ PIE static libraries, so
lib/clang/Makefile.inc needs a kludge to work around that issue.

MFC after:	1 week
  • Loading branch information
DimitryAndric committed Feb 11, 2024
1 parent 0d3b2bd commit 470f9f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/clang/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
.include <bsd.compiler.mk>

PACKAGE= clang
MK_PIE:= no # Explicit libXXX.a references

# Build only PIE static libraries; bsd.lib.mk does support this directly.
MK_PIE:= no
CFLAGS+= ${PIEFLAG} ${SHARED_CFLAGS}
CXXFLAGS+= ${PIEFLAG} ${SHARED_CXXFLAGS}

.if ${COMPILER_TYPE} == "clang"
DEBUG_FILES_CFLAGS= -gline-tables-only
Expand Down
2 changes: 0 additions & 2 deletions usr.bin/clang/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ WARNS?= 0

.include <bsd.compiler.mk>

MK_PIE:= no # Explicit libXXX.a references

.if ${COMPILER_TYPE} == "clang"
DEBUG_FILES_CFLAGS= -gline-tables-only
.else
Expand Down

0 comments on commit 470f9f1

Please sign in to comment.