Make checking the linux installed headers optional (instead of systematic).
1 From http://www.ltc.com/~brad/mips/glibc-2.2.3-mips-base-addr-got.diff
3 Hopefully fixes the error:
5 /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
6 collect2: ld returned 1 exit status
7 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
10 diff -urNbB glibc-2.2.3/sysdeps/mips/dl-machine.h glibc-2.2.3-mips/sysdeps/mips/dl-machine.h
11 --- glibc-2.2.3/sysdeps/mips/dl-machine.h Mon Mar 26 23:53:28 2001
12 +++ glibc-2.2.3-mips/sysdeps/mips/dl-machine.h Sun Aug 12 11:08:17 2001
15 #define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM)
18 - * MIPS libraries are usually linked to a non-zero base address. We
19 - * subtract the base address from the address where we map the object
20 - * to. This results in more efficient address space usage.
22 - * FIXME: By the time when MAP_BASE_ADDR is called we don't have the
23 - * DYNAMIC section read. Until this is fixed make the assumption that
24 - * libraries have their base address at 0x5ffe0000. This needs to be
25 - * fixed before we can safely get rid of this MIPSism.
28 -#define MAP_BASE_ADDR(l) ((l)->l_info[DT_MIPS(BASE_ADDRESS)] ? \
29 - (l)->l_info[DT_MIPS(BASE_ADDRESS)]->d_un.d_ptr : 0)
31 -#define MAP_BASE_ADDR(l) 0x5ffe0000
34 /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
35 with the run-time address of the r_debug structure */
36 #define ELF_MACHINE_DEBUG_SETUP(l,r) \
41 +#ifndef RTLD_BOOTSTRAP
44 elf_machine_got_rel (struct link_map *map, int lazy)
48 + const ElfW(Half) *vernum;
50 - /* This function is loaded in dl-reloc as a nested function and can
51 - therefore access the variables scope and strtab from
52 - _dl_relocate_object. */
53 -#ifdef RTLD_BOOTSTRAP
54 -# define RESOLVE_GOTSYM(sym,sym_index) 0
56 -# define RESOLVE_GOTSYM(sym,sym_index) \
58 +#define RESOLVE_GOTSYM(sym,vernum,sym_index) \
60 const ElfW(Sym) *ref = sym; \
61 + const struct r_found_version *version \
62 + = vernum ? &map->l_versions [vernum [sym_index]] : NULL; \
65 - switch (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL) \
69 - const ElfW(Half) *vernum = \
70 - (const void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]); \
71 - ElfW(Half) ndx = vernum[sym_index]; \
72 - const struct r_found_version *version = &l->l_versions[ndx]; \
74 - if (version->hash != 0) \
76 - value = _dl_lookup_versioned_symbol(strtab + sym->st_name,\
78 - &ref, scope, version, \
82 - /* Fall through. */ \
85 - value = _dl_lookup_symbol (strtab + sym->st_name, map, &ref, \
86 - scope, R_MIPS_REL32, 0); \
89 + value = RESOLVE (&ref, version, R_MIPS_REL32); \
90 (ref)? value + ref->st_value: 0; \
92 -#endif /* RTLD_BOOTSTRAP */
94 + if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
95 + vernum = (const void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
99 got = (ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]);
101 @@ -639,10 +601,10 @@
102 && sym->st_value && lazy)
103 *got = sym->st_value + map->l_addr;
105 - *got = RESOLVE_GOTSYM (sym, symidx);
106 + *got = RESOLVE_GOTSYM (sym, vernum, symidx);
108 else if (sym->st_shndx == SHN_COMMON)
109 - *got = RESOLVE_GOTSYM (sym, symidx);
110 + *got = RESOLVE_GOTSYM (sym, vernum, symidx);
111 else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
112 && *got != sym->st_value
118 - *got = RESOLVE_GOTSYM (sym, symidx);
119 + *got = RESOLVE_GOTSYM (sym, vernum, symidx);
126 #undef RESOLVE_GOTSYM
132 /* Set up the loaded object described by L so its stub function
133 will jump to the on-demand fixup code __dl_runtime_resolve. */
134 diff -urNbB glibc-2.2.3/sysdeps/mips/mips64/rtld-parms glibc-2.2.3-mips/sysdeps/mips/mips64/rtld-parms
135 --- glibc-2.2.3/sysdeps/mips/mips64/rtld-parms Sat Jul 12 18:26:11 1997
136 +++ glibc-2.2.3-mips/sysdeps/mips/mips64/rtld-parms Wed Dec 31 19:00:00 1969
138 -ifndef rtld-wordsize
141 diff -urNbB glibc-2.2.3/sysdeps/mips/mipsel/rtld-parms glibc-2.2.3-mips/sysdeps/mips/mipsel/rtld-parms
142 --- glibc-2.2.3/sysdeps/mips/mipsel/rtld-parms Sat Jul 12 18:26:15 1997
143 +++ glibc-2.2.3-mips/sysdeps/mips/mipsel/rtld-parms Wed Dec 31 19:00:00 1969
146 -rtld-oformat = elf32-littlemips
148 diff -urNbB glibc-2.2.3/sysdeps/mips/rtld-ldscript.in glibc-2.2.3-mips/sysdeps/mips/rtld-ldscript.in
149 --- glibc-2.2.3/sysdeps/mips/rtld-ldscript.in Sat Jul 12 18:23:14 1997
150 +++ glibc-2.2.3-mips/sysdeps/mips/rtld-ldscript.in Wed Dec 31 19:00:00 1969
152 -OUTPUT_FORMAT("@@rtld-oformat@@")
153 -OUTPUT_ARCH(@@rtld-arch@@)
154 -ENTRY(@@rtld-entry@@)
157 - /* Read-only sections, merged into text segment: */
159 - .reginfo : { *(.reginfo) }
160 - .dynamic : { *(.dynamic) }
161 - .dynstr : { *(.dynstr) }
162 - .dynsym : { *(.dynsym) }
163 - .hash : { *(.hash) }
164 - .rel.text : { *(.rel.text) }
165 - .rela.text : { *(.rela.text) }
166 - .rel.data : { *(.rel.data) }
167 - .rela.data : { *(.rela.data) }
168 - .rel.rodata : { *(.rel.rodata) }
169 - .rela.rodata : { *(.rela.rodata) }
170 - .rel.got : { *(.rel.got) }
171 - .rela.got : { *(.rela.got) }
172 - .rel.ctors : { *(.rel.ctors) }
173 - .rela.ctors : { *(.rela.ctors) }
174 - .rel.dtors : { *(.rel.dtors) }
175 - .rela.dtors : { *(.rela.dtors) }
176 - .rel.init : { *(.rel.init) }
177 - .rela.init : { *(.rela.init) }
178 - .rel.fini : { *(.rel.fini) }
179 - .rela.fini : { *(.rela.fini) }
180 - .rel.bss : { *(.rel.bss) }
181 - .rela.bss : { *(.rela.bss) }
182 - .rel.plt : { *(.rel.plt) }
183 - .rela.plt : { *(.rela.plt) }
184 - .rodata : { *(.rodata) }
185 - .rodata1 : { *(.rodata1) }
186 - .init : { *(.init) } =0
191 - /* .gnu.warning sections are handled specially by elf32.em. */
194 - .fini : { *(.fini) } =0
195 - /* Adjust the address for the data segment. We want to adjust up to
196 - the same address within the page on the next page up. It would
197 - be more correct to do this:
199 - The current expression does not correctly handle the case of a
200 - text segment ending precisely at the end of a page; it causes the
201 - data segment to skip a page. The above expression does not have
202 - this problem, but it will currently (2/95) cause BFD to allocate
203 - a single segment, combining both text and data, for this case.
204 - This will prevent the text segment from being shared among
205 - multiple executions of the program; I think that is more
206 - important than losing a page of the virtual address space (note
207 - that no actual memory is lost; the page which is skipped can not
215 - .data1 : { *(.data1) }
216 - .ctors : { *(.ctors) }
217 - .dtors : { *(.dtors) }
218 - _gp = ALIGN(16) + 0x7ff0;
221 - *(.got.plt) *(.got)
223 - /* We want the small data sections together, so single-instruction offsets
224 - can access them all, and initialized data all before uninitialized, so
225 - we can shorten the on-disk segment size. */
226 - .sdata : { *(.sdata) }
227 - .lit8 : { *(.lit8) }
228 - .lit4 : { *(.lit4) }
229 - .sbss : { *(.sbss) *(.scommon) }
236 - /* The normal linker scripts created by the binutils doesn't have the
237 - symbols end and _end which breaks ld.so's dl-minimal.c. */
240 - /* These are needed for ELF backends which have not yet been
241 - converted to the new style linker. */
242 - .stab 0 : { *(.stab) }
243 - .stabstr 0 : { *(.stabstr) }
244 - /* DWARF debug sections.
245 - Symbols in the .debug DWARF section are relative to the beginning of the
246 - section so we begin .debug at 0. It's not clear yet what needs to happen
248 - .debug 0 : { *(.debug) }
249 - .debug_srcinfo 0 : { *(.debug_srcinfo) }
250 - .debug_aranges 0 : { *(.debug_aranges) }
251 - .debug_pubnames 0 : { *(.debug_pubnames) }
252 - .debug_sfnames 0 : { *(.debug_sfnames) }
253 - .line 0 : { *(.line) }
254 - /* These must appear regardless of . */
255 - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
256 - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
258 diff -urNbB glibc-2.2.3/sysdeps/mips/rtld-parms glibc-2.2.3-mips/sysdeps/mips/rtld-parms
259 --- glibc-2.2.3/sysdeps/mips/rtld-parms Mon Jul 21 19:04:07 1997
260 +++ glibc-2.2.3-mips/sysdeps/mips/rtld-parms Wed Dec 31 19:00:00 1969
262 -ifndef rtld-wordsize
266 -rtld-oformat = elf$(rtld-wordsize)-bigmips
272 -rtld-entry = __start
275 -rtld-base = 0x0fb60000 + SIZEOF_HEADERS