This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: undefined reference to `__libc_stack_end@GLIBC_PRIVATE - newbie

On Mon, 14 Mar 2005, John Que suggested tentatively:
> 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/ /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/ -lc
> /work/src/glibc-2.3.2-prefix/lib/ /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

You've forgotten `gcc --print-file-name=crtbegin.o` after crti.o: lots
of things will break without that (including failures like you see).

Explicitly linking with libdl looks odd, too; printf() shouldn't need that.

> I wrote a script named with the following 3 lines:
> LD_PRELOAD=/work/src/glibc-2.3.2-prefix/lib/

Why are you trying to preload the dynamic linker? That'll never do what
you expect: the dynamic linker's name is read from DT_INTERP in the
binary by the kernel. LD_PRELOAD is interpreted *by* the dynamic linker!

This is a black magic area and you can expect things to go wrong unless
you understand the convolutions that happen between glibc and GCC
involving constructor and destructor registration/invocation and so on
when a process starts and stops.

> ...Hires Root Beer...
What we need these days is a stable, fast, anti-aliased root beer
with dynamic shading. Not that you can let just anybody have root.
 --- John M. Ford

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]