aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog13
-rw-r--r--gas/as.c57
-rw-r--r--gas/as.h1
-rw-r--r--gas/config/tc-ia64.h3
-rw-r--r--gas/doc/as.texi23
-rw-r--r--gas/dwarf2dbg.c2
6 files changed, 88 insertions, 11 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e2984b5..1b377fd 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,18 @@
2020-03-06 Nick Clifton <nickc@redhat.com>
+ PR 25612
+ * as.c (dwarf_level): Define.
+ (show_usage): Add --gdwarf-3, --gdwarf-4 and --gdwarf-5.
+ (parse_args): Add support for the new options.
+ as.h (dwarf_level): Prototype.
+ * dwarf2dbg.c (DWARF2_VERSION): Use dwarf_level as default version
+ value.
+ * config/tc-ia64.h (DWARF2_VERISION): Update definition.
+ (DWARF2_LINE_VERSION): Remove definition.
+ * doc/as.texi: Document the new options.
+
+2020-03-06 Nick Clifton <nickc@redhat.com>
+
PR 25572
* as.c (main): Allow matching input and outputs when they are
not regular files.
diff --git a/gas/as.c b/gas/as.c
index 51bb721..4c5881a 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -102,6 +102,9 @@ int verbose = 0;
MD_AFTER_PARSE_ARGS. */
int flag_dwarf_cie_version = -1;
+/* The maximum level of DWARF DEBUG information we should manufacture. */
+unsigned int dwarf_level = 0;
+
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
int flag_use_elf_stt_common = DEFAULT_GENERATE_ELF_STT_COMMON;
bfd_boolean flag_generate_build_notes = DEFAULT_GENERATE_BUILD_NOTES;
@@ -338,7 +341,7 @@ Options:\n\
fprintf (stream, _("\
--gstabs+ generate STABS debug info with GNU extensions\n"));
fprintf (stream, _("\
- --gdwarf-2 generate DWARF2 debugging information\n"));
+ --gdwarf-<N> generate DWARF<N> debugging information. 2 <= <N> <= 5\n"));
fprintf (stream, _("\
--gdwarf-sections generate per-function section names for DWARF line information\n"));
fprintf (stream, _("\
@@ -484,7 +487,10 @@ parse_args (int * pargc, char *** pargv)
OPTION_DEPFILE,
OPTION_GSTABS,
OPTION_GSTABS_PLUS,
- OPTION_GDWARF2,
+ OPTION_GDWARF_2,
+ OPTION_GDWARF_3,
+ OPTION_GDWARF_4,
+ OPTION_GDWARF_5,
OPTION_GDWARF_SECTIONS,
OPTION_GDWARF_CIE_VERSION,
OPTION_STRIP_LOCAL_ABSOLUTE,
@@ -537,10 +543,13 @@ parse_args (int * pargc, char *** pargv)
,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES}
#endif
,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
- ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2}
- /* GCC uses --gdwarf-2 but GAS uses to use --gdwarf2,
+ ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF_2}
+ ,{"gdwarf-3", no_argument, NULL, OPTION_GDWARF_3}
+ ,{"gdwarf-4", no_argument, NULL, OPTION_GDWARF_4}
+ ,{"gdwarf-5", no_argument, NULL, OPTION_GDWARF_5}
+ /* GCC uses --gdwarf-2 but GAS used to to use --gdwarf2,
so we keep it here for backwards compatibility. */
- ,{"gdwarf2", no_argument, NULL, OPTION_GDWARF2}
+ ,{"gdwarf2", no_argument, NULL, OPTION_GDWARF_2}
,{"gdwarf-sections", no_argument, NULL, OPTION_GDWARF_SECTIONS}
,{"gdwarf-cie-version", required_argument, NULL, OPTION_GDWARF_CIE_VERSION}
,{"gen-debug", no_argument, NULL, 'g'}
@@ -817,7 +826,10 @@ This program has absolutely no warranty.\n"));
if (md_debug_format_selector)
debug_type = md_debug_format_selector (& use_gnu_debug_info_extensions);
else if (IS_ELF)
- debug_type = DEBUG_DWARF2;
+ {
+ debug_type = DEBUG_DWARF2;
+ dwarf_level = 2;
+ }
else
debug_type = DEBUG_STABS;
break;
@@ -829,8 +841,24 @@ This program has absolutely no warranty.\n"));
debug_type = DEBUG_STABS;
break;
- case OPTION_GDWARF2:
+ case OPTION_GDWARF_2:
+ debug_type = DEBUG_DWARF2;
+ dwarf_level = 2;
+ break;
+
+ case OPTION_GDWARF_3:
+ debug_type = DEBUG_DWARF2;
+ dwarf_level = 3;
+ break;
+
+ case OPTION_GDWARF_4:
debug_type = DEBUG_DWARF2;
+ dwarf_level = 4;
+ break;
+
+ case OPTION_GDWARF_5:
+ debug_type = DEBUG_DWARF2;
+ dwarf_level = 5;
break;
case OPTION_GDWARF_SECTIONS:
@@ -845,6 +873,21 @@ This program has absolutely no warranty.\n"));
|| flag_dwarf_cie_version == 2
|| flag_dwarf_cie_version > 4)
as_fatal (_("Invalid --gdwarf-cie-version `%s'"), optarg);
+ switch (flag_dwarf_cie_version)
+ {
+ case 1:
+ if (dwarf_level < 2)
+ dwarf_level = 2;
+ break;
+ case 3:
+ if (dwarf_level < 3)
+ dwarf_level = 3;
+ break;
+ default:
+ if (dwarf_level < 4)
+ dwarf_level = 4;
+ break;
+ }
break;
case 'J':
diff --git a/gas/as.h b/gas/as.h
index b8d3d74..7a72239 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -413,6 +413,7 @@ extern enum debug_info_type debug_type;
extern int use_gnu_debug_info_extensions;
COMMON bfd_boolean flag_dwarf_sections;
extern int flag_dwarf_cie_version;
+extern unsigned int dwarf_level;
/* Maximum level of macro nesting. */
extern int max_macro_nest;
diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h
index b8abcf6..3a50f86 100644
--- a/gas/config/tc-ia64.h
+++ b/gas/config/tc-ia64.h
@@ -325,6 +325,5 @@ typedef struct unwind_record
/* VMS backtraces expect dwarf version 3. */
#ifdef TE_VMS
-#define DWARF2_VERSION 3
-#define DWARF2_LINE_VERSION 3
+#define DWARF2_VERSION (dwarf_level < 3 ? 3 : debug_level)
#endif
diff --git a/gas/doc/as.texi b/gas/doc/as.texi
index e97042c..ff0ef63 100644
--- a/gas/doc/as.texi
+++ b/gas/doc/as.texi
@@ -230,7 +230,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
[@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{--gdwarf-sections}]
+ [@b{--gstabs+}] [@b{--gdwarf-<N>}] [@b{--gdwarf-sections}]
[@b{--gdwarf-cie-version}=@var{VERSION}]
[@b{--help}] [@b{-I} @var{dir}] [@b{-J}]
[@b{-K}] [@b{-L}] [@b{--listing-lhs-width}=@var{NUM}]
@@ -763,6 +763,27 @@ Generate DWARF2 debugging information for each assembler line. This
may help debugging assembler code, if the debugger can handle it. Note---this
option is only supported by some targets, not all of them.
+@item --gdwarf-3
+This option is the same as the @option{--gdwarf-2} option, except that it
+allows for the possibility of the generation of extra debug information as per
+version 3 of the DWARF specification. Note - enabling this option does not
+guarantee the generation of any extra infortmation, the choice to do so is on a
+per target basis.
+
+@item --gdwarf-4
+This option is the same as the @option{--gdwarf-2} option, except that it
+allows for the possibility of the generation of extra debug information as per
+version 4 of the DWARF specification. Note - enabling this option does not
+guarantee the generation of any extra infortmation, the choice to do so is on a
+per target basis.
+
+@item --gdwarf-5
+This option is the same as the @option{--gdwarf-2} option, except that it
+allows for the possibility of the generation of extra debug information as per
+version 4 of the DWARF specification. Note - enabling this option does not
+guarantee the generation of any extra infortmation, the choice to do so is on a
+per target basis.
+
@item --gdwarf-sections
Instead of creating a .debug_line section, create a series of
.debug_line.@var{foo} sections where @var{foo} is the name of the
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 40a4435..7384a17 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -89,7 +89,7 @@
#endif
#ifndef DWARF2_VERSION
-#define DWARF2_VERSION 2
+#define DWARF2_VERSION dwarf_level
#endif
/* The .debug_aranges version has been 2 in DWARF version 2, 3 and 4. */