This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Disallow protected data symbol with copy relocation?
"H. J. Lu" <hjl@lucon.org> writes:
> > Why would the linker ever generate a copy relocation for a protected
> > symbol? I don't see how that makes sense.
> >
>
> For some psABIs, copy relocation is the normal way for main to access
> data symbol on DSO.
> ...
Yes, I know. But clearly a copy relocation can not work. We should
treat this case as though -z nocopyreloc was used for that specific
symbol.
Maybe that is what you meant by "reject protected data symbol with
copy relocation." I am saying that the answer is not to reject the
symbol, it is to not generate the copy relocation.
There may be specific targets and/or cases where -z nocopyreloc does
not work, for some hideous reason. Those specific targets and/or
cases should generate a specific error. But this is not a general
problem.
Ian