PR30724, cygwin ld performance regression since 014a602b86
authorAlan Modra <amodra@gmail.com>
Sun, 6 Aug 2023 22:58:55 +0000 (08:28 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 8 Aug 2023 23:17:35 +0000 (08:47 +0930)
commitf82ee0c8dc4ee32556e23e6cd83ef083618f704f
tree6775612169afe1cd7270f7fe4c10f5b451dfdb44
parent7570a17cbbe647db6260ae2391f92c0509de7924
PR30724, cygwin ld performance regression since 014a602b86

According to the reporter of this bug the newlib fseek implementation
is likely slowed down by locking and fflush, only attempting to
optimise seeks when the file is opened read-only.  Thus when writing
the output we get a dramatic slowdown due to commit 014a602b86.

PR 30724
* bfd.c (enum bfd_last_io): New.
(struct bfd): Add last_io field.
* bfd-in2.h: Regenerate.
* bfd-io.c (bfd_bread, bfd_bwrite): Force seek if last_io is
opposite direction.
(bfd_seek): Reinstate optimisation for seek to same position.
bfd/bfd-in2.h
bfd/bfd.c
bfd/bfdio.c