]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/generic/unwind-dw2-fde-glibc.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / generic / unwind-dw2-fde-glibc.c
index 2f7517441ca3c1b225d3f09cae1a028d1c5a686a..e09fd4ce4bead33e0381cd85e9f2aeda9037e439 100644 (file)
@@ -1,29 +1,21 @@
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
-   This file is part of GNU CC.
+   This file is part of the GNU C Library.
 
-   GNU CC 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.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
-   GNU CC is distributed in the hope that it will be useful,
+   The GNU C Library 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.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser 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
-   the Free Software Foundation, 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, if you link this library with other files,
-   some of which are compiled with GCC, to produce an executable,
-   this library does not by itself cause the resulting executable
-   to be covered by the GNU General Public License.
-   This exception does not however invalidate any other reasons why
-   the executable file might be covered by the GNU General Public License.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /* Locate the FDE entry for a given address, using PT_GNU_EH_FRAME ELF
    segment and dl_iterate_phdr to avoid register/deregister calls at
@@ -67,7 +59,7 @@ struct unw_eh_frame_hdr
 
 /* Like base_of_encoded_value, but take the base from a struct object
    instead of an _Unwind_Context.  */
-   
+
 static _Unwind_Ptr
 base_from_cb_data (unsigned char encoding, struct unw_eh_callback_data *data)
 {
@@ -80,7 +72,7 @@ base_from_cb_data (unsigned char encoding, struct unw_eh_callback_data *data)
     case DW_EH_PE_pcrel:
     case DW_EH_PE_aligned:
       return 0;
-                                 
+
     case DW_EH_PE_textrel:
       return (_Unwind_Ptr) data->tbase;
     case DW_EH_PE_datarel:
@@ -93,7 +85,8 @@ static int
 _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;
+  const ElfW(Phdr) *phdr, *p_eh_frame_hdr;
+  const ElfW(Phdr) *p_dynamic __attribute__ ((unused));
   long n, match;
   _Unwind_Ptr load_base;
   const unsigned char *p;
@@ -242,14 +235,19 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
   if (data->ret != NULL)
     {
       unsigned int encoding = get_fde_encoding (data->ret);
+      _Unwind_Ptr func;
       read_encoded_value_with_base (encoding,
                                    base_from_cb_data (encoding, data),
-                                   data->ret->pc_begin,
-                                   (_Unwind_Ptr *)&data->func);
+                                   data->ret->pc_begin, &func);
+      data->func = (void *) func;
     }
   return 1;
 }
 
+# ifdef _LIBC
+# define dl_iterate_phdr __dl_iterate_phdr
+# endif
+
 fde *
 _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
 {