]> granicus.if.org Git - clang/commitdiff
Don't use unique section names by default if using the integrated as.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 27 Mar 2015 17:55:23 +0000 (17:55 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 27 Mar 2015 17:55:23 +0000 (17:55 +0000)
This saves some IO and ccache space by not creating long section names. It
should work with every ELF linker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233393 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/function-sections.c

index ed1bd3ef86884168b048a76d7dbd4a9c17ffc768..318cd07c1534c6a95096e717a028a519acffcbf2 100644 (file)
@@ -3087,8 +3087,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
       Args.hasArg(options::OPT_dA))
     CmdArgs.push_back("-masm-verbose");
 
-  if (!Args.hasFlag(options::OPT_fintegrated_as, options::OPT_fno_integrated_as,
-                    IsIntegratedAssemblerDefault))
+  bool UsingIntegratedAssembler =
+      Args.hasFlag(options::OPT_fintegrated_as, options::OPT_fno_integrated_as,
+                   IsIntegratedAssemblerDefault);
+  if (!UsingIntegratedAssembler)
     CmdArgs.push_back("-no-integrated-as");
 
   if (Args.hasArg(options::OPT_fdebug_pass_structure)) {
@@ -3332,7 +3334,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   }
 
   if (!Args.hasFlag(options::OPT_funique_section_names,
-                    options::OPT_fno_unique_section_names, true))
+                    options::OPT_fno_unique_section_names,
+                    !UsingIntegratedAssembler))
     CmdArgs.push_back("-fno-unique-section-names");
 
   Args.AddAllArgs(CmdArgs, options::OPT_finstrument_functions);
index ba065b1367a3fdae55c9ab3eea6ef934a6b85f52..6c243195f6266aa20ce1b8c401415288655c9835 100644 (file)
 // RUN:     -target i386-unknown-linux \
 // RUN:     -fno-unique-section-names \
 // RUN:   | FileCheck --check-prefix=CHECK-NOUS %s
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1        \
+// RUN:     -target i386-unknown-linux \
+// RUN:     -fno-integrated-as \
+// RUN:   | FileCheck --check-prefix=CHECK-US %s
+
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1        \
+// RUN:     -target i386-unknown-linux \
+// RUN:     -fintegrated-as \
+// RUN:   | FileCheck --check-prefix=CHECK-NOUS %s