RTEMS | Add dladdr() support to RTEMS (!679)
Chris Johns (@chris)
gitlab at rtems.org
Thu Aug 21 23:58:06 UTC 2025
Merge request https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/679 was reviewed by Chris Johns
--
Chris Johns started a new discussion on cpukit/libdl/dlfcn.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/679#note_129221
> + rtems_rtl_unlock ();
> +
> + return obj != NULL;
Please code this to return an `int`. This line determines a `bool` that is cast to `int`. Use `obj != NULL ? 1 : 0` .
--
Chris Johns started a new discussion on cpukit/libdl/rtl.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/679#note_129222
> + {
> + if (addr >= obj->text_base &&
> + addr < (void*)((char*)obj->text_base + obj->text_size))
Should the addition code be moved to a `static` function at the top of this file as a helper? It is easy to code this type of stuff wrong.
--
Chris Johns started a new discussion on cpukit/libdl/rtl.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/679#note_129223
> +
> + if (obj->const_base && (!base || obj->const_base < base))
> + base = obj->const_base;
These addresses should not overlap so lets use `} else if () {`.
--
Chris Johns started a new discussion on cpukit/include/rtems/rtl/rtl.h: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/679#note_129224
> +rtems_rtl_obj_sym* rtems_rtl_obj_find_symbol_by_addr (const rtems_rtl_obj* obj,
> + const void* addr);
> +
Please move these to under the sym call. The file is not last at the end, rather they are functionally grouped.
--
Chris Johns started a new discussion on cpukit/libdl/rtl.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/679#note_129225
> +rtems_rtl_obj_find_by_addr (const void* addr)
> +{
> + rtems_chain_control* objects;
Please place these calls in the same order as declared in the `rtl.h` header file.
--
Chris Johns started a new discussion on cpukit/libdl/rtl.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/679#note_129226
> + {
> + best_sym = sym;
> + best_addr = sym->value;
Does this loop assume the sym table is sorted from low to high addresses?
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/679
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250821/24a5935e/attachment-0001.htm>
More information about the bugs
mailing list