diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2020-06-14 23:43:40 +0900 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2020-06-29 20:08:02 -0400 |
commit | ea4f911f9c1ab2d8a37af68e18f0de2988b89d26 (patch) | |
tree | dbb861c370acd23ab75e58b6a0dc0a4d10c89a00 /kernel | |
parent | 120736d175d2b339f1cdb98577ee09be89356275 (diff) | |
download | linux-stable-ea4f911f9c1ab2d8a37af68e18f0de2988b89d26.tar.gz linux-stable-ea4f911f9c1ab2d8a37af68e18f0de2988b89d26.tar.bz2 linux-stable-ea4f911f9c1ab2d8a37af68e18f0de2988b89d26.zip |
kbuild: improve cc-option to clean up all temporary files
[ Upstream commit f2f02ebd8f3833626642688b2d2c6a7b3c141fa9 ]
When cc-option and friends evaluate compiler flags, the temporary file
$$TMP is created as an output object, and automatically cleaned up.
The actual file path of $$TMP is .<pid>.tmp, here <pid> is the process
ID of $(shell ...) invoked from cc-option. (Please note $$$$ is the
escape sequence of $$).
Such garbage files are cleaned up in most cases, but some compiler flags
create additional output files.
For example, -gsplit-dwarf creates a .dwo file.
When CONFIG_DEBUG_INFO_SPLIT=y, you will see a bunch of .<pid>.dwo files
left in the top of build directories. You may not notice them unless you
do 'ls -a', but the garbage files will increase every time you run 'make'.
This commit changes the temporary object path to .tmp_<pid>/tmp, and
removes .tmp_<pid> directory when exiting. Separate build artifacts such
as *.dwo will be cleaned up all together because their file paths are
usually determined based on the base name of the object.
Another example is -ftest-coverage, which outputs the coverage data into
<base-name-of-object>.gcno
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions