bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/17878] Need support on bfd ld for LLVMgold.so plugin


From: cvs-commit at gcc dot gnu.org
Subject: [Bug ld/17878] Need support on bfd ld for LLVMgold.so plugin
Date: Thu, 05 Feb 2015 13:07:22 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=17878

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot 
gnu.org> ---
The master branch has been updated by H.J. Lu <address@hidden>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f4b78d1898203363e7f551497b6231d0f891d6f9

commit f4b78d1898203363e7f551497b6231d0f891d6f9
Author: H.J. Lu <address@hidden>
Date:   Thu Feb 5 05:00:52 2015 -0800

    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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]