[clang] 5d24217 - [Clang] Pass -fseparate-named-sections from the driver (#91567)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 10 00:38:56 PDT 2024


Author: Petr Hosek
Date: 2024-05-10T00:38:52-07:00
New Revision: 5d24217c2c1c06358168cae65d3ff8632b28cd7d

URL: https://github.com/llvm/llvm-project/commit/5d24217c2c1c06358168cae65d3ff8632b28cd7d
DIFF: https://github.com/llvm/llvm-project/commit/5d24217c2c1c06358168cae65d3ff8632b28cd7d.diff

LOG: [Clang] Pass -fseparate-named-sections from the driver (#91567)

This is a follow up to #91028.

Added: 
    clang/test/Driver/fseparate-named-sections.c

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index f81c2024ae486..42feb1650574e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6146,6 +6146,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
 
   Args.addOptOutFlag(CmdArgs, options::OPT_funique_section_names,
                      options::OPT_fno_unique_section_names);
+  Args.addOptInFlag(CmdArgs, options::OPT_fseparate_named_sections,
+                    options::OPT_fno_separate_named_sections);
   Args.addOptInFlag(CmdArgs, options::OPT_funique_internal_linkage_names,
                     options::OPT_fno_unique_internal_linkage_names);
   Args.addOptInFlag(CmdArgs, options::OPT_funique_basic_block_section_names,

diff  --git a/clang/test/Driver/fseparate-named-sections.c b/clang/test/Driver/fseparate-named-sections.c
new file mode 100644
index 0000000000000..6264b8fcf0d84
--- /dev/null
+++ b/clang/test/Driver/fseparate-named-sections.c
@@ -0,0 +1,4 @@
+// RUN: %clang -### -fseparate-named-sections %s -c 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
+// RUN: %clang -### -fseparate-named-sections -fno-separate-named-sections %s -c 2>&1 | FileCheck -check-prefix=CHECK-NOOPT %s
+// CHECK-OPT: "-fseparate-named-sections"
+// CHECK-NOOPT-NOT: "-fseparate-named-sections"


        


More information about the cfe-commits mailing list