RFC: Disallow protected data symbol with copy relocation?

Ian Lance Taylor ian@airs.com
Fri Jan 21 06:26:00 GMT 2005


"H. J. Lu" <hjl@lucon.org> writes:

> Avoid copy relocation leads to writable text section on ia32. I am not
> sure that generate writable text section without -z nocopyreloc is a
> good idea.

I don't see why it is better to prevent the user from generating an
executable at all.

What this is really leading up to is that it is unwise for a shared
library to declare a global variable to be protected.  Doing that
makes it costly for the main executable to refer to that global
variable.

But if a shared library does declare a global variable to be
protected, and if the main executable does refer to it, I think we
should attempt to support that.  I don't see why we should simply
reject it and make it impossible to use the shared library in that
way.  We could perhaps issue a warning in that case.

> I don't think -z nocopyreloc works on x86_64.

Can it be fixed, or is there some reason that it is impossible?

Ian



More information about the Binutils mailing list