We’re converting some of our libraries to be shared (this is in 6.1.0 on
an x86) and we’ve run into a serious problem.
It seems like any shared library that uses va_list, etc. (or maybe it’s
vsprintf()) will not be created or linked correctly, such that if an
executable is linked with that shared library it will segmentation fault
before main() is even invoked.
Here is a very simple testcase. Anyone have any ideas?
$ cat logapi.c
int logMsg(const char *fmt, …)
ret = vprintf(fmt, args);
$ cat logtest.c
$ cat Makefile
CC = gcc -g
liblogapi.so: logapi.o ; $(CC) -shared -o $@ $^
logtest: logtest.o liblogapi.so ; $(CC) -o $@ $^
gcc -g -c -o logtest.o logtest.c
gcc -g -c -o logapi.o logapi.c
gcc -g -shared -o liblogapi.so logapi.o
gcc -g -o logtest logtest.o liblogapi.so
$ LD_LIBRARY_PATH=. ./logtest
segmentation violation (core dumped)
$ LD_LIBRARY_PATH=. gdb ./logtest
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “–host=x86-pc-nto-qnx --target=ntox86”…
Starting program: /tmp/./logtest
Program received signal SIGSEGV, Segmentation fault.
0xb032b2db in ?? ()
#0 0xb032b2db in ?? ()
#1 0xb032b42b in ?? ()
#2 0xb032a363 in ?? ()
Paul D. Smith <email@example.com> HASMAT–HA Software Mthds & Tools
“Please remain calm…I may be mad, but I am a professional.” --Mad Scientist
These are my opinions—Nortel Networks takes no responsibility for them.