1 From 3d3424e9a8d6ad56160b98bf6e223c0346164468 Mon Sep 17 00:00:00 2001
2 From: Matthew Fortune <matthew.fortune@imgtec.com>
3 Date: Thu, 29 Sep 2016 11:13:46 +0100
4 Subject: [PATCH] Refine .cfi_sections check to only consider compact eh_frame
6 The .cfi_sections directive can be safely used multiple times
7 with different sections named at any time unless the compact form
8 of exception handling is requested after CFI information has
9 been emitted. Only the compact form of CFI information changes
10 the way in which CFI is generated and therefore cannot be
11 retrospectively requested after generating CFI information.
16 * dw2gencfi.c (dot_cfi_sections): Refine the check for
17 inconsistent .cfi_sections to only consider compact vs non
19 * testsuite/gas/cfi/cfi-common-9.d: New file.
20 * testsuite/gas/cfi/cfi-common-9.s: New file.
21 * testsuite/gas/cfi/cfi.exp: Run new test.
23 Upstream-Status: Backport
24 Signed-off-by: Khem Raj <raj.khem@gmail.com
26 gas/ChangeLog | 10 ++++++++++
27 gas/dw2gencfi.c | 5 ++++-
28 gas/testsuite/gas/cfi/cfi-common-9.d | 23 +++++++++++++++++++++++
29 gas/testsuite/gas/cfi/cfi-common-9.s | 4 ++++
30 gas/testsuite/gas/cfi/cfi.exp | 1 +
31 5 files changed, 42 insertions(+), 1 deletion(-)
32 create mode 100644 gas/testsuite/gas/cfi/cfi-common-9.d
33 create mode 100644 gas/testsuite/gas/cfi/cfi-common-9.s
35 Index: git/gas/dw2gencfi.c
36 ===================================================================
37 --- git.orig/gas/dw2gencfi.c
38 +++ git/gas/dw2gencfi.c
39 @@ -1244,7 +1244,10 @@ dot_cfi_sections (int ignored ATTRIBUTE_
42 demand_empty_rest_of_line ();
43 - if (cfi_sections_set && cfi_sections != sections)
44 + if (cfi_sections_set
45 + && (sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))
46 + && (cfi_sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))
47 + != (sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact)))
48 as_bad (_("inconsistent uses of .cfi_sections"));
49 cfi_sections = sections;
51 Index: git/gas/testsuite/gas/cfi/cfi-common-9.d
52 ===================================================================
54 +++ git/gas/testsuite/gas/cfi/cfi-common-9.d
59 +Contents of the .eh_frame section:
61 +00000000 0+0010 0+0000 CIE
64 + Code alignment factor: .*
65 + Data alignment factor: .*
66 + Return address column: .*
67 + Augmentation data: [01]b
73 +00000014 0+00(10|18|1c|20) 0+0018 FDE cie=0+0000 pc=.*
79 Index: git/gas/testsuite/gas/cfi/cfi-common-9.s
80 ===================================================================
82 +++ git/gas/testsuite/gas/cfi/cfi-common-9.s
84 + .cfi_sections .eh_frame
85 + .cfi_startproc simple
86 + .cfi_sections .debug_frame
88 Index: git/gas/testsuite/gas/cfi/cfi.exp
89 ===================================================================
90 --- git.orig/gas/testsuite/gas/cfi/cfi.exp
91 +++ git/gas/testsuite/gas/cfi/cfi.exp
92 @@ -135,4 +135,5 @@ if { ![istarget "hppa64*-*"] } then {
93 run_dump_test "cfi-common-6"
95 run_dump_test "cfi-common-7"
96 + run_dump_test "cfi-common-9"