If i have a shared lib with some name like FTPobex with funtion name Func1() { printf("First function"); } And i have my local function void main() { Func1();/i call this function here using shared lib } //local function Func1() { printf("First function"); } Here,Func1() is a local function for this program .My program is not giving any linker error on this when i compiled it using GCC.There are 2 definitions of same function then also it works..Amazaing...? Then i remove my local Func1() function then it goes to shaerd lib funciotn and access that...Quite strange ? TRy it. Hope GCC developers will look on it. shantibhushan.sal2@gmail.com
This problem if it is a real issue, is not a GCC issue at all, GCC does not do dynamic loading or even the static linking. The problem here is you don't understand elf semantics. since we know that Func1 is local to the TU and you are not compiling with -fPIC/-fPIE/-fpie/-fpic, then we call directly Func1 in main instead of going through a PLT.