(root)/
gcc-13.2.0/
libgcc/
config/
arm/
unwind-arm-vxworks.c
       1  /* Support for ARM EABI unwinding on VxWorks Downloadable Kernel Modules.
       2     Copyright (C) 2017-2023 Free Software Foundation, Inc.
       3  
       4     This file is free software; you can redistribute it and/or modify it
       5     under the terms of the GNU General Public License as published by the
       6     Free Software Foundation; either version 3, or (at your option) any
       7     later version.
       8  
       9     This file is distributed in the hope that it will be useful, but
      10     WITHOUT ANY WARRANTY; without even the implied warranty of
      11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12     General Public License for more details.
      13  
      14     Under Section 7 of GPL version 3, you are granted additional
      15     permissions described in the GCC Runtime Library Exception, version
      16     3.1, as published by the Free Software Foundation.
      17  
      18     You should have received a copy of the GNU General Public License and
      19     a copy of the GCC Runtime Library Exception along with this program;
      20     see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      21     <http://www.gnu.org/licenses/>.  */
      22  
      23  /* The common unwinding code refers to __gnu_Unwind_Find_exidx and
      24     __cxa_type_match symbols, which are not in VxWorks kernels on ARM,
      25     now llvm based.
      26  
      27     While the common code works just fine for RTPs thanks to weak references
      28     and proper positioning of __exidx_start/end from linker scripts, we need
      29     symbol definitions for kernel modules.  */
      30  
      31  #ifndef __RTP__
      32  
      33  #include <private/moduleLibP.h>
      34  
      35  /* __gnu_Unwind_Find_exidx.  See if we can use _func_moduleExidxGet to
      36     refine whatever we have in __exidx_start and __exidx_end.  */
      37  
      38  typedef struct
      39  {
      40    UINT32 fnoffset;
      41    UINT32 content;
      42  } __EIT_entry;
      43  
      44  extern __EIT_entry __exidx_start;
      45  extern __EIT_entry __exidx_end;
      46  
      47  __EIT_entry *
      48  __gnu_Unwind_Find_exidx (void *pc, int *nrec)
      49  {
      50    __EIT_entry *pstart = 0;
      51    __EIT_entry *pend = 0;
      52  
      53    if (_func_moduleExidxGet != NULL)
      54      _func_moduleExidxGet (pc,
      55  			  (void *) &__exidx_start, (void *) &__exidx_end,
      56  			  (void **) &pstart, (void **) &pend);
      57  
      58    if (!pstart)
      59      {
      60        pstart = &__exidx_start;
      61        pend = &__exidx_end;
      62      }
      63  
      64    *nrec = pend - pstart;
      65  
      66    return pstart;
      67  }
      68  
      69  /* __cxa_type_match.  A dummy version to be overridden by the libstdc++ one
      70   when we link with it.  */
      71  
      72  void * __attribute__((weak))
      73  __cxa_type_match ()
      74  {
      75    return (void *) 0;
      76  }
      77  
      78  #endif