bfd: Close the file descriptor if there is no archive fd
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 26 Jul 2021 12:59:55 +0000 (05:59 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 28 Jul 2021 13:01:32 +0000 (06:01 -0700)
commit5a98fb7513b559e20dfebdbaa2a471afda3b4742
tree9afa418dac0808e77bfa34eaa1fe719b08e4725e
parent265dcb69c2ec6e9f24f40cb25349534e44360098
bfd: Close the file descriptor if there is no archive fd

Close the file descriptor if there is no archive plugin file descriptor
to avoid running out of file descriptors on thin archives with many
archive members.

bfd/

PR ld/28138
* plugin.c (bfd_plugin_close_file_descriptor): Close the file
descriptor there is no archive plugin file descriptor.

ld/

PR ld/28138
* testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
* testsuite/ld-plugin/pr28138.c: New file.
* testsuite/ld-plugin/pr28138-1.c: Likewise.
* testsuite/ld-plugin/pr28138-2.c: Likewise.
* testsuite/ld-plugin/pr28138-3.c: Likewise.
* testsuite/ld-plugin/pr28138-4.c: Likewise.
* testsuite/ld-plugin/pr28138-5.c: Likewise.
* testsuite/ld-plugin/pr28138-6.c: Likewise.
* testsuite/ld-plugin/pr28138-7.c: Likewise.
bfd/plugin.c
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/ld-plugin/pr28138-1.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr28138-2.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr28138-3.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr28138-4.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr28138-5.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr28138-6.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr28138-7.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr28138.c [new file with mode: 0644]