aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2001-05-12 21:30:09 -0700
committerRichard Henderson <rth@gcc.gnu.org>2001-05-12 21:30:09 -0700
commitb627d6fe5d17bab51971acf505bb545cf31ff3a5 (patch)
tree9cb53ce676b1db0e40a14c11f71adb621954cbb0 /gcc
parent1f730ff7b674c4309a3684f9e7f901ccf01da9c7 (diff)
downloadgcc-b627d6fe5d17bab51971acf505bb545cf31ff3a5.zip
gcc-b627d6fe5d17bab51971acf505bb545cf31ff3a5.tar.gz
gcc-b627d6fe5d17bab51971acf505bb545cf31ff3a5.tar.bz2
dwarf2asm.c (size_of_encoded_value): New function.
* dwarf2asm.c (size_of_encoded_value): New function. * dwarf2asm.h: Declare it. * except.c (output_function_exception_table): Align the TType array only as wide as the encoding. From-SVN: r42028
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dwarf2asm.c25
-rw-r--r--gcc/dwarf2asm.h1
-rw-r--r--gcc/except.c38
4 files changed, 53 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3f91ca1..1ddf31a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2001-06-12 Richard Henderson <rth@redhat.com>
+
+ * dwarf2asm.c (size_of_encoded_value): New function.
+ * dwarf2asm.h: Declare it.
+ * except.c (output_function_exception_table): Align the TType
+ array only as wide as the encoding.
+
2001-05-12 Zack Weinberg <zackw@stanford.edu>
* extend.texi: Document #pragma GCC java_exceptions.
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 104879e..a18607a 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -445,6 +445,31 @@ size_of_sleb128 (value)
return size;
}
+/* Given an encoding, return the number of bytes the format occupies.
+ This is only defined for fixed-size encodings, and so does not
+ include leb128. */
+
+int
+size_of_encoded_value (encoding)
+ int encoding;
+{
+ if (encoding == DW_EH_PE_omit)
+ return 0;
+
+ switch (encoding & 0x07)
+ {
+ case DW_EH_PE_absptr:
+ return POINTER_SIZE / BITS_PER_UNIT;
+ case DW_EH_PE_udata2:
+ return 2;
+ case DW_EH_PE_udata4:
+ return 4;
+ case DW_EH_PE_udata8:
+ return 8;
+ }
+ abort ();
+}
+
/* Output an unsigned LEB128 quantity. */
void
diff --git a/gcc/dwarf2asm.h b/gcc/dwarf2asm.h
index 4b663c9..7f3baed 100644
--- a/gcc/dwarf2asm.h
+++ b/gcc/dwarf2asm.h
@@ -72,5 +72,6 @@ extern void dw2_asm_output_delta_sleb128 PARAMS ((const char *, const char *,
extern int size_of_uleb128 PARAMS ((unsigned HOST_WIDE_INT));
extern int size_of_sleb128 PARAMS ((HOST_WIDE_INT));
+extern int size_of_encoded_value PARAMS ((int));
extern void dw2_output_indirect_constants PARAMS ((void));
diff --git a/gcc/except.c b/gcc/except.c
index 66ea787..3afb1ed 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -3612,6 +3612,7 @@ output_function_exception_table ()
#endif
int have_tt_data;
int funcdef_number;
+ int tt_format_size;
/* Not all functions need anything. */
if (! cfun->uses_eh_lsda)
@@ -3634,8 +3635,19 @@ output_function_exception_table ()
have_tt_data = (VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) > 0
|| VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data) > 0);
- if (have_tt_data)
- assemble_eh_align (GET_MODE_ALIGNMENT (ptr_mode));
+ /* Indicate the format of the @TType entries. */
+ if (! have_tt_data)
+ tt_format = DW_EH_PE_omit;
+ else
+ {
+ tt_format = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1);
+#ifdef HAVE_AS_LEB128
+ ASM_GENERATE_INTERNAL_LABEL (ttype_label, "LLSDATT", funcdef_number);
+#endif
+ tt_format_size = size_of_encoded_value (tt_format);
+
+ assemble_eh_align (tt_format_size * BITS_PER_UNIT);
+ }
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LLSDA", funcdef_number);
@@ -3653,16 +3665,6 @@ output_function_exception_table ()
/* @LPStart pointer would go here. */
- /* Indicate the format of the @TType entries. */
- if (! have_tt_data)
- tt_format = DW_EH_PE_omit;
- else
- {
- tt_format = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1);
-#ifdef HAVE_AS_LEB128
- ASM_GENERATE_INTERNAL_LABEL (ttype_label, "LLSDATT", funcdef_number);
-#endif
- }
dw2_asm_output_data (1, tt_format, "@TType format (%s)",
eh_data_format_name (tt_format));
@@ -3685,14 +3687,14 @@ output_function_exception_table ()
ASM_OUTPUT_LABEL (asm_out_file, ttype_after_disp_label);
#else
/* Ug. Alignment queers things. */
- unsigned int before_disp, after_disp, last_disp, disp, align;
+ unsigned int before_disp, after_disp, last_disp, disp;
- align = POINTER_SIZE / BITS_PER_UNIT;
before_disp = 1 + 1;
after_disp = (1 + size_of_uleb128 (call_site_len)
+ call_site_len
+ VARRAY_ACTIVE_SIZE (cfun->eh->action_record_data)
- + VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) * align);
+ + (VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data)
+ * tt_format_size));
disp = after_disp;
do
@@ -3702,8 +3704,8 @@ output_function_exception_table ()
last_disp = disp;
disp_size = size_of_uleb128 (disp);
pad = before_disp + disp_size + after_disp;
- if (pad % align)
- pad = align - (pad % align);
+ if (pad % tt_format_size)
+ pad = tt_format_size - (pad % tt_format_size);
else
pad = 0;
disp = after_disp + pad;
@@ -3751,7 +3753,7 @@ output_function_exception_table ()
(i ? NULL : "Action record table"));
if (have_tt_data)
- assemble_eh_align (GET_MODE_ALIGNMENT (ptr_mode));
+ assemble_eh_align (tt_format_size * BITS_PER_UNIT);
i = VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data);
while (i-- > 0)