This is the mail archive of the 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] PowerPC tls_get_addr_optimize

> Delta from the last patch, to see if you still like it this way.  I
> don't pretend to be a C++ programmer, so don't really have an opinion
> worth that much.  :)  Note removal of private operator=

Yeah, that's not ideal. The Symbol class was written without a
constructor, and Symbol objects are supposed to be initialized via one
of the Symbol::init_base_xxx methods; likewise, Sized_symbol objects
are supposed to be initialized via Sized_symbol::init_xxx methods.
Rather than allow the compiler-generated assignment operator, I'd
implement a Sized_symbol::clone() which uses the style of
Sized_symbol::override() to explicitly copy those fields you need to

(I still don't like the idea of using memcpy.)

> +         Sized_symbol<size>* from
> +           = static_cast<Sized_symbol<size>*>(this->tls_get_addr_);
> +         Sized_symbol<size>* to
> +           = static_cast<Sized_symbol<size>*>(this->tls_get_addr_opt_);

[Aside: Where you store Symbol* in the ppc target, couldn't you have
stored a Sized_symbol* instead, making these casts unnecessary? Just
curiosity -- probably not worth the effort to change.]

> Incidentally, with gcc-7 I find I need to write
>           symtab->template clone<Sized_symbol<size> >(to, from);

Yeah, it's probably strictly necessary, because the template parameter
is yet another templated class. You could just template on <size>
instead of <Sized_symbol<size> >, but then you'd lose mips support.
I'd opt for the simpler <size> version, and let the mips target deal
with it if and when they ever need to use clone().


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