Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 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 |
| 5 | |
| 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. |
| 12 | |
| 13 | gas/ |
| 14 | |
| 15 | PR gas/20648 |
| 16 | * dw2gencfi.c (dot_cfi_sections): Refine the check for |
| 17 | inconsistent .cfi_sections to only consider compact vs non |
| 18 | compact forms. |
| 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. |
| 22 | --- |
| 23 | Upstream-Status: Backport |
| 24 | Signed-off-by: Khem Raj <raj.khem@gmail.com |
| 25 | |
| 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 |
| 34 | |
| 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_ |
| 40 | } |
| 41 | |
| 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; |
| 50 | } |
| 51 | Index: git/gas/testsuite/gas/cfi/cfi-common-9.d |
| 52 | =================================================================== |
| 53 | --- /dev/null |
| 54 | +++ git/gas/testsuite/gas/cfi/cfi-common-9.d |
| 55 | @@ -0,0 +1,23 @@ |
| 56 | +#objdump: -Wf |
| 57 | +#name: CFI common 9 |
| 58 | +#... |
| 59 | +Contents of the .eh_frame section: |
| 60 | + |
| 61 | +00000000 0+0010 0+0000 CIE |
| 62 | + Version: 1 |
| 63 | + Augmentation: "zR" |
| 64 | + Code alignment factor: .* |
| 65 | + Data alignment factor: .* |
| 66 | + Return address column: .* |
| 67 | + Augmentation data: [01]b |
| 68 | + |
| 69 | + DW_CFA_nop |
| 70 | + DW_CFA_nop |
| 71 | + DW_CFA_nop |
| 72 | + |
| 73 | +00000014 0+00(10|18|1c|20) 0+0018 FDE cie=0+0000 pc=.* |
| 74 | + |
| 75 | + DW_CFA_nop |
| 76 | + DW_CFA_nop |
| 77 | + DW_CFA_nop |
| 78 | +#... |
| 79 | Index: git/gas/testsuite/gas/cfi/cfi-common-9.s |
| 80 | =================================================================== |
| 81 | --- /dev/null |
| 82 | +++ git/gas/testsuite/gas/cfi/cfi-common-9.s |
| 83 | @@ -0,0 +1,4 @@ |
| 84 | + .cfi_sections .eh_frame |
| 85 | + .cfi_startproc simple |
| 86 | + .cfi_sections .debug_frame |
| 87 | + .cfi_endproc |
| 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" |
| 94 | } |
| 95 | run_dump_test "cfi-common-7" |
| 96 | + run_dump_test "cfi-common-9" |
| 97 | } |