Hello,

I want to build and use a secondary glibc on my machine;
This glibc will be used not as a default but only for special
testing; I want to adhere to original glibc with usual
apps/compilations.

What I did is:
I ran ./configure of glibc so that
my --prefix for configure glibc was /work/src/glibc-2.3.2-prefix;
I ran make install and make check for glibc (both were OK).

Now I had compiled a little program (named test_printf.c) like thus:

gcc -I/work/src/glibc-2.3.2-prefix/include -g test_printf.c -nostdlib
-nostartfiles
-Wl,-dynamic-linker=/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2
/work/src/glibc-2.3.2-prefix/lib/crt1.o
/work/src/glibc-2.3.2-prefix/lib/crti.o
-L/work/src/glibc-2.3.2-prefix/lib
/work/src/glibc-2.3.2-prefix/lib/libdl.so.2 -lc
/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2
/work/src/glibc-2.3.2-prefix/lib/libc_nonshared.a -lgcc `gcc
--print-file-name=crtend.o` /work/src/glibc-2.3.2-prefix/lib/crtn.o -o
test_printf

this build succeed. I had verified that the generated executable file ,
test_print, is linked with the correct new
glibc libraries this:

APPOLO:/work/dev/tests/misc# ldd test_printf
libdl.so.2 => /work/src/glibc-2.3.2-prefix/lib/libdl.so.2 (0x40016000)
libc.so.6 => /work/src/glibc-2.3.2-prefix/lib/libc.so.6 (0x40019000)
/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2 =>
/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2 (0x40000000)

and I am trying to run it like thus:

I wrote a script named run.sh with the following 3 lines:

LD_PRELOAD=/work/src/glibc-2.3.2-prefix/lib/ld-2.3.2.so
LD_LIBRARY_PATH=/work/src/glibc-2.3.2-prefix/lib
/work/src/glibc-2.3.2-prefix/lib/ld-linux.so.2 ./test_printf

when I type ./run.sh I get segmentation fault and a core dump.
with gdb backtracking I get the following:

bt
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x080483ad in __do_global_ctors_aux ()
#2 0x08048274 in _init ()
#3 0x0804833a in __libc_csu_init () at elf-init.c:60
#4 0x40019887 in __libc_start_main (main=0x80482a8
, argc=1,
ubp_av=0xbfffe068, init=0x8048330 <__libc_csu_init>,
fini=0x8048360 <__libc_csu_fini>, rtld_fini=0x80013020
<_rtld_local>,
stack_end=0x8048330) at ../sysdeps/generic/libc-start.c:139

Any idea ? what am I doing wrong here?
Is there any on-line guide which shows what should be done
in order to achieve my goal ?

I googled for it and the GLIBC faq did not help much
nor LinuxFromScratch chapter on glibc.

Regards,
John