aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog11
-rw-r--r--gas/as.c10
-rw-r--r--gas/config/tc-riscv.c6
-rw-r--r--gas/dwarf2dbg.c11
-rw-r--r--gas/testsuite/gas/riscv/default-cie-version.d15
-rw-r--r--gas/testsuite/gas/riscv/default-cie-version.s2
-rw-r--r--ld/ChangeLog4
-rw-r--r--ld/testsuite/ld-elf/eh5.d12
8 files changed, 61 insertions, 10 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c7dfd5e..45e8b8a 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,16 @@
2019-11-22 Andrew Burgess <andrew.burgess@embecosm.com>
+ * as.c (flag_dwarf_cie_version): Change initial value to -1, and
+ update comment.
+ * config/tc-riscv.c (riscv_after_parse_args): Set
+ flag_dwarf_cie_version if it has not already been set.
+ * dwarf2dbg.c (dwarf2_init): Initialise flag_dwarf_cie_version if
+ needed.
+ * testsuite/gas/riscv/default-cie-version.d: New file.
+ * testsuite/gas/riscv/default-cie-version.s: New file.
+
+2019-11-22 Andrew Burgess <andrew.burgess@embecosm.com>
+
* dw2gencfi.c (output_cie): Error on return column overflow.
* testsuite/gas/riscv/cie-rtn-col-1.d: New file.
* testsuite/gas/riscv/cie-rtn-col-3.d: New file.
diff --git a/gas/as.c b/gas/as.c
index cc84725..091fe90 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -95,10 +95,12 @@ 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;
+/* Which version of DWARF CIE to produce. This default value of -1
+ indicates that this value has not been set yet, a default value is
+ provided in dwarf2_init. A different value can also be supplied by the
+ command line flag --gdwarf-cie-version, or by a target in
+ MD_AFTER_PARSE_ARGS. */
+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;
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index dcd8405..055d80c 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -2341,6 +2341,12 @@ riscv_after_parse_args (void)
/* Insert float_abi into the EF_RISCV_FLOAT_ABI field of elf_flags. */
elf_flags |= float_abi * (EF_RISCV_FLOAT_ABI & ~(EF_RISCV_FLOAT_ABI << 1));
+
+ /* If the CIE to be produced has not been overridden on the command line,
+ then produce version 3 by default. This allows us to use the full
+ range of registers in a .cfi_return_column directive. */
+ if (flag_dwarf_cie_version == -1)
+ flag_dwarf_cie_version = 3;
}
long
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 001e2a1..fd6ab54 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -2171,6 +2171,17 @@ void
dwarf2_init (void)
{
last_seg_ptr = &all_segs;
+
+ /* Select the default CIE version to produce here. The global
+ starts with a value of -1 and will be modified to a valid value
+ either by the user providing a command line option, or some
+ targets will select their own default in md_after_parse_args. If
+ we get here and the global still contains -1 then it is up to us
+ to pick a sane default. The default we choose is 1, this is the
+ CIE version gas has produced for a long time, and there seems no
+ reason to change it yet. */
+ if (flag_dwarf_cie_version == -1)
+ flag_dwarf_cie_version = 1;
}
diff --git a/gas/testsuite/gas/riscv/default-cie-version.d b/gas/testsuite/gas/riscv/default-cie-version.d
new file mode 100644
index 0000000..035f258
--- /dev/null
+++ b/gas/testsuite/gas/riscv/default-cie-version.d
@@ -0,0 +1,15 @@
+#objdump: --dwarf=frames
+#as:
+#...
+.*: file format elf.*-.*riscv
+
+Contents of the .* section:
+
+00000000 0+[0-9a-f]+ 0+000 CIE
+ Version: 3
+ Augmentation: .*
+ Code alignment factor: .*
+ Data alignment factor: .*
+ Return address column: .*
+ Augmentation data: .*
+#... \ No newline at end of file
diff --git a/gas/testsuite/gas/riscv/default-cie-version.s b/gas/testsuite/gas/riscv/default-cie-version.s
new file mode 100644
index 0000000..659b3b9
--- /dev/null
+++ b/gas/testsuite/gas/riscv/default-cie-version.s
@@ -0,0 +1,2 @@
+ .cfi_startproc
+ .cfi_endproc
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 969ab78..adca95f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2019-11-27 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * testsuite/ld-elf/eh5.d: Accept version 3 DWARF CIE.
+
2019-11-26 Martin Liska <mliska@suse.cz>
* scripttempl/arclinux.sc: Add .text.sorted.* which is sorted
diff --git a/ld/testsuite/ld-elf/eh5.d b/ld/testsuite/ld-elf/eh5.d
index b74d4cf..e61db61 100644
--- a/ld/testsuite/ld-elf/eh5.d
+++ b/ld/testsuite/ld-elf/eh5.d
@@ -9,7 +9,7 @@
Contents of the .eh_frame section:
0+0000 0+001[04] 0+0000 CIE
- Version: 1
+ Version: [13]
Augmentation: "zR"
Code alignment factor: .*
Data alignment factor: .*
@@ -28,7 +28,7 @@ Contents of the .eh_frame section:
DW_CFA_nop
0+00(2c|30) 0+0014 0+0000 CIE
- Version: 1
+ Version: [13]
Augmentation: "zPR"
Code alignment factor: .*
Data alignment factor: .*
@@ -52,7 +52,7 @@ Contents of the .eh_frame section:
DW_CFA_nop
0+007[48] 0+001[8c] 0+0000 CIE
- Version: 1
+ Version: [13]
Augmentation: "zPLR"
Code alignment factor: .*
Data alignment factor: .*
@@ -73,7 +73,7 @@ Contents of the .eh_frame section:
DW_CFA_nop
0+00b[08] 0+001[04] 0+0000 CIE
- Version: 1
+ Version: [13]
Augmentation: "zR"
Code alignment factor: .*
Data alignment factor: .*
@@ -88,7 +88,7 @@ Contents of the .eh_frame section:
DW_CFA_nop
#...
0+00[de]8 0+0014 0+0000 CIE
- Version: 1
+ Version: [13]
Augmentation: "zPR"
Code alignment factor: .*
Data alignment factor: .*
@@ -110,7 +110,7 @@ Contents of the .eh_frame section:
DW_CFA_nop
#...
0+01(1c|30) 0+001[8c] 0+0000 CIE
- Version: 1
+ Version: [13]
Augmentation: "zPLR"
Code alignment factor: .*
Data alignment factor: .*