[PATCH] D129401: [libLTO] Set data-sections by default in libLTO for ELF and XCOFF.
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 19 22:28:38 PDT 2022
MaskRay added a comment.
I am unsure about the `llvm/lib/LTO/LTOCodeGenerator.cpp` logic. Can't your downstream project set `Config.Options.DataSections = true;` instead?
================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:572
CmdArgs.push_back("-plugin-opt=-function-sections");
}
----------------
Shouldn't function-sections be updated as well?
================
Comment at: llvm/lib/LTO/LTOCodeGenerator.cpp:352
+ if (!codegen::getExplicitDataSections() &&
+ (ObjectFormat == llvm::Triple::ObjectFormatType::ELF ||
+ ObjectFormat == llvm::Triple::ObjectFormatType::XCOFF))
----------------
No need to check ObjectFormat. All (except Mach-O) lld ports default to function-sections/data-sections.
function-sections/data-sections is a no-op in Mach-O and setting the options don't hurt.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129401/new/
https://reviews.llvm.org/D129401
More information about the cfe-commits
mailing list