This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gold patch RFC]: Release unused external member of thin archive


Cary Coutant <ccoutant@google.com> writes:

> This was dead code anyway (the if condition explicitly tests for obj == NULL).

Yeah, that part is just a cleanup.


> @@ -874,7 +870,13 @@ Archive::include_member(Symbol_table* sy
>      }
>
>    if (!input_objects->add_object(obj))
> -    delete obj;
> +    {
> +      // If this is an external member of a thin archive, unlock the
> +      // file.
> +      if (obj->offset() == 0)
> +	obj->unlock(this->task_);
> +      delete obj;
> +    }
>
> This looks good. Why not do this in the Object destructor, though?

1) No Task; 2) We routinely keep an Object open while the descriptor is
unlocked, and reopen the descriptor if necessary, so the descriptor may
or may not be locked at the point of destruction.

Committed.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]