Author: compnerd
Date: Sun Jun 11 12:49:17 2017
New Revision: 305164

URL: http://llvm.org/viewvc/llvm-project?rev=305164&view=rev
Log:
Driver: pass along [-]-[no]compress-debug-sections unfiltered

Rather than validating the flags, pass them through without any
validation.  Arguments passed via -Wa or -Xassembler are passed directly
to the assembler without validation.  The validation was previously
required since we did not provide proper driver level support for
controlling the debug compression on ELF targets.  A subsequent change
will add support for the `-gz` and `-gz=` flags which provide proper
driver level control of the ELF compressed debug sections.

Modified:
    cfe/trunk/lib/Driver/ToolChains/Clang.cpp
    cfe/trunk/test/Driver/compress.c

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=305164&r1=305163&r2=305164&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Sun Jun 11 12:49:17 2017
@@ -1744,10 +1744,6 @@ static void CollectArgsForIntegratedAsse
   // arg after parsing the '-I' arg.
   bool TakeNextArg = false;
 
-  // When using an integrated assembler, translate -Wa, and -Xassembler
-  // options.
-  bool CompressDebugSections = false;
-
   bool UseRelaxRelocations = ENABLE_X86_RELAX_RELOCATIONS;
   const char *MipsTargetFeature = nullptr;
   for (const Arg *A :
@@ -1822,12 +1818,11 @@ static void CollectArgsForIntegratedAsse
         CmdArgs.push_back("-massembler-fatal-warnings");
       } else if (Value == "--noexecstack") {
         CmdArgs.push_back("-mnoexecstack");
-      } else if (Value == "-compress-debug-sections" ||
-                 Value == "--compress-debug-sections") {
-        CompressDebugSections = true;
-      } else if (Value == "-nocompress-debug-sections" ||
+      } else if (Value.startswith("-compress-debug-sections") ||
+                 Value.startswith("--compress-debug-sections") ||
+                 Value == "-nocompress-debug-sections" ||
                  Value == "--nocompress-debug-sections") {
-        CompressDebugSections = false;
+        CmdArgs.push_back(Value.data());
       } else if (Value == "-mrelax-relocations=yes" ||
                  Value == "--mrelax-relocations=yes") {
         UseRelaxRelocations = true;
@@ -1880,12 +1875,6 @@ static void CollectArgsForIntegratedAsse
       }
     }
   }
-  if (CompressDebugSections) {
-    if (llvm::zlib::isAvailable())
-      CmdArgs.push_back("-compress-debug-sections");
-    else
-      D.Diag(diag::warn_debug_compression_unavailable);
-  }
   if (UseRelaxRelocations)
     CmdArgs.push_back("--mrelax-relocations");
   if (MipsTargetFeature != nullptr) {

Modified: cfe/trunk/test/Driver/compress.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/compress.c?rev=305164&r1=305163&r2=305164&view=diff
==============================================================================
--- cfe/trunk/test/Driver/compress.c (original)
+++ cfe/trunk/test/Driver/compress.c Sun Jun 11 12:49:17 2017
@@ -1,8 +1,20 @@
-// RUN: %clang -### -c -integrated-as -Wa,-compress-debug-sections %s 2>&1 | 
FileCheck --check-prefix=COMPRESS_DEBUG %s
-// RUN: %clang -### -c -integrated-as -Wa,--compress-debug-sections %s 2>&1 | 
FileCheck --check-prefix=COMPRESS_DEBUG %s
 // REQUIRES: zlib
 
-// COMPRESS_DEBUG: "-compress-debug-sections"
+// RUN: %clang -### -fintegrated-as -Wa,-compress-debug-sections -c %s 2>&1 | 
FileCheck -check-prefix CHECK-_COMPRESS_DEBUG_SECTIONS %s
+// RUN: %clang -### -fno-integrated-as -Wa,-compress-debug-sections -c %s 2>&1 
| FileCheck -check-prefix CHECK-_COMPRESS_DEBUG_SECTIONS %s
+// CHECK-_COMPRESS_DEBUG_SECTIONS: "-compress-debug-sections"
+
+// RUN: %clang -### -fintegrated-as -Wa,--compress-debug-sections -c %s 2>&1 | 
FileCheck -check-prefix CHECK-__COMPRESS_DEBUG_SECTIONS %s
+// RUN: %clang -### -fno-integrated-as -Wa,--compress-debug-sections -c %s 
2>&1 | FileCheck -check-prefix CHECK-__COMPRESS_DEBUG_SECTIONS %s
+// CHECK-__COMPRESS_DEBUG_SECTIONS: "--compress-debug-sections"
+
+// RUN: %clang -### -fintegrated-as -Wa,--compress-debug-sections 
-Wa,--nocompress-debug-sections -c %s 2>&1 | FileCheck -check-prefix 
CHECK-POSNEG %s
+// RUN: %clang -### -fno-integrated-as -Wa,--compress-debug-sections 
-Wa,--nocompress-debug-sections -c %s 2>&1 | FileCheck -check-prefix 
CHECK-POSNEG %s
+// CHECK-POSNEG: "--compress-debug-sections"
+// CHECK-POSNEG: "--nocompress-debug-sections"
+
+// RUN: %clang -### -fintegrated-as -Wa,-compress-debug-sections 
-Wa,--compress-debug-sections -c %s 2>&1 | FileCheck -check-prefix 
CHECK-MULTIPLE %s
+// RUN: %clang -### -fno-integrated-as -Wa,-compress-debug-sections 
-Wa,--compress-debug-sections -c %s 2>&1 | FileCheck -check-prefix 
CHECK-MULTIPLE %s
+// CHECK-MULTIPLE: "-compress-debug-sections"
+// CHECK-MULTIPLE: "--compress-debug-sections"
 
-// RUN: %clang -### -c -integrated-as -Wa,--compress-debug-sections 
-Wa,--nocompress-debug-sections %s 2>&1 | FileCheck 
--check-prefix=NOCOMPRESS_DEBUG %s
-// NOCOMPRESS_DEBUG-NOT: "-compress-debug-sections"


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to