]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
unwind-dw2-fde.c (get_cie_encoding): Replaced _Unwind_Word with _uleb128_t and _Unwin...
authorAndreas Krebbel <krebbel1@de.ibm.com>
Wed, 24 Jan 2007 14:46:47 +0000 (14:46 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Wed, 24 Jan 2007 14:46:47 +0000 (14:46 +0000)
2007-01-24  Andreas Krebbel  <krebbel1@de.ibm.com>

* unwind-dw2-fde.c (get_cie_encoding): Replaced _Unwind_Word with
_uleb128_t and _Unwind_SWord with _sleb128_t.
* unwind-dw2.c (extract_cie_info, execute_stack_op, execute_cfa_program,
uw_frame_state_for, uw_update_context_1): Likewise.
* unwind-c.c (parse_lsda_header, PERSONALITY_FUNCTION): Likewise.
* unwind-pe.h (read_uleb128, read_sleb128,
read_encoded_value_with_base): Likewise.
* unwind-generic.h: Define _sleb128_t and _uleb128_t types.

2007-01-24  Andreas Krebbel  <krebbel1@de.ibm.com>

* libsupc++/eh_personality.cc (parse_lsda_header, check_exception_spec,
get_ttype_entry, empty_exception_spec, PERSONALITY_FUNCTION): Replaced
_Unwind_Word with _uleb128_t and _Unwind_SWord with _sleb128_t.

2007-01-24  Andreas Krebbel  <krebbel1@de.ibm.com>

* exception.cc (parse_lsda_header, PERSONALITY_FUNCTION): Replaced
_Unwind_Word with _uleb128_t and _Unwind_SWord with _sleb128_t.

From-SVN: r121116

gcc/ChangeLog
gcc/unwind-c.c
gcc/unwind-dw2-fde.c
gcc/unwind-dw2.c
gcc/unwind-generic.h
gcc/unwind-pe.h
libjava/ChangeLog
libjava/exception.cc
libstdc++-v3/ChangeLog
libstdc++-v3/libsupc++/eh_personality.cc

index 61a4798a355f8107d80cbde7673b2fbf382528e2..8164f0094b582c87847ba3d7e4d333c28bcc7421 100644 (file)
@@ -1,3 +1,14 @@
+2007-01-24  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * unwind-dw2-fde.c (get_cie_encoding): Replaced _Unwind_Word with 
+       _uleb128_t and _Unwind_SWord with _sleb128_t.
+       * unwind-dw2.c (extract_cie_info, execute_stack_op, execute_cfa_program,
+       uw_frame_state_for, uw_update_context_1): Likewise.
+       * unwind-c.c (parse_lsda_header, PERSONALITY_FUNCTION): Likewise.
+       * unwind-pe.h (read_uleb128, read_sleb128,
+       read_encoded_value_with_base): Likewise.
+       * unwind-generic.h: Define _sleb128_t and _uleb128_t types.
+
 2007-01-24  Richard Guenther  <rguenther@suse.de>
 
        * builtins.c (expand_builtin_cexpi): Get the fndecl
index c8f34acc0ee2edc3e76d9b3c58f2b6b8447327ea..f287ea2d9e628fc2ffcf95d24eb8c2d297e2641f 100644 (file)
@@ -50,7 +50,7 @@ static const unsigned char *
 parse_lsda_header (struct _Unwind_Context *context, const unsigned char *p,
                   lsda_header_info *info)
 {
-  _Unwind_Word tmp;
+  _uleb128_t tmp;
   unsigned char lpstart_encoding;
 
   info->Start = (context ? _Unwind_GetRegionStart (context) : 0);
@@ -175,7 +175,7 @@ PERSONALITY_FUNCTION (int version,
     return _URC_CONTINUE_UNWIND;
   else
     {
-      _Unwind_Word cs_lp, cs_action;
+      _uleb128_t cs_lp, cs_action;
       do
        {
          p = read_uleb128 (p, &cs_lp);
@@ -185,7 +185,7 @@ PERSONALITY_FUNCTION (int version,
 
       /* Can never have null landing pad for sjlj -- that would have
         been indicated by a -1 call site index.  */
-      landing_pad = cs_lp + 1;
+      landing_pad = (_Unwind_Ptr)cs_lp + 1;
       if (cs_action)
        action_record = info.action_table + cs_action - 1;
       goto found_something;
@@ -195,7 +195,7 @@ PERSONALITY_FUNCTION (int version,
   while (p < info.action_table)
     {
       _Unwind_Ptr cs_start, cs_len, cs_lp;
-      _Unwind_Word cs_action;
+      _uleb128_t cs_action;
 
       /* Note that all call-site encodings are "absolute" displacements.  */
       p = read_encoded_value (0, info.call_site_encoding, p, &cs_start);
index ace7a432577ec03a059b6cecfda598b54bdb2fc0..880ba51bf3819ef91f64f4ef05f4382515be5d1f 100644 (file)
@@ -266,8 +266,8 @@ get_cie_encoding (const struct dwarf_cie *cie)
 {
   const unsigned char *aug, *p;
   _Unwind_Ptr dummy;
-  _Unwind_Word utmp;
-  _Unwind_Sword stmp;
+  _uleb128_t utmp;
+  _sleb128_t stmp;
 
   aug = cie->augmentation;
   if (aug[0] != 'z')
index da8289f794fb4c7676f36c2d85fbc6a5fa2af905..b40b16fda552b84c96ec7b0c843f4f1a4e17cea9 100644 (file)
@@ -349,7 +349,8 @@ extract_cie_info (const struct dwarf_cie *cie, struct _Unwind_Context *context,
   const unsigned char *aug = cie->augmentation;
   const unsigned char *p = aug + strlen ((const char *)aug) + 1;
   const unsigned char *ret = NULL;
-  _Unwind_Word utmp;
+  _uleb128_t utmp;
+  _sleb128_t stmp;
 
   /* g++ v2 "eh" has pointer immediately following augmentation string,
      so it must be handled first.  */
@@ -362,12 +363,17 @@ extract_cie_info (const struct dwarf_cie *cie, struct _Unwind_Context *context,
 
   /* Immediately following the augmentation are the code and
      data alignment and return address column.  */
-  p = read_uleb128 (p, &fs->code_align);
-  p = read_sleb128 (p, &fs->data_align);
+  p = read_uleb128 (p, &utmp);
+  fs->code_align = (_Unwind_Word)utmp;
+  p = read_sleb128 (p, &stmp);
+  fs->data_align = (_Unwind_Sword)stmp;
   if (cie->version == 1)
     fs->retaddr_column = *p++;
   else
-    p = read_uleb128 (p, &fs->retaddr_column);
+    {
+      p = read_uleb128 (p, &utmp);
+      fs->retaddr_column = (_Unwind_Word)utmp;
+    }
   fs->lsda_encoding = DW_EH_PE_omit;
 
   /* If the augmentation starts with 'z', then a uleb128 immediately
@@ -442,8 +448,9 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
   while (op_ptr < op_end)
     {
       enum dwarf_location_atom op = *op_ptr++;
-      _Unwind_Word result, reg, utmp;
-      _Unwind_Sword offset, stmp;
+      _Unwind_Word result;
+      _uleb128_t reg, utmp;
+      _sleb128_t offset, stmp;
 
       switch (op)
        {
@@ -520,11 +527,12 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
          op_ptr += 8;
          break;
        case DW_OP_constu:
-         op_ptr = read_uleb128 (op_ptr, &result);
+         op_ptr = read_uleb128 (op_ptr, &utmp);
+         result = (_Unwind_Word)utmp;
          break;
        case DW_OP_consts:
          op_ptr = read_sleb128 (op_ptr, &stmp);
-         result = stmp;
+         result = (_Unwind_Sword)stmp;
          break;
 
        case DW_OP_reg0:
@@ -604,7 +612,7 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
        case DW_OP_bregx:
          op_ptr = read_uleb128 (op_ptr, &reg);
          op_ptr = read_sleb128 (op_ptr, &offset);
-         result = _Unwind_GetGR (context, reg) + offset;
+         result = _Unwind_GetGR (context, reg) + (_Unwind_Word)offset;
          break;
 
        case DW_OP_dup:
@@ -698,7 +706,7 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
              break;
            case DW_OP_plus_uconst:
              op_ptr = read_uleb128 (op_ptr, &utmp);
-             result += utmp;
+             result += (_Unwind_Word)utmp;
              break;
 
            default:
@@ -857,8 +865,8 @@ execute_cfa_program (const unsigned char *insn_ptr,
         && fs->pc < context->ra + _Unwind_IsSignalFrame (context))
     {
       unsigned char insn = *insn_ptr++;
-      _Unwind_Word reg, utmp;
-      _Unwind_Sword offset, stmp;
+      _uleb128_t reg, utmp;
+      _sleb128_t offset, stmp;
 
       if ((insn & 0xc0) == DW_CFA_advance_loc)
        fs->pc += (insn & 0x3f) * fs->code_align;
@@ -928,11 +936,12 @@ execute_cfa_program (const unsigned char *insn_ptr,
 
        case DW_CFA_register:
          {
-           _Unwind_Word reg2;
+           _uleb128_t reg2;
            insn_ptr = read_uleb128 (insn_ptr, &reg);
            insn_ptr = read_uleb128 (insn_ptr, &reg2);
            fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how = REG_SAVED_REG;
-           fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.reg = reg2;
+           fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.reg =
+             (_Unwind_Word)reg2;
          }
          break;
 
@@ -962,14 +971,16 @@ execute_cfa_program (const unsigned char *insn_ptr,
          break;
 
        case DW_CFA_def_cfa:
-         insn_ptr = read_uleb128 (insn_ptr, &fs->regs.cfa_reg);
          insn_ptr = read_uleb128 (insn_ptr, &utmp);
-         fs->regs.cfa_offset = utmp;
+         fs->regs.cfa_reg = (_Unwind_Word)utmp;
+         insn_ptr = read_uleb128 (insn_ptr, &utmp);
+         fs->regs.cfa_offset = (_Unwind_Word)utmp;
          fs->regs.cfa_how = CFA_REG_OFFSET;
          break;
 
        case DW_CFA_def_cfa_register:
-         insn_ptr = read_uleb128 (insn_ptr, &fs->regs.cfa_reg);
+         insn_ptr = read_uleb128 (insn_ptr, &utmp);
+         fs->regs.cfa_reg = (_Unwind_Word)utmp;
          fs->regs.cfa_how = CFA_REG_OFFSET;
          break;
 
@@ -1005,14 +1016,17 @@ execute_cfa_program (const unsigned char *insn_ptr,
          break;
 
        case DW_CFA_def_cfa_sf:
-         insn_ptr = read_uleb128 (insn_ptr, &fs->regs.cfa_reg);
-         insn_ptr = read_sleb128 (insn_ptr, &fs->regs.cfa_offset);
+         insn_ptr = read_uleb128 (insn_ptr, &utmp);
+         fs->regs.cfa_reg = (_Unwind_Word)utmp;
+         insn_ptr = read_sleb128 (insn_ptr, &stmp);
+         fs->regs.cfa_offset = (_Unwind_Sword)stmp;
          fs->regs.cfa_how = CFA_REG_OFFSET;
          fs->regs.cfa_offset *= fs->data_align;
          break;
 
        case DW_CFA_def_cfa_offset_sf:
-         insn_ptr = read_sleb128 (insn_ptr, &fs->regs.cfa_offset);
+         insn_ptr = read_sleb128 (insn_ptr, &stmp);
+         fs->regs.cfa_offset = (_Unwind_Sword)stmp;
          fs->regs.cfa_offset *= fs->data_align;
          /* cfa_how deliberately not set.  */
          break;
@@ -1054,7 +1068,8 @@ execute_cfa_program (const unsigned char *insn_ptr,
          break;
 
        case DW_CFA_GNU_args_size:
-         insn_ptr = read_uleb128 (insn_ptr, &context->args_size);
+         insn_ptr = read_uleb128 (insn_ptr, &utmp);
+         context->args_size = (_Unwind_Word)utmp;
          break;
 
        case DW_CFA_GNU_negative_offset_extended:
@@ -1125,7 +1140,7 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
   insn = NULL;
   if (fs->saw_z)
     {
-      _Unwind_Word i;
+      _uleb128_t i;
       aug = read_uleb128 (aug, &i);
       insn = aug + i;
     }
@@ -1268,7 +1283,7 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
     case CFA_EXP:
       {
        const unsigned char *exp = fs->regs.cfa_exp;
-       _Unwind_Word len;
+       _uleb128_t len;
 
        exp = read_uleb128 (exp, &len);
        cfa = (void *) (_Unwind_Ptr)
@@ -1307,7 +1322,7 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
       case REG_SAVED_EXP:
        {
          const unsigned char *exp = fs->regs.reg[i].loc.exp;
-         _Unwind_Word len;
+         _uleb128_t len;
          _Unwind_Ptr val;
 
          exp = read_uleb128 (exp, &len);
@@ -1326,7 +1341,7 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
       case REG_SAVED_VAL_EXP:
        {
          const unsigned char *exp = fs->regs.reg[i].loc.exp;
-         _Unwind_Word len;
+         _uleb128_t len;
          _Unwind_Ptr val;
 
          exp = read_uleb128 (exp, &len);
index 3f4c06530ce1e6ac9c09a66f0d51786e26f62d85..1218d8c2b5397c4908d11e4f45397acd42b4f54f 100644 (file)
@@ -230,6 +230,35 @@ extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *);
    contains it.  */
 extern void * _Unwind_FindEnclosingFunction (void *pc);
 
+#ifndef __SIZEOF_LONG__
+  #error "__SIZEOF_LONG__ macro not defined"
+#endif
+
+#ifndef __SIZEOF_POINTER__
+  #error "__SIZEOF_POINTER__ macro not defined"
+#endif
+
+
+/* leb128 type numbers have a potentially unlimited size.
+   The target of the following definitions of _sleb128_t and _uleb128_t
+   is to have efficient data types large enough to hold the leb128 type
+   numbers used in the unwind code.
+   Mostly these types will simply be defined to long and unsigned long
+   except when a unsigned long data type on the target machine is not
+   capable of storing a pointer.  */
+
+#if __SIZEOF_LONG__ < __SIZEOF_POINTER__
+#ifdef HAVE_LONG_LONG
+  typedef long long _sleb128_t;
+  typedef unsigned long long _uleb128_t;
+#else
+  #error "long long data type is needed to define _sleb128_t"
+#endif
+#else
+  typedef long _sleb128_t;
+  typedef unsigned long _uleb128_t;
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index 8cd3fcdfb2423fa5307ed05605359bc5f3dbe7a9..9c56af0848618972a3747a91faac3f76bd316db7 100644 (file)
@@ -130,17 +130,17 @@ base_of_encoded_value (unsigned char encoding, struct _Unwind_Context *context)
    pointers should not be leb128 encoded on that target.  */
 
 static const unsigned char *
-read_uleb128 (const unsigned char *p, _Unwind_Word *val)
+read_uleb128 (const unsigned char *p, _uleb128_t *val)
 {
   unsigned int shift = 0;
   unsigned char byte;
-  _Unwind_Word result;
+  _uleb128_t result;
 
   result = 0;
   do
     {
       byte = *p++;
-      result |= ((_Unwind_Word)byte & 0x7f) << shift;
+      result |= ((_uleb128_t)byte & 0x7f) << shift;
       shift += 7;
     }
   while (byte & 0x80);
@@ -152,26 +152,26 @@ read_uleb128 (const unsigned char *p, _Unwind_Word *val)
 /* Similar, but read a signed leb128 value.  */
 
 static const unsigned char *
-read_sleb128 (const unsigned char *p, _Unwind_Sword *val)
+read_sleb128 (const unsigned char *p, _sleb128_t *val)
 {
   unsigned int shift = 0;
   unsigned char byte;
-  _Unwind_Word result;
+  _uleb128_t result;
 
   result = 0;
   do
     {
       byte = *p++;
-      result |= ((_Unwind_Word)byte & 0x7f) << shift;
+      result |= ((_uleb128_t)byte & 0x7f) << shift;
       shift += 7;
     }
   while (byte & 0x80);
 
   /* Sign-extend a negative value.  */
   if (shift < 8 * sizeof(result) && (byte & 0x40) != 0)
-    result |= -(((_Unwind_Word)1L) << shift);
+    result |= -(((_uleb128_t)1L) << shift);
 
-  *val = (_Unwind_Sword) result;
+  *val = (_sleb128_t) result;
   return p;
 }
 
@@ -215,7 +215,7 @@ read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base,
 
        case DW_EH_PE_uleb128:
          {
-           _Unwind_Word tmp;
+           _uleb128_t tmp;
            p = read_uleb128 (p, &tmp);
            result = (_Unwind_Internal_Ptr) tmp;
          }
@@ -223,7 +223,7 @@ read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base,
 
        case DW_EH_PE_sleb128:
          {
-           _Unwind_Sword tmp;
+           _sleb128_t tmp;
            p = read_sleb128 (p, &tmp);
            result = (_Unwind_Internal_Ptr) tmp;
          }
index 9b785af5f3ed043a5f47ed770e171f7f54422ecc..63b3f01a982dac8ebce931a991e7ec7e051177a4 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-24  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * exception.cc (parse_lsda_header, PERSONALITY_FUNCTION): Replaced
+       _Unwind_Word with _uleb128_t and _Unwind_SWord with _sleb128_t.
+
 2007-01-23  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR libgcj/30550
index 3d8fda1d790815c3c68a202f365cd76516024f4d..4875dfde52f55652a83af73087483d0682653e61 100644 (file)
@@ -128,7 +128,7 @@ static const unsigned char *
 parse_lsda_header (_Unwind_Context *context, const unsigned char *p,
                   lsda_header_info *info)
 {
-  _Unwind_Word tmp;
+  _uleb128_t tmp;
   unsigned char lpstart_encoding;
 
   info->Start = (context ? _Unwind_GetRegionStart (context) : 0);
@@ -251,7 +251,7 @@ PERSONALITY_FUNCTION (int version,
     return _URC_CONTINUE_UNWIND;
   else
     {
-      _Unwind_Word cs_lp, cs_action;
+      _uleb128_t cs_lp, cs_action;
       do
        {
          p = read_uleb128 (p, &cs_lp);
@@ -271,7 +271,7 @@ PERSONALITY_FUNCTION (int version,
   while (p < info.action_table)
     {
       _Unwind_Ptr cs_start, cs_len, cs_lp;
-      _Unwind_Word cs_action;
+      _uleb128_t cs_action;
 
       // Note that all call-site encodings are "absolute" displacements.
       p = read_encoded_value (0, info.call_site_encoding, p, &cs_start);
@@ -317,7 +317,7 @@ PERSONALITY_FUNCTION (int version,
   else
     {
       // Otherwise we have a catch handler.
-      _Unwind_Sword ar_filter, ar_disp;
+      _sleb128_t ar_filter, ar_disp;
 
       while (1)
        {
index 8cf4f9287a8628c1c2d58437a23d788913df3f6c..56f746ab99366ba82b99f29f493721399df46e9b 100644 (file)
@@ -1,3 +1,9 @@
+2007-01-24  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * libsupc++/eh_personality.cc (parse_lsda_header, check_exception_spec,
+       get_ttype_entry, empty_exception_spec, PERSONALITY_FUNCTION): Replaced
+       _Unwind_Word with _uleb128_t and _Unwind_SWord with _sleb128_t.
+
 2007-01-22  Paolo Carlini  <pcarlini@suse.de>
 
        * include/bits/stl_algobase.h (__fill_aux(unsigned char*,
index 9b0654b88756c11cfff8b459c13a5de7fd8082e5..1e7cc8034dfe9ae7e2be0f93381331e0294f5d50 100644 (file)
@@ -56,7 +56,7 @@ static const unsigned char *
 parse_lsda_header (_Unwind_Context *context, const unsigned char *p,
                   lsda_header_info *info)
 {
-  _Unwind_Word tmp;
+  _uleb128_t tmp;
   unsigned char lpstart_encoding;
 
   info->Start = (context ? _Unwind_GetRegionStart (context) : 0);
@@ -92,7 +92,7 @@ parse_lsda_header (_Unwind_Context *context, const unsigned char *p,
 // Return an element from a type table.
 
 static const std::type_info*
-get_ttype_entry(lsda_header_info* info, _Unwind_Word i)
+get_ttype_entry(lsda_header_info* info, _uleb128_t i)
 {
   _Unwind_Ptr ptr;
 
@@ -112,15 +112,15 @@ typedef _Unwind_Control_Block _throw_typet;
 
 static bool
 check_exception_spec(lsda_header_info* info, _throw_typet* throw_type,
-                    void* thrown_ptr, _Unwind_Sword filter_value)
+                    void* thrown_ptr, _sleb128_t filter_value)
 {
-  const _Unwind_Word* e = ((const _Unwind_Word*) info->TType)
+  const _uleb128_t* e = ((const _uleb128_t*) info->TType)
                          - filter_value - 1;
 
   while (1)
     {
       const std::type_info* catch_type;
-      _Unwind_Word tmp;
+      _uleb128_t tmp;
 
       tmp = *e;
       
@@ -210,7 +210,7 @@ typedef const std::type_info _throw_typet;
 // Return an element from a type table.
 
 static const std::type_info *
-get_ttype_entry (lsda_header_info *info, _Unwind_Word i)
+get_ttype_entry (lsda_header_info *info, _uleb128_t i)
 {
   _Unwind_Ptr ptr;
 
@@ -253,14 +253,14 @@ get_adjusted_ptr (const std::type_info *catch_type,
 
 static bool
 check_exception_spec(lsda_header_info* info, _throw_typet* throw_type,
-                     void* thrown_ptr, _Unwind_Sword filter_value)
+                     void* thrown_ptr, _sleb128_t filter_value)
 {
   const unsigned char *e = info->TType - filter_value - 1;
 
   while (1)
     {
       const std::type_info *catch_type;
-      _Unwind_Word tmp;
+      _uleb128_t tmp;
 
       e = read_uleb128 (e, &tmp);
 
@@ -329,7 +329,7 @@ static bool
 empty_exception_spec (lsda_header_info *info, _Unwind_Sword filter_value)
 {
   const unsigned char *e = info->TType - filter_value - 1;
-  _Unwind_Word tmp;
+  _uleb128_t tmp;
 
   e = read_uleb128 (e, &tmp);
   return tmp == 0;
@@ -489,7 +489,7 @@ PERSONALITY_FUNCTION (int version,
   while (p < info.action_table)
     {
       _Unwind_Ptr cs_start, cs_len, cs_lp;
-      _Unwind_Word cs_action;
+      _uleb128_t cs_action;
 
       // Note that all call-site encodings are "absolute" displacements.
       p = read_encoded_value (0, info.call_site_encoding, p, &cs_start);
@@ -535,7 +535,7 @@ PERSONALITY_FUNCTION (int version,
     {
       // Otherwise we have a catch handler or exception specification.
 
-      _Unwind_Sword ar_filter, ar_disp;
+      _sleb128_t ar_filter, ar_disp;
       const std::type_info* catch_type;
       _throw_typet* throw_type;
       bool saw_cleanup = false;