[PATCH] Save/restore file offset while reading notes in core file

Keith Seitz keiths@redhat.com
Fri Mar 26 17:48:08 GMT 2021


On 3/18/21 9:22 PM, Alan Modra wrote:
> On Thu, Mar 18, 2021 at 08:40:26AM -0700, Keith Seitz via Binutils wrote:
>> 	* elfcore.h (_bfd_elf_core_find_build_id): Save and restore
>> 	file offset when calling elf_read_notes.
> 
> Looks OK to me, but you could avoid the ftell with
> 
> 	  /* Make sure ABFD returns to processing the program headers.  */
> 	  if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff
> 					  + (i + 1) * sizeof (x_phdr)),
> 			SEEK_SET) != 0)
> 	    goto fail;
> 
> Either way is fine.
> 

After seeing all the hoops that tell can jump through, I've decided
to run with your suggestion, and I've pushed this change.

Thank you for taking a look!

Keith



More information about the Binutils mailing list