The option does not change IR but affect object file generation. Without a
backend option the option is a no-op for in-process ThinLTO.
The problem is known and there are many options similar to -fstack-size-section.
That said, -fstack-size-section has relatively wider adoption, so it probably
makes sense to have custom code for it.
Close https://github.com/llvm/llvm-project/issues/59424
D.Diag(clang::diag::warn_drv_fjmc_for_elf_only);
}
+ if (Args.hasFlag(options::OPT_fstack_size_section,
+ options::OPT_fno_stack_size_section, false))
+ CmdArgs.push_back(
+ Args.MakeArgString(Twine(PluginOptPrefix) + "-stack-size-section"));
+
// Setup statistics file output.
SmallString<128> StatsFile = getStatsFileName(Args, Output, Input, D);
if (!StatsFile.empty())
// RUN: %clang -target x86_64-unknown -fno-stack-size-section -fstack-size-section %s -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PRESENT
+// RUN: %clang -### --target=x86_64-linux-gnu -flto -fstack-size-section %s 2>&1 | FileCheck %s --check-prefix=LTO
+// RUN: %clang -### --target=x86_64-linux-gnu -flto -fstack-size-section -fno-stack-size-section %s 2>&1 | FileCheck %s --check-prefix=LTO-NO
+
+// LTO: "-plugin-opt=-stack-size-section"
+// LTO-NO-NOT: "-plugin-opt=-stack-size-section"
+
int foo() { return 42; }