Not understanding R_X86_64_COPY
Posted: Mon Mar 09, 2015 1:02 pm
I'm trying to implement dynamic library loading in my OS. Currently I handle 4 types of relocations: R_X86_64_64, R_X86_64_JUMP_SLOT, R_X86_64_RELATIVE and R_X86_64_GLOB_DAT. They relocate without problems. I understand I don't need to handle all types of relocations as they don't all appear in dynamic relocation tables... or am I wrong?
The other type of relocation I'm seeing if an executable references an "extern" variable is R_X86_64_COPY. I understand that I have to copy the symbol with the specified name from a library (according to r_offset, st_name and st_size?) but this does not really make sense to me. If the executable modifies the value of this variable the library wouldn't be able to see that change, because it has its own copy.
Or am I misunderstanding something here?
The other type of relocation I'm seeing if an executable references an "extern" variable is R_X86_64_COPY. I understand that I have to copy the symbol with the specified name from a library (according to r_offset, st_name and st_size?) but this does not really make sense to me. If the executable modifies the value of this variable the library wouldn't be able to see that change, because it has its own copy.
Or am I misunderstanding something here?