[rtems commit] libdl/rap: Correctly check the return enum from rela calls

Chris Johns chrisj at rtems.org
Tue May 5 05:03:32 UTC 2020


Module:    rtems
Branch:    master
Commit:    b7702c541c563df2d857308fc4d12d818e9b5c3b
Changeset: http://git.rtems.org/rtems/commit/?id=b7702c541c563df2d857308fc4d12d818e9b5c3b

Author:    Chris Johns <chrisj at rtems.org>
Date:      Tue May  5 14:58:27 2020 +1000

libdl/rap: Correctly check the return enum from rela calls

- The change from bool to an enum did not trip a compiler warning
  and only the rel path was changed. The rela path was missed so
  archs like SPARC failed.

Updates #3969

---

 cpukit/libdl/rtl-rap.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/cpukit/libdl/rtl-rap.c b/cpukit/libdl/rtl-rap.c
index 4e4540c..32f4bd6 100644
--- a/cpukit/libdl/rtl-rap.c
+++ b/cpukit/libdl/rtl-rap.c
@@ -326,6 +326,7 @@ rtems_rtl_rap_relocate (rtems_rtl_rap* rap, rtems_rtl_obj* obj)
         if (!symsect)
         {
           free (symname_buffer);
+          rtems_rtl_set_error (EINVAL, "symsect not found: %d", info >> 8);
           return false;
         }
 
@@ -389,8 +390,12 @@ rtems_rtl_rap_relocate (rtems_rtl_rap* rap, rtems_rtl_obj* obj)
                   r, (int) type, offset, (int) addend,
                   symname, (uintmax_t) symtype, (uintmax_t) symvalue);
 
-        if (!rtems_rtl_elf_relocate_rela (obj, &rela, targetsect,
-                                          symname, symtype, symvalue))
+        if (rtems_rtl_elf_relocate_rela (obj,
+                                         &rela,
+                                         targetsect,
+                                         symname,
+                                         symtype,
+                                         symvalue) == rtems_rtl_elf_rel_failure)
         {
           free (symname_buffer);
           return false;
@@ -409,8 +414,12 @@ rtems_rtl_rap_relocate (rtems_rtl_rap* rap, rtems_rtl_obj* obj)
                   r, (int) type, offset,
                   symname, (uintmax_t) symtype, (uintmax_t) symvalue);
 
-        if (rtems_rtl_elf_relocate_rel (obj, &rel, targetsect,
-                                         symname, symtype, symvalue) == rtems_rtl_elf_rel_failure)
+        if (rtems_rtl_elf_relocate_rel (obj,
+                                        &rel,
+                                        targetsect,
+                                        symname,
+                                        symtype,
+                                        symvalue) == rtems_rtl_elf_rel_failure)
         {
           free (symname_buffer);
           return false;



More information about the vc mailing list