experchange > linux.development.apps

Johann Klammer (01-16-19, 11:41 AM)

I am just writing a library. It's buggy as hell.
It's the first compilable version after an episode of intense edits.
It's a malloc preload lib. with the default symbol names,
Of course the gdb will crash at startup.
So, I'd like to rename the symbols.
So I can run a minimal test.

in the c file I have(besides the malloc etc..)
the following aliases:
> ///realloc replacement
> void *brealloc (void *ptr, size_t size) __attribute__ (( alias ("realloc")));
> struct ptr_info bptr_info (void *ptr) __attribute__ (( alias ("ptr_info")));

the version script is:

> local:
> *;
> };

linking the test program against the generated lib fails.
I've tried setting the soname to libbmalloc.so.DEBUG and linking to that filename
> cc -D_REENTRANT -g -O0 -lpthread --library :../../libbmalloc.so.DEBUG -I../.. -Wall ./main.c

but none of the symbols are known.
/home/klammerj/projects/alc/src/libbmalloc/tests/burn_in/./main.c:48: undefined reference to `bfree'

how do I do this?

Johann Klammer (01-19-19, 12:06 AM)
On 01/16/2019 10:41 AM, Johann Klammer wrote:
> how do I do this?
> Regards,
> Johann

nevermind, it was missing a -Wl,...
also, it seems the -l:../../stuff
doesn't quite work without an additional path setting... -L../..
I seem to recall this is mentioned differently in some documentation....
(either the program library howto or info ld)
Similar Threads