diff options
| -rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 19 | ||||
| -rw-r--r-- | clang/test/Driver/compress.c | 22 | 
2 files changed, 21 insertions, 20 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 6d3dbb5b520..87ca065a46a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1744,10 +1744,6 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,    // 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 CollectArgsForIntegratedAssembler(Compilation &C,          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 CollectArgsForIntegratedAssembler(Compilation &C,        }      }    } -  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) { diff --git a/clang/test/Driver/compress.c b/clang/test/Driver/compress.c index 6cdc6b72243..e7ee83bce50 100644 --- a/clang/test/Driver/compress.c +++ b/clang/test/Driver/compress.c @@ -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"  | 

