[uClibc] ld.so on MIPS broken?

Martin Buck mb-tmp-uclibc at gromit.dyndns.org
Thu Feb 19 09:07:57 UTC 2004


Hi,

either I must be missing something obvious or uclibc's ld.so is completely
broken on MIPS. All my global variables end up at address 0 in dynamically
linked applications (static linking works fine).

host$ cat foo.c
#include <stdio.h>

int test_sbss;
int test_bss[100];
int test_data = 1;
const int test_rodata = 1;
static int test_static;

int
main(void) {
  printf("&test_sbss: %p\n", (void *)&test_sbss);
  printf("&test_bss: %p\n", (void *)&test_bss);
  printf("&test_data: %p\n", (void *)&test_data);
  printf("&test_rodata: %p\n", (void *)&test_rodata);
  printf("&test_static: %p\n", (void *)&test_static);
  return 0;
}

host$ mips-linux-gcc foo.c

target$ ./a.out
&test_sbss: (nil)
&test_bss: (nil)
&test_data: (nil)
&test_rodata: (nil)
&test_static: 0x100000a0

If I use glibc's ld.so instead with the same binary, it works fine:

target$ /lib/ld-2.3.2.so ./a.out 
&test_sbss: 0x10000080
&test_bss: 0x100000b0
&test_data: 0x10000010
&test_rodata: 0x400940
&test_static: 0x100000a0


uclibc is from yesterday's snapshot, so it already contains the recent
changes to the Makefile that changed -O0 to -Os. Toolchain is gcc 3.3.2
built using uclibc's toolchain builder.

Does anybody have any ideas? Is the current ld.so working for someone on
MIPS?

Thanks,
Martin




More information about the uClibc mailing list