[clang] [Clang] Add clang driver option -fpartition-static-data-sections (PR #124991)
Snehasish Kumar via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 23 22:13:12 PST 2025
snehasish wrote:
> > Can we ensure that `-z,keep-data-section-prefix` gets passed to the linker too from the driver? Should it be part of this pull request?
>
> I actually did wonder about it when making the changes; inferred from the current status, it's more canonical to let users specify linker options separately.
>
> [tools::gnutools::Linker::ConstructJob](https://github.com/llvm/llvm-project/blob/1cb99036b41562b233e7bb44801202742733f5d3/clang/lib/Driver/ToolChains/Gnu.cpp#L271) and its caller [LinkerWrapper::ConstructJob](https://github.com/llvm/llvm-project/blob/4e44e8761795d4672121368929b9c99f6dbaffa7/clang/lib/Driver/ToolChains/Clang.cpp#L9223) [1](#user-content-fn-1-26e65359c78b52e446e24e4987530693) constructs the linker options, and PGO linker options like `-keep-text-section-prefix` are not implied; toolchain users typically specify `-Wl,-z,keep-text-section-prefix` besides `-fprofile-use` to partition text sections.
>
> ## Footnotes
> 1. While 'gnu' is in the namespace / filename, the functions get invoked when compiling a binary the common way. [↩](#user-content-fnref-1-26e65359c78b52e446e24e4987530693)
Thanks for looking at it. As long as we have some documentation somewhere it sgtm.
https://github.com/llvm/llvm-project/pull/124991
More information about the cfe-commits
mailing list