Linking against older symbol version in a .so file

I found the following working solution. First create file memcpy.c: #include <string.h> /* some systems do not have newest memcpy@@GLIBC_2.14 – stay with old good one */ asm (“.symver memcpy, memcpy@GLIBC_2.2.5”); void *__wrap_memcpy(void *dest, const void *src, size_t n) { return memcpy(dest, src, n); } No additional CFLAGS needed to compile this file. Then link … Read more

VA (Virtual Address) & RVA (Relative Virtual Address)

Most Windows process (*.exe) are loaded in (user mode) memory address 0x00400000, that’s what we call the “virtual address” (VA) – because they are visible only to each process, and will be converted to different physical addresses by the OS (visible by the kernel / driver layer). For example, a possible physical memory address (visible … Read more

GCC(/Clang): Merging functions with identical instructions (COMDAT folding)

Neither GCC nor Clang is a linker, and ICF needs to be done by the linker, or at least with cooperation with the linker. Edit: They don’t do ICF, so yes, distinct instantiations produce distinct code. The GNU gold linker supports ICF with the –icf option, which needs the GCC option -ffunction-sections to be used. … Read more