llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.87k stars 11.93k forks source link

Thin LTO .map files refer to non-existing files (got renamed). #36366

Open llvmbot opened 6 years ago

llvmbot commented 6 years ago
Bugzilla Link 37018
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @rui314

Extended Description

If we use LTO and generate .map files, the resulting file contains links to files such as

However, these files don't exist, because they got renamed to files like

As a result, the data in .map file are not as useful as they should be.

For my specific case, the problem is encountered for Chromium (Linux) ######## Repro instructions ########

cd chrome/src # Wherever this is. gn gen out/test gn args out/test # Launches editor.

Paste the following into the

is_debug = false is_official_build = true generate_linker_map = true use_lld = true use_thin_lto = true

Save and close

ninja -j100 -l15 -C out/test zucchini

cd out/test gunzip zucchini.map.gz

Open zucchini.map, note ref to lto.tmp & thinlto-cache/Thin-*.tmp.o files.

cd thinlto-cache ls # See llvmcache- files, but no lto.tmp or Thin-.tmp.o files. ########

Looks like the renaming code lives in .../llvm/lib/LTO/Cachine.cpp , but .map file is generated before rename occurs? Perhaps we should have .map refer to final file names, or also provide a map from temp files to final files?

rui314 commented 6 years ago

This sounds more like an issue of LLVM LTO code than lld because it's not lld who manages the cache directory. Generated .o files should have correct pathnames before returned to lld.