diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-27 20:11:54 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-08 19:04:48 +0000 |
| commit | 972a253a57b6f144b0e4a3e2080a2a0076ec55a0 (patch) | |
| tree | a8aeeb0997a0a52500f1fa0644244206cf71df94 /contrib/llvm-project/llvm/tools/llvm-objcopy | |
| parent | fcaf7f8644a9988098ac6be2165bce3ea4786e91 (diff) | |
| parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/tools/llvm-objcopy')
| -rw-r--r-- | contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp | 27 | ||||
| -rw-r--r-- | contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td | 11 |
2 files changed, 15 insertions, 23 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp index 8a2b4855501b..7db1e79f3e49 100644 --- a/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp @@ -719,24 +719,15 @@ objcopy::parseObjcopyOptions(ArrayRef<const char *> RawArgsArr, } } - if (auto Arg = InputArgs.getLastArg(OBJCOPY_compress_debug_sections, - OBJCOPY_compress_debug_sections_eq)) { - Config.CompressionType = DebugCompressionType::Z; - - if (Arg->getOption().getID() == OBJCOPY_compress_debug_sections_eq) { - Config.CompressionType = - StringSwitch<DebugCompressionType>( - InputArgs.getLastArgValue(OBJCOPY_compress_debug_sections_eq)) - .Case("zlib", DebugCompressionType::Z) - .Default(DebugCompressionType::None); - if (Config.CompressionType == DebugCompressionType::None) - return createStringError( - errc::invalid_argument, - "invalid or unsupported --compress-debug-sections format: %s", - InputArgs.getLastArgValue(OBJCOPY_compress_debug_sections_eq) - .str() - .c_str()); - } + if (const auto *A = InputArgs.getLastArg(OBJCOPY_compress_debug_sections)) { + Config.CompressionType = StringSwitch<DebugCompressionType>(A->getValue()) + .Case("zlib", DebugCompressionType::Z) + .Default(DebugCompressionType::None); + if (Config.CompressionType == DebugCompressionType::None) + return createStringError( + errc::invalid_argument, + "invalid or unsupported --compress-debug-sections format: %s", + A->getValue()); if (!compression::zlib::isAvailable()) return createStringError( errc::invalid_argument, diff --git a/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td b/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td index 962028da47a0..d3713b5ec3c3 100644 --- a/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td +++ b/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td @@ -29,12 +29,13 @@ defm new_symbol_visibility : Eq<"new-symbol-visibility", "Visibility of " " with --add-symbol unless otherwise" " specified. The default value is 'default'.">; -def compress_debug_sections : Flag<["--"], "compress-debug-sections">; -def compress_debug_sections_eq +def compress_debug_sections : Joined<["--"], "compress-debug-sections=">, - MetaVarName<"[ zlib ]">, - HelpText<"Compress DWARF debug sections using specified style. Supported " - "formats: 'zlib'">; + MetaVarName<"format">, + HelpText<"Compress DWARF debug sections using specified format. Supported " + "formats: zlib">; +def : Flag<["--"], "compress-debug-sections">, Alias<compress_debug_sections>, + AliasArgs<["zlib"]>; def decompress_debug_sections : Flag<["--"], "decompress-debug-sections">, HelpText<"Decompress DWARF debug sections.">; defm split_dwo |
