git: 470f9f13de10 - main - Build clang and other llvm executables as PIE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 11 Feb 2024 18:45:44 UTC
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=470f9f13de10e47e6d45721c15af6b4abe7aad55 commit 470f9f13de10e47e6d45721c15af6b4abe7aad55 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-02-11 18:01:56 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-02-11 18:01:56 +0000 Build clang and other llvm executables as PIE 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 --- lib/clang/Makefile.inc | 6 +++++- usr.bin/clang/Makefile.inc | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/clang/Makefile.inc b/lib/clang/Makefile.inc index 2dfc966726b0..5a8ead5292c6 100644 --- a/lib/clang/Makefile.inc +++ b/lib/clang/Makefile.inc @@ -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 diff --git a/usr.bin/clang/Makefile.inc b/usr.bin/clang/Makefile.inc index 831cd56a8c25..8f812e24fcdb 100644 --- a/usr.bin/clang/Makefile.inc +++ b/usr.bin/clang/Makefile.inc @@ -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