File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,21 @@ The kernel embeds the building user and host names in
46
46
`KBUILD_BUILD_USER and KBUILD_BUILD_HOST `_ variables. If you are
47
47
building from a git commit, you could use its committer address.
48
48
49
+ Absolute filenames
50
+ ------------------
51
+
52
+ When the kernel is built out-of-tree, debug information may include
53
+ absolute filenames for the source files. This must be overridden by
54
+ including the ``-fdebug-prefix-map `` option in the `KCFLAGS `_ variable.
55
+
56
+ Depending on the compiler used, the ``__FILE__ `` macro may also expand
57
+ to an absolute filename in an out-of-tree build. Kbuild automatically
58
+ uses the ``-fmacro-prefix-map `` option to prevent this, if it is
59
+ supported.
60
+
61
+ The Reproducible Builds web site has more information about these
62
+ `prefix-map options `_.
63
+
49
64
Generated files in source packages
50
65
----------------------------------
51
66
@@ -116,5 +131,7 @@ See ``scripts/setlocalversion`` for details.
116
131
117
132
.. _KBUILD_BUILD_TIMESTAMP : kbuild.html#kbuild-build-timestamp
118
133
.. _KBUILD_BUILD_USER and KBUILD_BUILD_HOST : kbuild.html#kbuild-build-user-kbuild-build-host
134
+ .. _KCFLAGS : kbuild.html#kcflags
135
+ .. _prefix-map options : https://reproducible-builds.org/docs/build-path/
119
136
.. _Reproducible Builds project : https://reproducible-builds.org/
120
137
.. _SOURCE_DATE_EPOCH : https://reproducible-builds.org/docs/source-date-epoch/
Original file line number Diff line number Diff line change @@ -1068,7 +1068,7 @@ KBUILD_CFLAGS += -fno-builtin-wcslen
1068
1068
1069
1069
# change __FILE__ to the relative path to the source directory
1070
1070
ifdef building_out_of_srctree
1071
- KBUILD_CPPFLAGS += $(call cc-option,-ffile -prefix-map=$(srcroot ) /=)
1071
+ KBUILD_CPPFLAGS += $(call cc-option,-fmacro -prefix-map=$(srcroot ) /=)
1072
1072
KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot ) /=
1073
1073
endif
1074
1074
You can’t perform that action at this time.
0 commit comments