I compiled code(in linux) that make use of printf and I saw that during compile (gcc -c) the symbol stays printf but when I compile and link it (gcc -o) I see that the symbol changes to [email protected]. It also happens with other symbols that are part of glibc.
Does the linker change the symbol so it will only work when linking with one version of glibc and not others?
Does the linker change the symbol so it will only work when linking with one version of glibc and not others?
No.
To understand what's happening here, you need to know about GNU versioned symbols.
With very rare exceptions, GLIBC maintains backward compatibility (older programs continue to run when the version of GLIBC at runtime is the same or newer then the version against which the program was linked).
In case of [email protected], the printf ABI changed some time before 2002 (GLIBC-2.2.5 was released on 2002-01-20), and hasn't changed since. Your binary will work with any version of GLIBC released since then (for this specific symbol; you may be using other symbols that require newer GLIBC).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With