xiaoxiang781216 commented on code in PR #19942:
URL: https://github.com/apache/nuttx/pull/19942#discussion_r3925599960


##########
libs/libc/elf/elf_load.c:
##########
@@ -572,15 +731,15 @@ int libelf_load(FAR struct mod_loadinfo_s *loadinfo)
       goto errout_with_buffers;
     }
 
-  loadinfo->gotindex = libelf_findsection(loadinfo, ".got");

Review Comment:
   let's save gotbase here



##########
boards/arm/mps/mps3-an547/src/mps3_bringup.c:
##########
@@ -147,7 +147,7 @@ int board_boot_image(const char *path, uint32_t hdr_size)
     }
 
   bss = libelf_findsection(&loadinfo, ".bss");
-  got = loadinfo.shdr[loadinfo.gotindex].sh_addr;
+  got = loadinfo.gotbase;

Review Comment:
   Let's use gotbase directly



##########
libs/libc/elf/elf_load.c:
##########
@@ -508,13 +546,30 @@ static inline int libelf_loadfile(FAR struct 
mod_loadinfo_s *loadinfo)
         }
     }
 
-  /* Update GOT table */
+  /* Note the GOT.  The sections are placed by now, thus .got carries the
+   * address it will be read at.  An FDPIC object's sections are never
+   * placed, and libelf_bind() takes its base from DT_PLTGOT instead.
+   */
 
-  if (loadinfo->gotindex >= 0)
+  ret = libelf_findsection(loadinfo, ".got");

Review Comment:
   why find section again



##########
libs/libc/elf/elf_load.c:
##########
@@ -728,15 +970,15 @@ int libelf_load_with_addrenv(FAR struct mod_loadinfo_s 
*loadinfo)
       goto errout_with_buffers;
     }
 
-  loadinfo->gotindex = libelf_findsection(loadinfo, ".got");

Review Comment:
   let's save result here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to