diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-07-06 06:21:54 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-07-07 07:44:39 -0700 |
commit | 7a30ac441a4e776e68399cb916c4731b5192e931 (patch) | |
tree | 6c117dae85d6a43e3ec89cbdc8a03751e4d6732c /ld/plugin.c | |
parent | b180e8298b2068c2a530c25d0d6c4f2be651e12e (diff) | |
download | gdb-7a30ac441a4e776e68399cb916c4731b5192e931.zip gdb-7a30ac441a4e776e68399cb916c4731b5192e931.tar.gz gdb-7a30ac441a4e776e68399cb916c4731b5192e931.tar.bz2 |
ld: Check archive only for archive member
Since plugin_maybe_claim calls bfd_close on the original input BFD if it
isn't an archive member, pass NULL to bfd_plugin_close_file_descriptor
to indicate that the BFD isn't an archive member.
bfd/
PR ld/18028
* plugin.c (bfd_plugin_close_file_descriptor): Check archive
only of abfd != NULL.
(try_claim): Pass NULL to bfd_plugin_close_file_descriptor if
it isn't an archive member.
ld/
PR ld/18028
* plugin.c (plugin_input_file): Add comments for abfd and ibfd.
(plugin_object_p): Set input->ibfd to NULL if it isn't an
archive member.
Diffstat (limited to 'ld/plugin.c')
-rw-r--r-- | ld/plugin.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ld/plugin.c b/ld/plugin.c index bb369f4..b91a958 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -102,7 +102,9 @@ typedef struct view_buffer pointer. */ typedef struct plugin_input_file { + /* The dummy BFD. */ bfd *abfd; + /* The original input BFD. Non-NULL if it is an archive member. */ bfd *ibfd; view_buffer_t view_buffer; char *name; @@ -1220,7 +1222,7 @@ plugin_object_p (bfd *ibfd) file.handle = input; input->abfd = abfd; - input->ibfd = ibfd; + input->ibfd = ibfd->my_archive != NULL ? ibfd : NULL; input->view_buffer.addr = NULL; input->view_buffer.filesize = 0; input->view_buffer.offset = 0; |