aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2014-06-27 13:48:54 +0000
committerRainer Orth <ro@gcc.gnu.org>2014-06-27 13:48:54 +0000
commit29d7cbd1b91cad56928674175507014d339689dc (patch)
treecb33b8e33481d74febbb79409812bd681334a6b8 /gcc/gcc.c
parentd284e1b86aa99cdf480905c58cf8975b1ae1e295 (diff)
downloadgcc-29d7cbd1b91cad56928674175507014d339689dc.zip
gcc-29d7cbd1b91cad56928674175507014d339689dc.tar.gz
gcc-29d7cbd1b91cad56928674175507014d339689dc.tar.bz2
Support compressed debug sections
* configure.ac (gcc_cv_as_compress_debug): Check for assembler compressed debug support. (gcc_cv_ld_compress_debug): Check for linker compressed debug support. * configure: Regenerate. * config.in: Regenerate. * common.opt (compressed_debug_sections): New enum. (gz, gz=): New options. * gcc.c (LINK_COMPRESS_DEBUG_SPEC, ASM_COMPRESS_DEBUG_SPEC): Define. (LINK_COMMAND_SPEC): Invoke LINK_COMPRESS_DEBUG_SPEC. (asm_options): Invoke ASM_COMPRESS_DEBUG_SPEC. * config/darwin.h (LINK_COMMAND_SPEC_A): Invoke LINK_COMPRESS_DEBUG_SPEC. * config/i386/djgpp.h (LINK_COMMAND_SPEC): Likewise. * opts.c (common_handle_option): Handle OPT_gz, OPT_gz_. * doc/invoke.texi (Option Summary, Debugging Options): Add -gz[=type]. (Debugging Options): Document -gz[=type]. From-SVN: r212072
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c57
1 files changed, 55 insertions, 2 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 168acf7..6cd08ea 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -597,6 +597,31 @@ proper position among the other output files. */
#endif
#endif
+/* Linker options for compressed debug sections. */
+#if HAVE_LD_COMPRESS_DEBUG == 0
+/* No linker support. */
+#define LINK_COMPRESS_DEBUG_SPEC \
+ " %{gz*:%e-gz is not supported in this configuration} "
+#elif HAVE_LD_COMPRESS_DEBUG == 1
+/* GNU style on input, GNU ld options. Reject, not useful. */
+#define LINK_COMPRESS_DEBUG_SPEC \
+ " %{gz*:%e-gz is not supported in this configuration} "
+#elif HAVE_LD_COMPRESS_DEBUG == 2
+/* GNU style, GNU gold options. */
+#define LINK_COMPRESS_DEBUG_SPEC \
+ " %{gz|gz=zlib-gnu:" LD_COMPRESS_DEBUG_OPTION "=zlib}" \
+ " %{gz=none:" LD_COMPRESS_DEBUG_OPTION "=none}" \
+ " %{gz=zlib:%e-gz=zlib is not supported in this configuration} "
+#elif HAVE_LD_COMPRESS_DEBUG == 3
+/* ELF gABI style. */
+#define LINK_COMPRESS_DEBUG_SPEC \
+ " %{gz|gz=zlib:" LD_COMPRESS_DEBUG_OPTION "=zlib}" \
+ " %{gz=none:" LD_COMPRESS_DEBUG_OPTION "=none}" \
+ " %{gz=zlib-gnu:" LD_COMPRESS_DEBUG_OPTION "=zlib-gnu} "
+#else
+#error Unknown value for HAVE_LD_COMPRESS_DEBUG.
+#endif
+
/* config.h can define LIBGCC_SPEC to override how and when libgcc.a is
included. */
#ifndef LIBGCC_SPEC
@@ -631,6 +656,33 @@ proper position among the other output files. */
#define ASM_MAP ""
#endif
+/* Assembler options for compressed debug sections. */
+#if HAVE_LD_COMPRESS_DEBUG < 2
+/* Reject if the linker cannot write compressed debug sections. */
+#define ASM_COMPRESS_DEBUG_SPEC \
+ " %{gz*:%e-gz is not supported in this configuration} "
+#else /* HAVE_LD_COMPRESS_DEBUG >= 2 */
+#if HAVE_AS_COMPRESS_DEBUG == 0
+/* No assembler support. Ignore silently. */
+#define ASM_COMPRESS_DEBUG_SPEC \
+ " %{gz*:} "
+#elif HAVE_AS_COMPRESS_DEBUG == 1
+/* GNU style, GNU as options. */
+#define ASM_COMPRESS_DEBUG_SPEC \
+ " %{gz|gz=zlib-gnu:" AS_COMPRESS_DEBUG_OPTION "}" \
+ " %{gz=none:" AS_NO_COMPRESS_DEBUG_OPTION "}" \
+ " %{gz=zlib:%e-gz=zlib is not supported in this configuration} "
+#elif HAVE_AS_COMPRESS_DEBUG == 2
+/* ELF gABI style. */
+#define ASM_COMPRESS_DEBUG_SPEC \
+ " %{gz|gz=zlib:" AS_COMPRESS_DEBUG_OPTION "=zlib}" \
+ " %{gz=none:" AS_COMPRESS_DEBUG_OPTION "=none}" \
+ " %{gz=zlib-gnu:" AS_COMPRESS_DEBUG_OPTION "=zlib-gnu} "
+#else
+#error Unknown value for HAVE_AS_COMPRESS_DEBUG.
+#endif
+#endif /* HAVE_LD_COMPRESS_DEBUG >= 2 */
+
/* Define ASM_DEBUG_SPEC to be a spec suitable for translating '-g'
to the assembler. */
#ifndef ASM_DEBUG_SPEC
@@ -761,8 +813,8 @@ proper position among the other output files. */
LINK_PLUGIN_SPEC \
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{flto=*} %l " LINK_PIE_SPEC \
- "%{fuse-ld=*:-fuse-ld=%*}\
- %X %{o*} %{e*} %{N} %{n} %{r}\
+ "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
+ "%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
%{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
%{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
@@ -885,6 +937,7 @@ static const char *asm_options =
to the assembler equivalents. */
"%{v} %{w:-W} %{I*} "
#endif
+ASM_COMPRESS_DEBUG_SPEC
"%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
static const char *invoke_as =