[PATCH] PR gas/20648 (was: RE: Further work on PR gas/19614)

Matthew Fortune Matthew.Fortune@imgtec.com
Thu Oct 6 09:37:00 GMT 2016


Moore, Catherine <Catherine_Moore@mentor.com> writes:
> > -----Original Message-----
> > From: Matthew Fortune [mailto:Matthew.Fortune@imgtec.com]
> > Sent: Thursday, September 29, 2016 7:48 AM
> >
> > diff --git a/gas/ChangeLog b/gas/ChangeLog index e4db0f0..8b45a38
> > 100644
> > --- a/gas/ChangeLog
> > +++ b/gas/ChangeLog
> > @@ -1,3 +1,9 @@
> > +2016-09-29  Matthew Fortune  <matthew.fortune@imgtec.com>
> > +
> > +	* dw2gencfi.c (dot_cfi_sections): Refine the check for
> > +	inconsistent .cfi_sections to only consider compact vs non
> > +	compact forms.
> > +
> 
> Hi Matthew,
> 
> This patch looks correct to me.

Hi,

James Cowgill kindly helped test this patch by building LLVM with it
in debian which succeeded. No regressions for mips-mti-elf or
x86_64-pc-linux-gnu.

OK to commit?

Thanks,
Matthew

The .cfi_sections directive can be safely used multiple times
with different sections named at any time unless the compact form
of exception handling is requested after CFI information has
been emitted.  Only the compact form of CFI information changes
the way in which CFI is generated and therefore cannot be
retrospectively requested after generating CFI information.

gas/

	PR gas/20648
	* dw2gencfi.c (dot_cfi_sections): Refine the check for
	inconsistent .cfi_sections to only consider compact vs non
	compact forms.
	* testsuite/gas/cfi/cfi-common-9.d: New file.
	* testsuite/gas/cfi/cfi-common-9.s: New file.
	* testsuite/gas/cfi/cfi.exp: Run new test.
---
 gas/ChangeLog                        | 10 ++++++++++
 gas/dw2gencfi.c                      |  5 ++++-
 gas/testsuite/gas/cfi/cfi-common-9.d | 23 +++++++++++++++++++++++
 gas/testsuite/gas/cfi/cfi-common-9.s |  4 ++++
 gas/testsuite/gas/cfi/cfi.exp        |  1 +
 5 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 gas/testsuite/gas/cfi/cfi-common-9.d
 create mode 100644 gas/testsuite/gas/cfi/cfi-common-9.s

diff --git a/gas/ChangeLog b/gas/ChangeLog
index d0b8489..12f2e19 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2016-10-06  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+	PR gas/20648
+	* dw2gencfi.c (dot_cfi_sections): Refine the check for
+	inconsistent .cfi_sections to only consider compact vs non
+	compact forms.
+	* testsuite/gas/cfi/cfi-common-9.d: New file.
+	* testsuite/gas/cfi/cfi-common-9.s: New file.
+	* testsuite/gas/cfi/cfi.exp: Run new test.
+
 2016-10-06  Alan Modra  <amodra@gmail.com>
 
 	* app.c: Add missing fall through comments.
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index 7294f17..8eebb51 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -1269,7 +1269,10 @@ dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
       }
 
   demand_empty_rest_of_line ();
-  if (cfi_sections_set && cfi_sections != sections)
+  if (cfi_sections_set
+      && (sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))
+      && (cfi_sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))
+	 != (sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact)))
     as_bad (_("inconsistent uses of .cfi_sections"));
   cfi_sections = sections;
 }
diff --git a/gas/testsuite/gas/cfi/cfi-common-9.d b/gas/testsuite/gas/cfi/cfi-common-9.d
new file mode 100644
index 0000000..33f0176
--- /dev/null
+++ b/gas/testsuite/gas/cfi/cfi-common-9.d
@@ -0,0 +1,23 @@
+#objdump: -Wf
+#name: CFI common 9
+#...
+Contents of the .eh_frame section:
+
+00000000 0+0010 0+0000 CIE
+  Version:               1
+  Augmentation:          "zR"
+  Code alignment factor: .*
+  Data alignment factor: .*
+  Return address column: .*
+  Augmentation data:     [01]b
+
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+
+00000014 0+00(10|18|1c|20) 0+0018 FDE cie=0+0000 pc=.*
+
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+#...
diff --git a/gas/testsuite/gas/cfi/cfi-common-9.s b/gas/testsuite/gas/cfi/cfi-common-9.s
new file mode 100644
index 0000000..1bc7cc2
--- /dev/null
+++ b/gas/testsuite/gas/cfi/cfi-common-9.s
@@ -0,0 +1,4 @@
+	.cfi_sections .eh_frame
+	.cfi_startproc simple
+	.cfi_sections .debug_frame
+	.cfi_endproc
diff --git a/gas/testsuite/gas/cfi/cfi.exp b/gas/testsuite/gas/cfi/cfi.exp
index 3056856..6251434 100644
--- a/gas/testsuite/gas/cfi/cfi.exp
+++ b/gas/testsuite/gas/cfi/cfi.exp
@@ -136,4 +136,5 @@ if { ![istarget "hppa64*-*"] } then {
   }
   run_dump_test "cfi-common-7"
   run_dump_test "cfi-common-8"
+  run_dump_test "cfi-common-9"
 }
-- 
2.2.1



More information about the Binutils mailing list