[PATCH] gold: Avoid sharing Plugin_list::iterator
H.J. Lu
hjl.tools@gmail.com
Fri Nov 6 01:46:46 GMT 2020
On Thu, Nov 5, 2020 at 4:42 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Thu, Nov 05, 2020 at 03:49:55PM -0800, H.J. Lu wrote:
> > On Thu, Nov 5, 2020 at 3:04 PM Alan Modra <amodra@gmail.com> wrote:
> > >
> > > On Thu, Nov 05, 2020 at 06:07:55AM -0800, H.J. Lu via Binutils wrote:
> > > > class Plugin_manager has
> > > >
> > > > // A pointer to the current plugin. Used while loading plugins.
> > > > Plugin_list::iterator current_;
> > > >
> > > > The same iterator is shared by all threads. It is OK to use it to load
> > > > plugins since only one thread loads plugins. Avoid sharing Plugin_list
> > > > iterator in all other cases.
> > >
> > > What two pieces of code are simultaneously changing
> > > Plugin_manager::current_? I'm concerned that the underlying thread
> >
> > Not about changing. It is about sharing Plugin_list::iterator. The current
> > gold uses one global iterator for all threads, similar to
>
> HJ, I don't need to be told why sharing variables among threads can go
> wrong. I understand that quite well. I was asking for the specifics
> of what was going wrong. Now if you haven't analysed the problem to
> that level, that's fine, just say so.
I didn't know what went wrong.
> You do realise that if two threads are simultaneously running
> Plugin_manager::all_symbols_read then your patch hasn't stopped the
> underlying lto all_symbols_read from being called twice?
>
I don't recall this was the issue when I studied it a few months ago.
--
H.J.
More information about the Binutils
mailing list