[gold][patch] Fix file descriptor leak

Ian Lance Taylor iant@google.com
Fri Nov 5 21:05:00 GMT 2010


Cary Coutant <ccoutant@google.com> writes:

>         PR gold/10708
>         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
>         object when reading from the file.
>         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
>         second layout pass.
>         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
>         when reading section contents.
>         (get_section_contents): Likewise.
>         (icf::find_identical_sections): Likewise.
>         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
>         object when reading from the file.
>         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
>         the object when doing deferred section layout.

This is OK.

We should add that assert you mentioned as soon as we can.

We should also add some notion to the workqueue as to whether we are
running single-threaded.  We can use that to assert if there are ever
two jobs runnable when we think we are single-threaded.

We should then change these dummy_task Task_lock_obj calls to a
different locker which asserts that we are single threaded, does not
require a task, and calls variants of obj->lock and obj->unlock which do
not use a task.

Thanks for tracking this down.

Ian



More information about the Binutils mailing list