OSDN Git Service

* attribs.c (strip_attrs): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / unwind-dw2-fde-glibc.c
index ba9e3d2..1d2930d 100644 (file)
@@ -1,20 +1,20 @@
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
-   This file is part of GNU CC.
+   This file is part of GCC.
 
-   GNU CC is free software; you can redistribute it and/or modify
+   GCC is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
-   GNU CC is distributed in the hope that it will be useful,
+   GCC is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with GNU CC; see the file COPYING.  If not, write to
+   along with GCC; see the file COPYING.  If not, write to
    the Free Software Foundation, 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
     && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
        || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
 
-static fde * _Unwind_Find_registered_FDE (void *pc, struct dwarf_eh_bases *bases);
+#ifndef __RELOC_POINTER
+# define __RELOC_POINTER(ptr, base) ((ptr) + (base))
+#endif
+
+static const fde * _Unwind_Find_registered_FDE (void *pc, struct dwarf_eh_bases *bases);
 
 #define _Unwind_Find_FDE _Unwind_Find_registered_FDE
 #include "unwind-dw2-fde.c"
@@ -68,7 +72,7 @@ struct unw_eh_callback_data
   void *tbase;
   void *dbase;
   void *func;
-  fde *ret;
+  const fde *ret;
 };
 
 struct unw_eh_frame_hdr
@@ -109,7 +113,11 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
   struct unw_eh_callback_data *data = (struct unw_eh_callback_data *) ptr;
   const ElfW(Phdr) *phdr, *p_eh_frame_hdr, *p_dynamic;
   long n, match;
+#ifdef __FRV_FDPIC__
+  struct elf32_fdpic_loadaddr load_base;
+#else
   _Unwind_Ptr load_base;
+#endif
   const unsigned char *p;
   const struct unw_eh_frame_hdr *hdr;
   _Unwind_Ptr eh_frame;
@@ -132,7 +140,8 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
     {
       if (phdr->p_type == PT_LOAD)
        {
-         _Unwind_Ptr vaddr = phdr->p_vaddr + load_base;
+         _Unwind_Ptr vaddr = (_Unwind_Ptr)
+           __RELOC_POINTER (phdr->p_vaddr, load_base);
          if (data->pc >= vaddr && data->pc < vaddr + phdr->p_memsz)
            match = 1;
        }
@@ -146,7 +155,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
 
   /* Read .eh_frame_hdr header.  */
   hdr = (const struct unw_eh_frame_hdr *)
-       (p_eh_frame_hdr->p_vaddr + load_base);
+    __RELOC_POINTER (p_eh_frame_hdr->p_vaddr, load_base);
   if (hdr->version != 1)
     return 1;
 
@@ -155,9 +164,10 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
   data->dbase = NULL;
   if (p_dynamic)
     {
-      /* For dynamicly linked executables and shared libraries,
+      /* For dynamically linked executables and shared libraries,
         DT_PLTGOT is the gp value for that object.  */
-      ElfW(Dyn) *dyn = (ElfW(Dyn) *) (p_dynamic->p_vaddr + load_base);
+      ElfW(Dyn) *dyn = (ElfW(Dyn) *)
+       __RELOC_POINTER (p_dynamic->p_vaddr, load_base);
       for (; dyn->d_tag != DT_NULL ; dyn++)
        if (dyn->d_tag == DT_PLTGOT)
          {
@@ -166,13 +176,12 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
            break;
          }
     }
+# elif defined __FRV_FDPIC__ && defined __linux__
+  data->dbase = load_base.got_value;
 # else
 #  error What is DW_EH_PE_datarel base on this platform?
 # endif
 #endif
-#ifdef CRT_GET_RFIB_TEXT
-# error What is DW_EH_PE_textrel base on this platform?
-#endif
 
   p = read_encoded_value_with_base (hdr->eh_frame_ptr_enc,
                                    base_from_cb_data (hdr->eh_frame_ptr_enc,
@@ -264,11 +273,11 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
   return 1;
 }
 
-fde *
+const fde *
 _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
 {
   struct unw_eh_callback_data data;
-  fde *ret;
+  const fde *ret;
 
   ret = _Unwind_Find_registered_FDE (pc, bases);
   if (ret != NULL)