This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Add --compress-debug-sections option to gas


> Actually just looking at the code in write.c, is there actually any check
> for the absence of the zlibrary ? ?Ie can the sources currently be compiled
> on a system with zlib installed ?

Yes, the compression routines in compress-debug.c reduce to empty
stubs if zlib is not installed.

> Also, if zlib is not installed, then it would be fairer to the user if the
> --compress-debug-section was not mentioned in the --help output, and
> produced a warning if used. ?Otherwise someone could add
> --compress-debug-sections to their command line and then wonder why they are
> not getting any smaller binaries.

Sounds better. Here's a revised patch.

-cary


        * as.c (show_usage): Don't list --compress-debug-sections if zlib not
        installed.
        (main): Warn if --compress-debug-sections requested and zlib not
        installed.
        * doc/as.texinfo: Add --compress-debug-sections,
        --nocompress-debug-sections.


diff --git a/gas/as.c b/gas/as.c
index 45acbaa..d9aa6e2 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -245,12 +245,14 @@ Options:\n\

   fprintf (stream, _("\
   --alternate             initially turn on alternate macro syntax\n"));
+#ifdef HAVE_ZLIB_H
   fprintf (stream, _("\
   --compress-debug-sections\n\
                           compress DWARF debug sections using zlib\n"));
   fprintf (stream, _("\
   --nocompress-debug-sections\n\
                           don't compress DWARF debug sections\n"));
+#endif /* HAVE_ZLIB_H */
   fprintf (stream, _("\
   -D                      produce assembler debugging messages\n"));
   fprintf (stream, _("\
@@ -646,7 +648,11 @@ This program has absolutely no warranty.\n"));
 	  exit (EXIT_SUCCESS);

 	case OPTION_COMPRESS_DEBUG:
+#ifdef HAVE_ZLIB_H
 	  flag_compress_debug = 1;
+#else
+	  as_warn (_("cannot compress debug sections (zlib not installed)"));
+#endif /* HAVE_ZLIB_H */
 	  break;

 	case OPTION_NOCOMPRESS_DEBUG:
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index a8327b8..f17c591 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -232,6 +232,7 @@ gcc(1), ld(1), and the Info entries for
@file{binutils} and @file{ld}.
 @smallexample
 @c man begin SYNOPSIS
 @value{AS} [@b{-a}[@b{cdghlns}][=@var{file}]] [@b{--alternate}] [@b{-D}]
+ [@b{--compress-debug-sections}]  [@b{--nocompress-debug-sections}]
  [@b{--debug-prefix-map} @var{old}=@var{new}]
  [@b{--defsym} @var{sym}=@var{val}] [@b{-f}] [@b{-g}] [@b{--gstabs}]
  [@b{--gstabs+}] [@b{--gdwarf-2}] [@b{--help}] [@b{-I} @var{dir}] [@b{-J}]
@@ -552,6 +553,14 @@ Begin in alternate macro mode.
 @xref{Altmacro,,@code{.altmacro}}.
 @end ifclear

+@item --compress-debug-sections
+Compress DWARF debug sections using zlib.  The debug sections are renamed
+to begin with @samp{.zdebug}, and the resulting object file may not be
+compatible with older linkers and object file utilities.
+
+@item --nocompress-debug-sections
+Do not compress DWARF debug sections.  This is the default.
+
 @item -D
 Ignored.  This option is accepted for script compatibility with calls to
 other assemblers.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]