[uClibc]Disabling dynamic-linker.

Alicia da Conceicao alicia at engine.ca
Thu May 2 18:00:14 UTC 2002


Help:

I am using uClibc version 0.9.11 with uClinux (arm-elf) version
2.4.6.  Unlike previous uClibc releases, I can only link 0.9.11
with the nostdlib and dynamic linker options; previous releases
did not require this.  :-(  For example, to compile a simple
"Hello World" program I use:

> arm-elf-gcc -nostdlib -Wl,--dynamic-linker /opt/uClibc/arm-elf/lib/crt0.o -Wl,-elf2flt -o hello hello.c -lgcc -lc

All of the above gcc options are required to compile, if any are
removed. then the program won't build.

Previously all I needed to compile the same program was:

> arm-elf-gcc -Wl,-elf2flt -o hello hello.c

The link (ld) option "-elf2flt" that converts elf binaries into
smaller flat binaries has always been required.

If I attempt to run the above arm-elf-gcc command without the
nostdlib and dynamic linker options, using uClibc 0.9.11, I get
the following error message:

/opt/uClibc/arm-elf/lib/libc.a(__uClibc_main.o): In function `__uClibc_main':
__uClibc_main.o(.text+0xbc): undefined reference to `_fini'
__uClibc_main.o(.text+0xc4): undefined reference to `_init'
collect2: ld returned 1 exit status

The "_fini" & "_init" functions are defined as assembler macros
in:

/opt/uClibc/src/uClibc-0.9.11/libc/sysdeps/linux/common/initfini.c

and are specified by the weak aliases in:

/opt/uClibc/src/uClibc-0.9.11/libc/misc/internals/__uClibc_main.c

Any suggestions on how I can get uClibc 0.9.11 to all programs
to link and compile without the nostdlib and dynamic options, as I
was able to do with previous uClibc releases?  These link options
cause other problems with the binaries, in particular, compiled
programs are able to run successfully, but SEGFAULT on exit.

Thanks in advance.

Sincerely,
Alicia.




More information about the uClibc mailing list