+2019-11-18 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * 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.
+
2019-11-14 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (operand_size_match, md_assemble,
-mfp16-format=[ieee|alternative] option for Arm to control the format of the
encoding.
+* Add --gdwarf-cie-version command line flag. This allows control over which
+ version of DWARF CIE the assembler creates.
+
Changes in 2.32:
* Add -mvexwig=[0|1] option to x86 assembler to control encoding of
/* 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;
OPTION_GSTABS_PLUS,
OPTION_GDWARF2,
OPTION_GDWARF_SECTIONS,
+ OPTION_GDWARF_CIE_VERSION,
OPTION_STRIP_LOCAL_ABSOLUTE,
OPTION_TRADITIONAL_FORMAT,
OPTION_WARN,
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}
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;
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;
\f
/* Maximum level of macro nesting. */
extern int max_macro_nest;
[@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{--gdwarf-cie-version}=@var{VERSION}]
[@b{--help}] [@b{-I} @var{dir}] [@b{-J}]
[@b{-K}] [@b{-L}] [@b{--listing-lhs-width}=@var{NUM}]
[@b{--listing-lhs-width2}=@var{NUM}] [@b{--listing-rhs-width}=@var{NUM}]
then debug line section will still be called just @var{.debug_line} without any
suffix.
+@item --gdwarf-cie-version=@var{version}
+Control which version of DWARF Common Information Entries (CIEs) are produced.
+When this flag is not specificed the default is version 1, though some targets
+can modify this default. Other possible values for @var{version} are 3 or 4.
+
@ifset ELF
@item --size-check=error
@itemx --size-check=warning
if (fmt != dwarf2_format_32bit)
out_four (-1);
}
- out_one (DW_CIE_VERSION); /* Version. */
+ out_one (flag_dwarf_cie_version); /* Version. */
if (eh_frame)
{
out_one ('z'); /* Augmentation. */
if (cie->signal_frame)
out_one ('S');
out_one (0);
+ if (flag_dwarf_cie_version >= 4)
+ {
+ /* For now we are assuming a flat address space with 4 or 8 byte
+ addresses. */
+ int address_size = dwarf2_format_32bit ? 4 : 8;
+ out_one (address_size); /* Address size. */
+ out_one (0); /* Segment size. */
+ }
out_uleb128 (DWARF2_LINE_MIN_INSN_LENGTH); /* Code alignment. */
out_sleb128 (DWARF2_CIE_DATA_ALIGNMENT); /* Data alignment. */
- if (DW_CIE_VERSION == 1) /* Return column. */
+ if (flag_dwarf_cie_version == 1) /* Return column. */
out_one (cie->return_column);
else
out_uleb128 (cie->return_column);
run_dump_test "cfi-common-7"
run_dump_test "cfi-common-8"
run_dump_test "cfi-common-9"
+
+ run_dump_test "cie-version-0"
+ run_dump_test "cie-version-1"
+ run_dump_test "cie-version-2"
+ run_dump_test "cie-version-3"
+ run_dump_test "cie-version-4"
}
--- /dev/null
+#objdump: --dwarf=frames
+#name: CIE Version 0
+#as: --gdwarf-cie-version=0
+#source: cie-version.s
+#error: Invalid --gdwarf-cie-version `0'
--- /dev/null
+#objdump: --dwarf=frames
+#name: CIE Version 1
+#as: --gdwarf-cie-version=1
+#source: cie-version.s
+#...
+.*: file format .*
+
+Contents of the .eh_frame section:
+
+00000000 0+[0-9a-f]+ 0+000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: [01][abc]
+#...
\ No newline at end of file
--- /dev/null
+#objdump: --dwarf=frames
+#name: CIE Version 2
+#as: --gdwarf-cie-version=2
+#source: cie-version.s
+#error: Invalid --gdwarf-cie-version `2'
--- /dev/null
+#objdump: --dwarf=frames
+#name: CIE Version 3
+#as: --gdwarf-cie-version=3
+#source: cie-version.s
+#...
+.*: file format .*
+
+Contents of the .eh_frame section:
+
+00000000 0+[0-9a-f]+ 0+000 CIE
+ Version: 3
+ Augmentation: "zR"
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: [01][abc]
+#...
\ No newline at end of file
--- /dev/null
+#objdump: --dwarf=frames
+#name: CIE Version 4
+#as: --gdwarf-cie-version=4
+#source: cie-version.s
+#...
+.*: file format .*
+
+Contents of the .eh_frame section:
+
+00000000 0+[0-9a-f]+ 0+000 CIE
+ Version: 4
+ Augmentation: "zR"
+ Pointer Size: .*
+ Segment Size: .*
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: [01][abc]
+#...
--- /dev/null
+ .cfi_startproc
+ .cfi_endproc
+2019-11-18 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * dwarf2.h (DW_CIE_VERSION): Delete.
+
2019-11-07 Mihail Ionescu <mihail.ionescu@arm.com>
* opcode/arm.h (ARM_EXT2_I8MM): New feature macro.
#define DW_CIE_ID 0xffffffff
#define DW64_CIE_ID 0xffffffffffffffffULL
-#define DW_CIE_VERSION 1
#define DW_CFA_extended 0