diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-06-11 17:49:17 +0000 | 
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-06-11 17:49:17 +0000 | 
| commit | d3ba0ac2a523f8dd25c1c77a52eab094872d66a2 (patch) | |
| tree | 349b22d8057c2cc7fef66c74cd2c41209c287e8b | |
| parent | 516938452faad3d2cdb39df663d666ee7aeb3382 (diff) | |
| download | bcm5719-llvm-d3ba0ac2a523f8dd25c1c77a52eab094872d66a2.tar.gz bcm5719-llvm-d3ba0ac2a523f8dd25c1c77a52eab094872d66a2.zip  | |
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.
llvm-svn: 305164
| -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"  | 

