PR23282, Reinstate seek optimization

PR 23282
	* bfdio.c (bfd_seek): Optimize away seeks to current position.
This commit is contained in:
Alan Modra 2018-06-13 23:57:17 +09:30
parent ab89b5a57c
commit ff91d2f0e2
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2018-06-14 Alan Modra <amodra@gmail.com>
PR 23282
* bfdio.c (bfd_seek): Optimize away seeks to current position.
2018-06-13 Scott Egerton <scott.egerton@imgtec.com>
Faraz Shahbazker <Faraz.Shahbazker@mips.com>

View File

@ -330,6 +330,10 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
if (direction != SEEK_CUR)
position += offset;
if ((direction == SEEK_CUR && position == 0)
|| (direction == SEEK_SET && (ufile_ptr) position == abfd->where))
return 0;
result = abfd->iovec->bseek (abfd, position, direction);
if (result != 0)
{