[PATCH] D98465: Clean up unnecessary dependencies
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 12 10:42:45 PST 2021
MaskRay added a comment.
The `llvm/lib/DebugInfo/CodeView/CMakeLists.txt` change is fine. The change `llvm/lib/MC/CMakeLists.txt` is not.
Deleting a dependency needs to make sure the relevant components still (1) include what they use and (2) link what they use (the dependency for the direct include should be explicit specified).
(2) can be checked by making sure both `-DBUILD_SHARED_LIBS=on` and `-DBUILD_SHARED_LIBS=off` configurations still work. `-DBUILD_SHARED_LIBS=on` on Linux enables `-Wl,-z,defs` which requires every
shared object to have full direct dependencies specified (gold and ld.lld behavior; not in GNU ld). This makes for a more reliable build.
(1) is tricky to inspect. Bazel `layering_check` (`-fmodule-name=X -fmodules-strict-decluse`) can ensure an `error: module X does not depend on a module exporting 'string.h'` if a header file not mentioned by modulemap files is included.
MC actually includes DebugInfo/CodeView headers so the removal is not justified. Unfortunately the CMake -DLLVM_ENABLE_MODULES=on build does not specify `-fmodule-name=X -fmodules-strict-decluse` so this is difficult to enforce.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98465/new/
https://reviews.llvm.org/D98465
More information about the llvm-commits
mailing list