yann@1: From http://www.ltc.com/~brad/mips/glibc-2.2.3-mips-base-addr-got.diff yann@1: yann@1: Hopefully fixes the error: yann@1: yann@1: /opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/lib/gcc-lib/mipsel-unknown-linux-gnu/3.2.3/../../../../mipsel-unknown-linux-gnu/bin/ld: target elf32-littlemips not found yann@1: collect2: ld returned 1 exit status yann@1: make[2]: *** [/home/dank/downloads/crosstool-0.24/build/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/build-glibc/elf/ld.so] Error 1 yann@1: yann@1: yann@1: diff -urNbB glibc-2.2.3/sysdeps/mips/dl-machine.h glibc-2.2.3-mips/sysdeps/mips/dl-machine.h yann@1: --- glibc-2.2.3/sysdeps/mips/dl-machine.h Mon Mar 26 23:53:28 2001 yann@1: +++ glibc-2.2.3-mips/sysdeps/mips/dl-machine.h Sun Aug 12 11:08:17 2001 yann@1: @@ -61,23 +61,6 @@ yann@1: in l_info array. */ yann@1: #define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM) yann@1: yann@1: -/* yann@1: - * MIPS libraries are usually linked to a non-zero base address. We yann@1: - * subtract the base address from the address where we map the object yann@1: - * to. This results in more efficient address space usage. yann@1: - * yann@1: - * FIXME: By the time when MAP_BASE_ADDR is called we don't have the yann@1: - * DYNAMIC section read. Until this is fixed make the assumption that yann@1: - * libraries have their base address at 0x5ffe0000. This needs to be yann@1: - * fixed before we can safely get rid of this MIPSism. yann@1: - */ yann@1: -#if 0 yann@1: -#define MAP_BASE_ADDR(l) ((l)->l_info[DT_MIPS(BASE_ADDRESS)] ? \ yann@1: - (l)->l_info[DT_MIPS(BASE_ADDRESS)]->d_un.d_ptr : 0) yann@1: -#else yann@1: -#define MAP_BASE_ADDR(l) 0x5ffe0000 yann@1: -#endif yann@1: - yann@1: /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in yann@1: with the run-time address of the r_debug structure */ yann@1: #define ELF_MACHINE_DEBUG_SETUP(l,r) \ yann@1: @@ -557,51 +540,30 @@ yann@1: /* Do nothing. */ yann@1: } yann@1: yann@1: +#ifndef RTLD_BOOTSTRAP yann@1: /* Relocate GOT. */ yann@1: static inline void yann@1: elf_machine_got_rel (struct link_map *map, int lazy) yann@1: { yann@1: ElfW(Addr) *got; yann@1: ElfW(Sym) *sym; yann@1: + const ElfW(Half) *vernum; yann@1: int i, n, symidx; yann@1: - /* This function is loaded in dl-reloc as a nested function and can yann@1: - therefore access the variables scope and strtab from yann@1: - _dl_relocate_object. */ yann@1: -#ifdef RTLD_BOOTSTRAP yann@1: -# define RESOLVE_GOTSYM(sym,sym_index) 0 yann@1: -#else yann@1: -# define RESOLVE_GOTSYM(sym,sym_index) \ yann@1: + yann@1: +#define RESOLVE_GOTSYM(sym,vernum,sym_index) \ yann@1: ({ \ yann@1: const ElfW(Sym) *ref = sym; \ yann@1: + const struct r_found_version *version \ yann@1: + = vernum ? &map->l_versions [vernum [sym_index]] : NULL; \ yann@1: ElfW(Addr) value; \ yann@1: - \ yann@1: - switch (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL) \ yann@1: - { \ yann@1: - default: \ yann@1: - { \ yann@1: - const ElfW(Half) *vernum = \ yann@1: - (const void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]); \ yann@1: - ElfW(Half) ndx = vernum[sym_index]; \ yann@1: - const struct r_found_version *version = &l->l_versions[ndx]; \ yann@1: - \ yann@1: - if (version->hash != 0) \ yann@1: - { \ yann@1: - value = _dl_lookup_versioned_symbol(strtab + sym->st_name,\ yann@1: - map, \ yann@1: - &ref, scope, version, \ yann@1: - R_MIPS_REL32, 0); \ yann@1: - break; \ yann@1: - } \ yann@1: - /* Fall through. */ \ yann@1: - } \ yann@1: - case 0: \ yann@1: - value = _dl_lookup_symbol (strtab + sym->st_name, map, &ref, \ yann@1: - scope, R_MIPS_REL32, 0); \ yann@1: - } \ yann@1: - \ yann@1: + value = RESOLVE (&ref, version, R_MIPS_REL32); \ yann@1: (ref)? value + ref->st_value: 0; \ yann@1: }) yann@1: -#endif /* RTLD_BOOTSTRAP */ yann@1: + yann@1: + if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL) yann@1: + vernum = (const void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]); yann@1: + else yann@1: + vernum = NULL; yann@1: yann@1: got = (ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]); yann@1: yann@1: @@ -639,10 +601,10 @@ yann@1: && sym->st_value && lazy) yann@1: *got = sym->st_value + map->l_addr; yann@1: else yann@1: - *got = RESOLVE_GOTSYM (sym, symidx); yann@1: + *got = RESOLVE_GOTSYM (sym, vernum, symidx); yann@1: } yann@1: else if (sym->st_shndx == SHN_COMMON) yann@1: - *got = RESOLVE_GOTSYM (sym, symidx); yann@1: + *got = RESOLVE_GOTSYM (sym, vernum, symidx); yann@1: else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC yann@1: && *got != sym->st_value yann@1: && lazy) yann@1: @@ -653,7 +615,7 @@ yann@1: *got += map->l_addr; yann@1: } yann@1: else yann@1: - *got = RESOLVE_GOTSYM (sym, symidx); yann@1: + *got = RESOLVE_GOTSYM (sym, vernum, symidx); yann@1: yann@1: ++got; yann@1: ++sym; yann@1: @@ -661,9 +623,8 @@ yann@1: } yann@1: yann@1: #undef RESOLVE_GOTSYM yann@1: - yann@1: - return; yann@1: } yann@1: +#endif yann@1: yann@1: /* Set up the loaded object described by L so its stub function yann@1: will jump to the on-demand fixup code __dl_runtime_resolve. */ yann@1: diff -urNbB glibc-2.2.3/sysdeps/mips/mips64/rtld-parms glibc-2.2.3-mips/sysdeps/mips/mips64/rtld-parms yann@1: --- glibc-2.2.3/sysdeps/mips/mips64/rtld-parms Sat Jul 12 18:26:11 1997 yann@1: +++ glibc-2.2.3-mips/sysdeps/mips/mips64/rtld-parms Wed Dec 31 19:00:00 1969 yann@1: @@ -1,3 +0,0 @@ yann@1: -ifndef rtld-wordsize yann@1: -rtld-wordsize = 64 yann@1: -endif yann@1: diff -urNbB glibc-2.2.3/sysdeps/mips/mipsel/rtld-parms glibc-2.2.3-mips/sysdeps/mips/mipsel/rtld-parms yann@1: --- glibc-2.2.3/sysdeps/mips/mipsel/rtld-parms Sat Jul 12 18:26:15 1997 yann@1: +++ glibc-2.2.3-mips/sysdeps/mips/mipsel/rtld-parms Wed Dec 31 19:00:00 1969 yann@1: @@ -1,3 +0,0 @@ yann@1: -ifndef rtld-oformat yann@1: -rtld-oformat = elf32-littlemips yann@1: -endif yann@1: diff -urNbB glibc-2.2.3/sysdeps/mips/rtld-ldscript.in glibc-2.2.3-mips/sysdeps/mips/rtld-ldscript.in yann@1: --- glibc-2.2.3/sysdeps/mips/rtld-ldscript.in Sat Jul 12 18:23:14 1997 yann@1: +++ glibc-2.2.3-mips/sysdeps/mips/rtld-ldscript.in Wed Dec 31 19:00:00 1969 yann@1: @@ -1,106 +0,0 @@ yann@1: -OUTPUT_FORMAT("@@rtld-oformat@@") yann@1: -OUTPUT_ARCH(@@rtld-arch@@) yann@1: -ENTRY(@@rtld-entry@@) yann@1: -SECTIONS yann@1: -{ yann@1: - /* Read-only sections, merged into text segment: */ yann@1: - . = @@rtld-base@@; yann@1: - .reginfo : { *(.reginfo) } yann@1: - .dynamic : { *(.dynamic) } yann@1: - .dynstr : { *(.dynstr) } yann@1: - .dynsym : { *(.dynsym) } yann@1: - .hash : { *(.hash) } yann@1: - .rel.text : { *(.rel.text) } yann@1: - .rela.text : { *(.rela.text) } yann@1: - .rel.data : { *(.rel.data) } yann@1: - .rela.data : { *(.rela.data) } yann@1: - .rel.rodata : { *(.rel.rodata) } yann@1: - .rela.rodata : { *(.rela.rodata) } yann@1: - .rel.got : { *(.rel.got) } yann@1: - .rela.got : { *(.rela.got) } yann@1: - .rel.ctors : { *(.rel.ctors) } yann@1: - .rela.ctors : { *(.rela.ctors) } yann@1: - .rel.dtors : { *(.rel.dtors) } yann@1: - .rela.dtors : { *(.rela.dtors) } yann@1: - .rel.init : { *(.rel.init) } yann@1: - .rela.init : { *(.rela.init) } yann@1: - .rel.fini : { *(.rel.fini) } yann@1: - .rela.fini : { *(.rela.fini) } yann@1: - .rel.bss : { *(.rel.bss) } yann@1: - .rela.bss : { *(.rela.bss) } yann@1: - .rel.plt : { *(.rel.plt) } yann@1: - .rela.plt : { *(.rela.plt) } yann@1: - .rodata : { *(.rodata) } yann@1: - .rodata1 : { *(.rodata1) } yann@1: - .init : { *(.init) } =0 yann@1: - .text : yann@1: - { yann@1: - *(.text) yann@1: - *(.stub) yann@1: - /* .gnu.warning sections are handled specially by elf32.em. */ yann@1: - *(.gnu.warning) yann@1: - } =0 yann@1: - .fini : { *(.fini) } =0 yann@1: - /* Adjust the address for the data segment. We want to adjust up to yann@1: - the same address within the page on the next page up. It would yann@1: - be more correct to do this: yann@1: - . = 0x10000000; yann@1: - The current expression does not correctly handle the case of a yann@1: - text segment ending precisely at the end of a page; it causes the yann@1: - data segment to skip a page. The above expression does not have yann@1: - this problem, but it will currently (2/95) cause BFD to allocate yann@1: - a single segment, combining both text and data, for this case. yann@1: - This will prevent the text segment from being shared among yann@1: - multiple executions of the program; I think that is more yann@1: - important than losing a page of the virtual address space (note yann@1: - that no actual memory is lost; the page which is skipped can not yann@1: - be referenced). */ yann@1: - . += 0x10000; yann@1: - .data : yann@1: - { yann@1: - *(.data) yann@1: - CONSTRUCTORS yann@1: - } yann@1: - .data1 : { *(.data1) } yann@1: - .ctors : { *(.ctors) } yann@1: - .dtors : { *(.dtors) } yann@1: - _gp = ALIGN(16) + 0x7ff0; yann@1: - .got : yann@1: - { yann@1: - *(.got.plt) *(.got) yann@1: - } yann@1: - /* We want the small data sections together, so single-instruction offsets yann@1: - can access them all, and initialized data all before uninitialized, so yann@1: - we can shorten the on-disk segment size. */ yann@1: - .sdata : { *(.sdata) } yann@1: - .lit8 : { *(.lit8) } yann@1: - .lit4 : { *(.lit4) } yann@1: - .sbss : { *(.sbss) *(.scommon) } yann@1: - .bss : yann@1: - { yann@1: - *(.dynbss) yann@1: - *(.bss) yann@1: - *(COMMON) yann@1: - } yann@1: - /* The normal linker scripts created by the binutils doesn't have the yann@1: - symbols end and _end which breaks ld.so's dl-minimal.c. */ yann@1: - _end = . ; yann@1: - PROVIDE (end = .); yann@1: - /* These are needed for ELF backends which have not yet been yann@1: - converted to the new style linker. */ yann@1: - .stab 0 : { *(.stab) } yann@1: - .stabstr 0 : { *(.stabstr) } yann@1: - /* DWARF debug sections. yann@1: - Symbols in the .debug DWARF section are relative to the beginning of the yann@1: - section so we begin .debug at 0. It's not clear yet what needs to happen yann@1: - for the others. */ yann@1: - .debug 0 : { *(.debug) } yann@1: - .debug_srcinfo 0 : { *(.debug_srcinfo) } yann@1: - .debug_aranges 0 : { *(.debug_aranges) } yann@1: - .debug_pubnames 0 : { *(.debug_pubnames) } yann@1: - .debug_sfnames 0 : { *(.debug_sfnames) } yann@1: - .line 0 : { *(.line) } yann@1: - /* These must appear regardless of . */ yann@1: - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } yann@1: - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } yann@1: -} yann@1: diff -urNbB glibc-2.2.3/sysdeps/mips/rtld-parms glibc-2.2.3-mips/sysdeps/mips/rtld-parms yann@1: --- glibc-2.2.3/sysdeps/mips/rtld-parms Mon Jul 21 19:04:07 1997 yann@1: +++ glibc-2.2.3-mips/sysdeps/mips/rtld-parms Wed Dec 31 19:00:00 1969 yann@1: @@ -1,15 +0,0 @@ yann@1: -ifndef rtld-wordsize yann@1: -rtld-wordsize = 32 yann@1: -endif yann@1: -ifndef rtld-oformat yann@1: -rtld-oformat = elf$(rtld-wordsize)-bigmips yann@1: -endif yann@1: -ifndef rtld-arch yann@1: -rtld-arch = mips yann@1: -endif yann@1: -ifndef rtld-entry yann@1: -rtld-entry = __start yann@1: -endif yann@1: -ifndef rtld-base yann@1: -rtld-base = 0x0fb60000 + SIZEOF_HEADERS yann@1: -endif