source: rtems/cpukit/libdl/rtl-unwind-dw2.c @ c6eead1

5
Last change on this file since c6eead1 was c6eead1, checked in by Chris Johns <chrisj@…>, on 12/07/16 at 06:20:38

libdl: Add C++ exception support to loaded modules.

This has been tested on SPARC, i386, PowerPC and ARM.

Closes #2767.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 2012-2016 Chris Johns <chrisj@rtems.org>
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.rtems.org/license/LICENSE.
7 */
8/**
9 * @file
10 *
11 * @ingroup rtems_rtld
12 *
13 * @brief RTEMS Run-Time Link Editor
14 *
15 * This is the RTL implementation.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <string.h>
23#include <stdio.h>
24
25#include <rtems/rtl/rtl.h>
26#include "rtl-elf.h"
27#include "rtl-error.h"
28#include "rtl-unwind.h"
29#include "rtl-unwind-dw2.h"
30
31/*
32 * These interfaces are not exported outside the GCC source.
33 */
34void __register_frame (void *begin);
35void __deregister_frame (void *begin);
36
37bool
38rtems_rtl_elf_unwind_dw2_parse (const rtems_rtl_obj_t* obj,
39                                const char*            name,
40                                uint32_t               flags)
41{
42  return
43    ((flags & RTEMS_RTL_OBJ_SECT_CONST) != 0) &&
44    ((strcmp(name, ".eh_frame") == 0) ||
45     (strncmp(name, ".gcc_except_table.", sizeof (".gcc_except_table.") - 1) == 0));
46}
47
48bool
49rtems_rtl_elf_unwind_dw2_register (const rtems_rtl_obj_t* obj)
50{
51  rtems_rtl_obj_sect_t* sect = rtems_rtl_obj_find_section (obj, ".eh_frame");
52
53  if (sect != NULL && sect->size > 0 && sect->base != NULL)
54  {
55    __register_frame (sect->base);
56  }
57
58  return true;
59}
60
61bool rtems_rtl_elf_unwind_dw2_deregister (const rtems_rtl_obj_t* obj)
62{
63  rtems_rtl_obj_sect_t* sect = rtems_rtl_obj_find_section (obj, ".eh_frame");
64
65  if (sect != NULL && sect->size > 0 && sect->base != NULL)
66  {
67    __deregister_frame (sect->base);
68  }
69
70  return true;
71}
Note: See TracBrowser for help on using the repository browser.