git: d616ae46b484 - main - Add fileprefixmap compiler feature

Brooks Davis brooks at FreeBSD.org
Wed Feb 17 22:27:22 UTC 2021


The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=d616ae46b4849b0678326dfacbba5fd7c8febbea

commit d616ae46b4849b0678326dfacbba5fd7c8febbea
Author:     Dan McGregor <dan.mcgregor at usask.ca>
AuthorDate: 2021-02-17 22:26:49 +0000
Commit:     Brooks Davis <brooks at FreeBSD.org>
CommitDate: 2021-02-17 22:26:49 +0000

    Add fileprefixmap compiler feature
    
    -ffile-prefix-map=<old>=<new> is a compiler feature first added in
    GCC 8, and implemented for clang 10. It remaps old paths to new paths
    in both debug information and __FILE__ and __BASE_FILE__ macros. It can
    be used to improve reproducibility or to hide local system directories.
    
    I intend to use it to replace the real source directory and real object
    directory with constant values across all builds.
    
    Reviewed by:    brooks
    Differential Revision:  https://reviews.freebsd.org/D28632
---
 share/mk/bsd.compiler.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk
index fa8e6c44a17e..0d8f02489f00 100644
--- a/share/mk/bsd.compiler.mk
+++ b/share/mk/bsd.compiler.mk
@@ -226,6 +226,10 @@ ${X_}COMPILER_FEATURES+=	c++17
 .if ${${X_}COMPILER_TYPE} == "clang"
 ${X_}COMPILER_FEATURES+=	retpoline init-all
 .endif
+.if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 100000 || \
+	(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 80100)
+${X_}COMPILER_FEATURES+=	fileprefixmap
+.endif
 
 .else
 # Use CC's values


More information about the dev-commits-src-main mailing list