This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFA:] dwarf2out.c: Make DWARF_CIE_DATA_ALIGNMENT changeable, enable-check for bad definitions.
- To: gcc-patches at gcc dot gnu dot org
- Subject: [RFA:] dwarf2out.c: Make DWARF_CIE_DATA_ALIGNMENT changeable, enable-check for bad definitions.
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Date: Wed, 4 Oct 2000 02:34:36 +0200
For a port which does not need or enforce UNITS_PER_WORD alignment of saved
registers on stack (I have not checked if there are any in CVS), invalid
exception information would silently be generated because of a bad
assumption in the unmodifiable DWARF_CIE_DATA_ALIGNMENT definition. Just
letting the port provide a correct definition would be enough. That
macro, as a lot of other DWARF2 macros, then needs to be documented.
I hope to do it for this one, if ok.
If bootstrap and check on i686-pc-linux-gnu show no new regressions,
Ok to commit?
* dwarf2out.c (DWARF_CIE_DATA_ALIGNMENT): Wrap definition in
#ifndef.
[ENABLE_CHECKING] (reg_save): Abort if offset is not a multiple of
DWARF_CIE_DATA_ALIGNMENT.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.207
diff -p -c -r1.207 dwarf2out.c
*** dwarf2out.c 2000/09/25 11:23:43 1.207
--- dwarf2out.c 2000/10/03 23:53:45
*************** dw_fde_node;
*** 169,179 ****
--- 169,181 ----
((((SIZE) + (BOUNDARY) - 1) / (BOUNDARY)) * (BOUNDARY))
/* Offsets recorded in opcodes are a multiple of this alignment factor. */
+ #ifndef DWARF_CIE_DATA_ALIGNMENT
#ifdef STACK_GROWS_DOWNWARD
#define DWARF_CIE_DATA_ALIGNMENT (-((int) UNITS_PER_WORD))
#else
#define DWARF_CIE_DATA_ALIGNMENT ((int) UNITS_PER_WORD)
#endif
+ #endif /* not DWARF_CIE_DATA_ALIGNMENT */
/* A pointer to the base of a table that contains frame description
information for each routine. */
*************** reg_save (label, reg, sreg, offset)
*** 940,945 ****
--- 942,959 ----
else
cfi->dw_cfi_opc = DW_CFA_offset;
+ #ifdef ENABLE_CHECKING
+ {
+ /* If we get an offset that is not a multiple of
+ DWARF_CIE_DATA_ALIGNMENT, there is either a bug in the
+ definition of DWARF_CIE_DATA_ALIGNMENT, or a bug in the machine
+ description. */
+ long check_offset = offset / DWARF_CIE_DATA_ALIGNMENT;
+
+ if (check_offset * DWARF_CIE_DATA_ALIGNMENT != offset)
+ abort ();
+ }
+ #endif
offset /= DWARF_CIE_DATA_ALIGNMENT;
if (offset < 0)
{
brgds, H-P