aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Monteiro <pietro@sociotechnical.xyz>2025-10-19 20:14:51 -0400
committerAlan Modra <amodra@gmail.com>2025-10-22 13:49:05 +1030
commit4cfcc5412cc2dd1ebe31ca467f2afe4752d45952 (patch)
tree5d83a0858d53926debfd9de46bb8f83103ea79e0
parent17d36c261915d74229a837b3aa11f11f981a89ea (diff)
downloadbinutils-4cfcc5412cc2dd1ebe31ca467f2afe4752d45952.zip
binutils-4cfcc5412cc2dd1ebe31ca467f2afe4752d45952.tar.gz
binutils-4cfcc5412cc2dd1ebe31ca467f2afe4752d45952.tar.bz2
objcopy: Don't add zstd to the debug compression options if not available
If zstd is not available or was intentionally disabled by the user don't add it to the list of the available options to compress debug sections when showing usage. binutils/ * objcopy.c (copy_usage): Only output --compress-debug-sections=zstd if HAVE_ZSTD.
-rw-r--r--binutils/objcopy.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 3c1bcf6..9373b75 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -570,6 +570,12 @@ static bool write_debugging_info (bfd *, void *, long *, asymbol ***);
static const char *lookup_sym_redefinition (const char *);
static const char *find_section_rename (const char *, flagword *);
+#ifdef HAVE_ZSTD
+#define ZSTD_OPT "|zstd"
+#else
+#define ZSTD_OPT ""
+#endif
+
ATTRIBUTE_NORETURN static void
copy_usage (FILE *stream, int exit_status)
{
@@ -692,8 +698,8 @@ copy_usage (FILE *stream, int exit_status)
<commit>\n\
--subsystem <name>[:<version>]\n\
Set PE subsystem to <name> [& <version>]\n\
- --compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi|zstd}]\n\
- Compress DWARF debug sections\n\
+ --compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi" ZSTD_OPT "}]\n\
+ Compress DWARF debug sections\n\
--decompress-debug-sections Decompress DWARF debug sections using zlib\n\
--elf-stt-common=[yes|no] Generate ELF common symbols with STT_COMMON\n\
type\n\