This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [RFA] CFI improvements
- From: Michal Ludvig <mludvig at suse dot cz>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 21 May 2003 15:18:00 +0200
- Subject: Re: [RFA] CFI improvements
- Organization: SuSE CR, s.r.o.
- References: <Pine.BSF.4.44.0305201951490.77355-100000@dair.pair.com>
Hans-Peter Nilsson told me that:
On Tue, 20 May 2003, Michal Ludvig wrote:
the attached patch adds some new features to the CFI engine:
- register names can start with '%' as requested by GCC guys.
This should be handled by the target's tc_regname_to_dw2regnum,
not in target-independent code. (No creeping ix86-isms, please.)
No problem. Something like this? Should I commit it?
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
2003-05-21 Michal Ludvig <mludvig@suse.cz>
* dw2gencfi.c (cfi_parse_arg): Allow registers in more
generic way. Remove special case for '%'-starting regnames.
* config/tc-i386.c (tc_x86_regname_to_dw2regnum): Allow
'%'-starting regnames.
* testsuite/gas/cfi/cfi-x86_64.s: Test register names
starting with '%'.
Index: dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.4
diff -u -p -r1.4 dw2gencfi.c
--- dw2gencfi.c 21 May 2003 11:31:07 -0000 1.4
+++ dw2gencfi.c 21 May 2003 13:13:53 -0000
@@ -151,20 +151,24 @@ cfi_parse_arg (long *param, int resolver
retval = 1;
}
#ifdef tc_regname_to_dw2regnum
- else if (resolvereg && ((is_name_beginner (*input_line_pointer))
- || (*input_line_pointer == '%'
- && is_name_beginner (*(++input_line_pointer)))))
+ else if (resolvereg)
{
char *name, c, *p;
name = input_line_pointer;
- c = get_symbol_end ();
- p = input_line_pointer;
+ p = name;
+ /* Recognize end of argument. */
+ while (*p != ',' && *p != ';' && *p != ' '
+ && *p != '\t' && *p != '\n' && *p != '\r')
+ p++;
+ c = *p;
+ *p = 0;
if ((value = tc_regname_to_dw2regnum (name)) >= 0)
retval = 1;
*p = c;
+ input_line_pointer = p;
}
#endif
else
Index: config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.139
diff -u -p -r1.139 tc-i386.c
--- config/tc-i386.c 20 May 2003 07:58:06 -0000 1.139
+++ config/tc-i386.c 21 May 2003 13:13:54 -0000
@@ -6360,6 +6360,9 @@ tc_x86_regname_to_dw2regnum (const char
regnames_count = sizeof (regnames_32);
}
+ if (*regname == '%')
+ regname ++;
+
for (regnum = 0; regnum < regnames_count; regnum++)
if (strcmp (regname, regnames[regnum]) == 0)
return regnum;
Index: testsuite/gas/cfi/cfi-x86_64.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cfi/cfi-x86_64.s,v
retrieving revision 1.1
diff -u -p -r1.1 cfi-x86_64.s
--- testsuite/gas/cfi/cfi-x86_64.s 20 May 2003 08:01:19 -0000 1.1
+++ testsuite/gas/cfi/cfi-x86_64.s 21 May 2003 13:13:54 -0000
@@ -35,9 +35,9 @@ func_prologue:
#; each instruction.
pushq %rbp
.cfi_def_cfa_offset 16
- .cfi_offset rbp,-16
+ .cfi_offset %rbp, -16
movq %rsp, %rbp
- .cfi_def_cfa_register rbp
+ .cfi_def_cfa_register %rbp
#; function body
call func_locvars
@@ -46,7 +46,7 @@ func_prologue:
#; epilogue with valid CFI
#; (we're better than gcc :-)
leaveq
- .cfi_def_cfa rsp,8
+ .cfi_def_cfa %rsp, 8
ret
.cfi_endproc