diff options
author | Peng Fan <van.freenix@gmail.com> | 2013-09-05 10:32:00 +0800 |
---|---|---|
committer | Peng Fan <van.freenix@gmail.com> | 2013-09-05 13:47:39 +0800 |
commit | d605b623c94cc8c97fa9c831845a83a0b67735bc (patch) | |
tree | f6e134b310674074d613dd647d54fd3ec2e0a8e5 | |
parent | a48d508e21d4baa3e7c395218a3bce5ad2359d96 (diff) |
Add rpath support
Signed-off-by: Peng Fan <van.freenix@gmail.com>
-rw-r--r-- | libbsd/include/link_elf.h | 2 | ||||
-rw-r--r-- | rtl-rap.c | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libbsd/include/link_elf.h b/libbsd/include/link_elf.h index 679d8e1..6419561 100644 --- a/libbsd/include/link_elf.h +++ b/libbsd/include/link_elf.h @@ -39,6 +39,8 @@ struct link_map { uint32_t sec_num; /**< The count of section. */ section_detail* sec_detail; /**< The section details. */ uint32_t* sec_addr[rap_secs]; /**< The RAP section addr. */ + uint32_t rpathlen; /**< The length of the path. */ + char* rpath; /**< The path of object files. */ struct link_map* l_next; /**< Linked list of mapped libs. */ struct link_map* l_prev; }; @@ -115,6 +115,7 @@ typedef struct rtems_rtl_rap_s uint32_t relocs_size; /**< The relocation table size. */ uint32_t symbols; /**< The number of symbols. */ uint32_t strtable_size;/**< The size of section names and obj names. */ + uint32_t rpathlen; /**< The length of rpath. */ char* strtable; /**< The detail string which resides in obj detail. */ } rtems_rtl_rap_t; @@ -468,11 +469,31 @@ rtems_rtl_rap_load_details (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj) return false; } + if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL)) + { + if (rap->rpathlen > 0) + printf ("File rpath:\n"); + } + + while (pos < rap->rpathlen) + { + if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL)) + { + printf (" %s\n", rap->strtable + pos); + } + pos = pos + strlen (rap->strtable + pos) + 1; + } + + if (rap->rpathlen > 0) + pos = rap->rpathlen; + for (i = 0; i < obj->obj_num; ++i) { tmp1 = (struct link_map*) (obj->detail) + i; tmp1->name = rap->strtable + pos; tmp1->sec_num = obj->sec_num[i]; + tmp1->rpathlen = rap->rpathlen; + tmp1->rpath = (char*) rap->strtable; pos += strlen (tmp1->name) + 1; if (!i) @@ -868,6 +889,9 @@ rtems_rtl_rap_file_load (rtems_rtl_obj_t* obj, int fd) { obj->sec_num = (uint32_t*) malloc (sizeof (uint32_t) * obj->obj_num); + if (!rtems_rtl_rap_read_uint32 (rap.decomp, &rap.rpathlen)) + return false; + uint32_t i; for (i = 0; i < obj->obj_num; ++i) { |