Hi,
I create a shared library where I put some stuff I use for
different programs which makes a lot of grief to me. The problem is that
some of the functions seems to be not correctly linked in my executables
sometimes and only with some recompilations of the shared library. When I
call a function instead of enterring inside that function like normal, the
program jumps to completely different line in another function of the
shared library. Seems like the linker did not put the proper offset from
the library text start in the executable.
There is no text segment overwrite by some pointer at this moment
as I execute it as the first line in the main() function, stack is not
involved as it is a call and not a return, and it happens the same way in
three different programs I link against the library and it happens only
after some recompilations of the library, on other recompilations with the
same library it works well.
How I create the library:
cc -Wall -c -ggdb aflib.c
cc -shared -o libaf.so aflib.o
cp libaf.so /usr/local/lib/
How I compile:
gcc l3.c -laf -lmq -o l3 -ggdb -Wall -pedantic
I use gcc 2.7.2.1, link dynamic of cource. The program is
recompiled every time I touch the library.
How may I get a load map for the library and the programs? How may
I identify if the library is well created? And what this problem may be at
all?
George.