aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfdio.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-06-13 23:57:17 +0930
committerAlan Modra <amodra@gmail.com>2018-06-14 11:32:01 +0930
commitff91d2f0e20fc91b6b101a0b20cbd38ab2d7fb50 (patch)
tree84072389f64c95fef1d958196eaa68b0f7a97077 /bfd/bfdio.c
parentab89b5a57cff984d1edbcb6ca19c8f4a77c511a8 (diff)
downloadgdb-ff91d2f0e20fc91b6b101a0b20cbd38ab2d7fb50.zip
gdb-ff91d2f0e20fc91b6b101a0b20cbd38ab2d7fb50.tar.gz
gdb-ff91d2f0e20fc91b6b101a0b20cbd38ab2d7fb50.tar.bz2
PR23282, Reinstate seek optimization
PR 23282 * bfdio.c (bfd_seek): Optimize away seeks to current position.
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r--bfd/bfdio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 136fa8b..1f4caca 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -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)
{