[flang-commits] [clang] [flang] [flang] Support -ffunction-sections and -fdata-sections. (PR #199731)
Abid Qadeer via flang-commits
flang-commits at lists.llvm.org
Fri May 29 12:47:19 PDT 2026
================
@@ -262,6 +262,18 @@ void Flang::addCodegenOptions(const ArgList &Args,
options::OPT_fstack_repack_arrays, options::OPT_fno_stack_repack_arrays,
options::OPT_ftime_report, options::OPT_ftime_report_EQ,
options::OPT_funroll_loops, options::OPT_fno_unroll_loops});
+
+ const llvm::Triple &Triple = getToolChain().getEffectiveTriple();
+ bool UseSeparateSections = isUseSeparateSections(Triple);
+ if (Args.hasFlag(options::OPT_ffunction_sections,
+ options::OPT_fno_function_sections, UseSeparateSections))
+ CmdArgs.push_back("-ffunction-sections");
+
+ bool HasDefaultDataSections = Triple.isOSBinFormatXCOFF();
+ if (Args.hasFlag(options::OPT_fdata_sections, options::OPT_fno_data_sections,
+ UseSeparateSections || HasDefaultDataSections))
+ CmdArgs.push_back("-fdata-sections");
+
----------------
abidh wrote:
I have moved the processing to a shared helper.
https://github.com/llvm/llvm-project/pull/199731
More information about the flang-commits
mailing list