aboutsummaryrefslogtreecommitdiff
path: root/gas/as.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-11-04 12:27:45 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-11-18 10:30:21 +0000
commit66f8b2cbbb675ccbcae56e2bdb6dae485878ec00 (patch)
tree74128ccf4156406fd2deebe1b4b092eab1b60063 /gas/as.c
parentf1e8bd2dd26cbe08d3722a9e12844e290e47a1d2 (diff)
downloadgdb-66f8b2cbbb675ccbcae56e2bdb6dae485878ec00.zip
gdb-66f8b2cbbb675ccbcae56e2bdb6dae485878ec00.tar.gz
gdb-66f8b2cbbb675ccbcae56e2bdb6dae485878ec00.tar.bz2
gas: Add --gdwarf-cie-version command line flag
Add a flag to control the version of CIE that is generated. By default gas produces CIE version 1, and this continues to be the default after this patch. However, a user can now provide --gdwarf-cie-version=NUMBER to switch to either version 3 or version 4 of CIE, version 2 was never released, and so causes an error as does any number less than 1 or greater than 4. Producing version 4 CIE requires two new fields to be added to the CIE, an address size field, and an segment selector field. For a flat address space the DWARF specification indicates that the segment selector should be 0, and the address size fields just contains the address size in bytes. For now we support 4 or 8 byte addresses, and the segment selector is always produced as 0. At some future time we might need to allow targets to override this. gas/ChangeLog: * as.c (parse_args): Parse --gdwarf-cie-version option. (flag_dwarf_cie_version): New variable. * as.h (flag_dwarf_cie_version): Declare. * dw2gencfi.c (output_cie): Switch from DW_CIE_VERSION to flag_dwarf_cie_version. * doc/as.texi (Overview): Document --gdwarf-cie-version. * NEWS: Likewise. * testsuite/gas/cfi/cfi.exp: Add new tests. * testsuite/gas/cfi/cie-version-0.d: New file. * testsuite/gas/cfi/cie-version-1.d: New file. * testsuite/gas/cfi/cie-version-2.d: New file. * testsuite/gas/cfi/cie-version-3.d: New file. * testsuite/gas/cfi/cie-version-4.d: New file. * testsuite/gas/cfi/cie-version.s: New file. include/ChangeLog: * dwarf2.h (DW_CIE_VERSION): Delete. Change-Id: I9de19461aeb8332b5a57bbfe802953d0725a7ae8
Diffstat (limited to 'gas/as.c')
-rw-r--r--gas/as.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gas/as.c b/gas/as.c
index d53db11..cc84725 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -95,6 +95,11 @@ int debug_memory = 0;
/* Enable verbose mode. */
int verbose = 0;
+/* Which version of DWARF CIE to produce. The default could be overridden
+ by a target during its initialisation, or by the --gdwarf-cie-version
+ command line flag. */
+int flag_dwarf_cie_version = 1;
+
#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;
@@ -479,6 +484,7 @@ parse_args (int * pargc, char *** pargv)
OPTION_GSTABS_PLUS,
OPTION_GDWARF2,
OPTION_GDWARF_SECTIONS,
+ OPTION_GDWARF_CIE_VERSION,
OPTION_STRIP_LOCAL_ABSOLUTE,
OPTION_TRADITIONAL_FORMAT,
OPTION_WARN,
@@ -534,6 +540,7 @@ parse_args (int * pargc, char *** pargv)
so we keep it here for backwards compatibility. */
,{"gdwarf2", no_argument, NULL, OPTION_GDWARF2}
,{"gdwarf-sections", no_argument, NULL, OPTION_GDWARF_SECTIONS}
+ ,{"gdwarf-cie-version", required_argument, NULL, OPTION_GDWARF_CIE_VERSION}
,{"gen-debug", no_argument, NULL, 'g'}
,{"gstabs", no_argument, NULL, OPTION_GSTABS}
,{"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS}
@@ -828,6 +835,16 @@ This program has absolutely no warranty.\n"));
flag_dwarf_sections = TRUE;
break;
+ case OPTION_GDWARF_CIE_VERSION:
+ flag_dwarf_cie_version = atoi (optarg);
+ /* The available CIE versions are 1 (DWARF 2), 3 (DWARF 3), and 4
+ (DWARF 4 and 5). */
+ if (flag_dwarf_cie_version < 1
+ || flag_dwarf_cie_version == 2
+ || flag_dwarf_cie_version > 4)
+ as_fatal (_("Invalid --gdwarf-cie-version `%s'"), optarg);
+ break;
+
case 'J':
flag_signed_overflow_ok = 1;
break;