Skip to content

Commit 020d7f1

Browse files
t-8chmasahir0y
authored andcommitted
Revert "kbuild: make all file references relative to source root"
This reverts commit cacd22c. -ffile-prefix-map breaks the ability of debuggers to find the source file corresponding to object files. As there is no simple or uniform way to specify the source directory explicitly, this breaks developers workflows. Revert the unconditional usage of -ffile-prefix-map. Reported-by: Matthieu Baerts <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Reported-by: Ville Syrjälä <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Fixes: cacd22c ("kbuild: make all file references relative to source root") Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent f0e4b33 commit 020d7f1

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Documentation/kbuild/reproducible-builds.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ The kernel embeds the building user and host names in
4646
`KBUILD_BUILD_USER and KBUILD_BUILD_HOST`_ variables. If you are
4747
building from a git commit, you could use its committer address.
4848

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+
4964
Generated files in source packages
5065
----------------------------------
5166

@@ -116,5 +131,7 @@ See ``scripts/setlocalversion`` for details.
116131

117132
.. _KBUILD_BUILD_TIMESTAMP: kbuild.html#kbuild-build-timestamp
118133
.. _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/
119136
.. _Reproducible Builds project: https://reproducible-builds.org/
120137
.. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ KBUILD_CFLAGS += -fno-builtin-wcslen
10681068

10691069
# change __FILE__ to the relative path to the source directory
10701070
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)/=)
10721072
KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/=
10731073
endif
10741074

0 commit comments

Comments
 (0)