Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:14

0001 /*  $NetBSD: link_elf.h,v 1.8 2009/11/04 19:28:03 pooka Exp $   */
0002 
0003 /*
0004  * This only exists for GDB.
0005  */
0006 
0007 #ifndef _LINK_ELF_H_
0008 #define _LINK_ELF_H_
0009 
0010 #include <sys/types.h>
0011 
0012 #include <machine/elf_machdep.h>
0013 #include <stdint.h>
0014 #include <rtems/rtl/rtl-obj-fwd.h>
0015 
0016 #ifdef __cplusplus
0017 extern "C" {
0018 #endif
0019 
0020 enum sections
0021 {
0022   rap_text = 0,
0023   rap_const = 1,
0024   rap_ctor = 2,
0025   rap_dtor = 3,
0026   rap_data = 4,
0027   rap_bss = 5,
0028   rap_secs = 6
0029 };
0030 
0031 /**
0032  * Object details.
0033  */
0034 typedef struct
0035 {
0036   const char* name;   /**< Section name. */
0037   uint32_t    offset; /**< The offset in the elf file. */
0038   uint32_t    size;   /**< The size of the section. */
0039   uint32_t    rap_id; /**< Which obj does this section belongs to. */
0040 }section_detail;
0041 
0042 /**
0043  * link map structure will be used for GDB support.
0044  */
0045 struct link_map {
0046   const char*       name;                 /**< Name of the obj. */
0047   uint32_t          sec_num;              /**< The count of section. */
0048   section_detail*   sec_detail;           /**< The section details. */
0049   uint32_t*         sec_addr[rap_secs];   /**< The RAP section addr. */
0050   uint32_t          rpathlen;             /**< The length of the path. */
0051   char*             rpath;                /**< The path of object files. */
0052   struct link_map*  l_next;               /**< Linked list of mapped libs. */
0053   struct link_map*  l_prev;
0054 };
0055 
0056 /**
0057  * r_debug is used to manage the debug related structures.
0058  */
0059 struct r_debug {
0060     int r_version;                /* not used */
0061     struct link_map *r_map;     /* list of loaded images */
0062     enum {
0063         RT_CONSISTENT,            /* things are stable */
0064         RT_ADD,                     /* adding a shared library */
0065         RT_DELETE                   /* removing a shared library */
0066     } r_state;
0067 };
0068 
0069 /*
0070  * stub function. It is empty.
0071  */
0072 void _rtld_debug_state (void);
0073 
0074 /*
0075  * add link map to the list.
0076  */
0077 int _rtld_linkmap_add (rtems_rtl_obj* obj);
0078 
0079 /*
0080  * Remove link map from the list.
0081  */
0082 void _rtld_linkmap_delete (rtems_rtl_obj* obj);
0083 
0084 #ifdef __cplusplus
0085 }
0086 #endif
0087 #endif  /* _LINK_ELF_H_ */