On 8/10/23 05:22, Ashraf, Islam via Gcc wrote:
I have a question regarding a limitation in gcc which is when I use gcc to link 
my main.o file with 2 .so files each one has a function with the same name but 
one of them has it with the __attribute__(weak) and I call this function from 
main.o the execution occurs dependently on the order of linking. Do you have a 
plan to fix this bug or is it not in your plans?

This doesn't seem like a GCC issue. Linking and symbol resolution is handled either by the linker itself (from binutils) or the runtime loader ld.so, which is part of glibc. As I recall the glibc ld.so used to have the behavior you seem to expect, but was deliberately changed many years ago to the behavior you observe, I think for performance reasons.

Jason

Reply via email to