This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Provide an option to use relative paths in debug info
ClosedPublic

Authored by phosek on May 29 2019, 12:59 PM.

Details

Summary

CMake always uses absolute file paths in the generated compiler
invocation which results in absolute file paths being embedded in debug
info. This is undesirable when building a toolchain e.g. on bots as the
debug info may embed the bot source checkout path which is meaningless
anywhere else.

This change introduces the LLVM_USE_RELATIVE_PATHS which uses
-fdebug-prefix-map (where supported) options to rewrite paths embedded
into debug info with relative ones. Additionally, LLVM_SOURCE_PREFIX can
be used to override the path to source directory with a different one.

Diff Detail

Event Timeline

phosek created this revision.May 29 2019, 12:59 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 29 2019, 12:59 PM
phosek updated this revision to Diff 202064.May 29 2019, 2:44 PM

-DLLVM_USE_RELATIVE_PATHS is very generic sounding and might give a false impression. Is there a name that emphasizes that this affects the debug info of the built compiler?

-DLLVM_USE_RELATIVE_PATHS is very generic sounding and might give a false impression. Is there a name that emphasizes that this affects the debug info of the built compiler?

How about LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO or LLVM_ENABLE_RELOCATABLE_DEBUG_INFO?

I like LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO.

phosek updated this revision to Diff 202310.May 30 2019, 2:55 PM

I like LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO.

Done

aprantl accepted this revision.May 30 2019, 4:47 PM
This revision is now accepted and ready to land.May 30 2019, 4:47 PM
This revision was automatically updated to reflect the committed changes.