[PATCH, RFC 6/9] gas: dw2gencfi: ignore all .cfi_* directives with --scfi=all
Indu Bhagat
indu.bhagat@oracle.com
Wed Sep 20 23:03:58 GMT 2023
As we add support for --scfi=inline, this commit will need to evolve and
more changes may be necessary. More specifically, we will need to
explictly check the value of the enumerator flag_synth_cfi.
gas/
* dw2gencfi.c (dot_cfi): Ignore processing when synthesizing
CFI.
(dot_cfi_escape): Likewise.
(dot_cfi_personality): Likewise.
(dot_cfi_lsda): Likewise.
(dot_cfi_val_encoded_addr): Likewise.
(dot_cfi_label): Likewise.
(dot_cfi_sections): Likewise.
(dot_cfi_startproc): Likewise.
(dot_cfi_endproc): Likewise.
(dot_cfi_personality_id): Likewise.
(dot_cfi_fde_data): Likewise.
(dot_cfi_inline_lsda): Likewise.
---
gas/dw2gencfi.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index cdef8d09978..2a02752b734 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -806,6 +806,12 @@ dot_cfi (int arg)
offsetT offset;
unsigned reg1, reg2;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_("CFI instruction used without previous .cfi_startproc"));
@@ -936,6 +942,12 @@ dot_cfi_escape (int ignored ATTRIBUTE_UNUSED)
struct cfi_escape_data *head, **tail, *e;
struct cfi_insn_data *insn;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_("CFI instruction used without previous .cfi_startproc"));
@@ -974,6 +986,12 @@ dot_cfi_personality (int ignored ATTRIBUTE_UNUSED)
struct fde_entry *fde;
offsetT encoding;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_("CFI instruction used without previous .cfi_startproc"));
@@ -1045,6 +1063,12 @@ dot_cfi_lsda (int ignored ATTRIBUTE_UNUSED)
struct fde_entry *fde;
offsetT encoding;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_("CFI instruction used without previous .cfi_startproc"));
@@ -1118,6 +1142,12 @@ dot_cfi_val_encoded_addr (int ignored ATTRIBUTE_UNUSED)
struct cfi_insn_data *insn_ptr;
offsetT encoding;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_("CFI instruction used without previous .cfi_startproc"));
@@ -1183,6 +1213,12 @@ dot_cfi_label (int ignored ATTRIBUTE_UNUSED)
{
char *name;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_("CFI instruction used without previous .cfi_startproc"));
@@ -1211,6 +1247,12 @@ dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
{
int sections = 0;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
SKIP_WHITESPACE ();
if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
while (1)
@@ -1278,6 +1320,12 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED)
{
int simple = 0;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data != NULL)
{
as_bad (_("previous CFI entry not closed (missing .cfi_endproc)"));
@@ -1318,6 +1366,12 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED)
static void
dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED)
{
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_(".cfi_endproc without corresponding .cfi_startproc"));
@@ -1382,6 +1436,12 @@ dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED)
{
struct fde_entry *fde;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_("CFI instruction used without previous .cfi_startproc"));
@@ -1403,6 +1463,12 @@ dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED)
static void
dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED)
{
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (frchain_now->frch_cfi_data == NULL)
{
as_bad (_(".cfi_fde_data without corresponding .cfi_startproc"));
@@ -1511,6 +1577,12 @@ dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED)
int align;
long max_alignment = 28;
+ if (flag_synth_cfi)
+ {
+ ignore_rest_of_line ();
+ return;
+ }
+
if (!last_fde)
{
as_bad (_("unexpected .cfi_inline_lsda"));
--
2.41.0
More information about the Binutils
mailing list