From d605b623c94cc8c97fa9c831845a83a0b67735bc Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 5 Sep 2013 10:32:00 +0800 Subject: Add rpath support Signed-off-by: Peng Fan --- libbsd/include/link_elf.h | 2 ++ rtl-rap.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) 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; }; diff --git a/rtl-rap.c b/rtl-rap.c index 3633002..cf90fc7 100644 --- a/rtl-rap.c +++ b/rtl-rap.c @@ -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) { -- cgit v1.2.3