Copy relocations against protected symbols

John D. Hendrickson johnandsara2@cox.net
Sat Dec 13 18:10:00 GMT 2014


Alan Modra wrote:
> Copy relocs are used in a scheme to avoid dynamic text relocations in
> non-PIC executables that refer to variables defined in shared
> libraries.  The idea is to have the linker define any such variable in
> the executable, with a copy reloc copying the initial value, then have
> both the executable and shared library refer to the executable copy.
> If the shared library defines the variable as protected then we have

i find the statements a cross-testimony, contradictory

if the library has posted a symbol as protected there is a reason

if a program contains a reference to the symbol and writes to it (i'm 
unsure that's possible) then obviously the program is faulty, as it 
broke a rule, and i'd expect a segfault of the largess of the shared lib 
was in protected memory

the program could easily copy the value, or, open the library itself 
(meaning the program could load a private copy of lib if it needed to do 
so, rather than force all other programs to run code that is usually the 
wrong thing to do)



More information about the Binutils mailing list