diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-02-05 05:00:52 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-02-05 05:03:07 -0800 |
commit | f4b78d1898203363e7f551497b6231d0f891d6f9 (patch) | |
tree | 7a6314e539a6952c9b100fc76c16735427de4b5c /.gitignore | |
parent | 7cc78d0780858b2f4a76c2867351cbfbb339c327 (diff) | |
download | gdb-f4b78d1898203363e7f551497b6231d0f891d6f9.zip gdb-f4b78d1898203363e7f551497b6231d0f891d6f9.tar.gz gdb-f4b78d1898203363e7f551497b6231d0f891d6f9.tar.bz2 |
Add plugin_input_file_t
This patchs adds plugin_input_file_t to implement get_input_file, get_view
and release_input_file. The maximum memeory overhead per IR input file
are about 40 bytes for plugin_input_file_t plus the memory to store input
IR filename. According to
http://gcc.gnu.org/wiki/whopr/driver
RELEASE_INPUT_FILE: Function pointer to the linker interface that
releases a file descriptor for a claimed input file. The plug-in library
must call this interface for each file descriptor obtained by the "get
input file" interface. It must release all such file descriptors before
returning from the WPA phase.
However, GCC plug-in library doesn't use the "get input file" interface.
It processed the IR input in the claim file handler. Since the the file
descriptor opened for the IR input was unused after the claim file
handler returns and GCC plug-in library before GCC 5 doesn't call the
RELEASE_INPUT_FILE function pointer, ld closed the file descriptor to
avoid leaking file descriptor. But this approach doesn't work with
other plug-in libraries which uses the "get input file", "get view" and
"release input file" interfaces. To avoid file descriptor leak with
GCC prior to GCC 5 and support other plug-in libraries at the same time,
we close the file descriptor only if the input IR file is a bfd_object
file. This scheme doesn't work when a plug-in library needs the file
descriptor and its IR is stored in bfd_object file.
PR ld/17878
* plugin.c: Include <errno.h>.
(errno): New. Declare if needed.
(plugin_input_file_t): New.
(get_input_file): Implemented.
(get_view): Likewise.
(release_input_file): Likewise.
(add_symbols): Updated.
(get_symbols): Likewise.
(plugin_maybe_claim): Allocate a plugin_input_file_t. Close fd
only for a bfd_object input.
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions