Open joehendrix opened 5 years ago
This is the updated link: https://stevens.netmeister.org/631/elf.html
One problem with the R_X86_64_COPY
relocation is that the size of the relocation depends on the size of the symbol. This relocation is used to copy the value of an initialised variable into the location in the binary where it lives --- the dynamic library will have a copy of the variable which is the source of the copy.
Elf relocations of type
R_X86_64_COPY
are used in dynamic binaries that reference variables defined in shared libraries. We should add support for these, but it may be a bit tricky.The variables are stored in the binary's
.bss
section, and so the relocation target is within the.bss
section for the binary. These relocations can be used to tell us that address is used to store a given global variable, and this information may be of use in LLVM generation or other binaries transformations.A couple references that describe this are https://www.cs.stevens.edu/~jschauma/631/elf.html and https://stac47.github.io/c/relocation/elf/tutorial/2018/03/01/understanding-relocation-elf.html.
In addition to adding support, test cases should be written to validate the understanding.