1 --- glibc-2.3.6/sysdeps/sparc/sparc64/dl-machine.h.orig 2005-12-27 01:19:34.023832576 +0100
2 +++ glibc-2.3.6/sysdeps/sparc/sparc64/dl-machine.h 2005-12-27 01:19:26.440985344 +0100
4 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
10 #define ELF_MACHINE_NAME "sparc64"
19 -/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
20 - MAP is the object containing the reloc. */
23 -__attribute__ ((always_inline))
24 -elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
25 - const Elf64_Sym *sym, const struct r_found_version *version,
26 - void *const reloc_addr_arg)
28 - Elf64_Addr *const reloc_addr = reloc_addr_arg;
29 - const unsigned long int r_type = ELF64_R_TYPE_ID (reloc->r_info);
31 -#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
32 - if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
33 - *reloc_addr = map->l_addr + reloc->r_addend;
34 -# ifndef RTLD_BOOTSTRAP
35 - else if (r_type == R_SPARC_NONE) /* Who is Wilbur? */
41 -#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
42 - const Elf64_Sym *const refsym = sym;
45 -#ifndef RESOLVE_CONFLICT_FIND_MAP
46 - if (sym->st_shndx != SHN_UNDEF &&
47 - ELF64_ST_BIND (sym->st_info) == STB_LOCAL)
48 - value = map->l_addr;
51 - value = RESOLVE (&sym, version, r_type);
53 - value += sym->st_value;
58 - value += reloc->r_addend; /* Assume copy relocs have zero addend. */
62 -#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
65 - /* This can happen in trace mode if an object could not be
68 - if (sym->st_size > refsym->st_size
69 - || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
73 - strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
74 - _dl_error_printf ("\
75 -%s: Symbol `%s' has different size in shared object, consider re-linking\n",
76 - rtld_progname ?: "<program name unknown>",
77 - strtab + refsym->st_name);
79 - memcpy (reloc_addr_arg, (void *) value,
80 - MIN (sym->st_size, refsym->st_size));
84 - case R_SPARC_GLOB_DAT:
85 - *reloc_addr = value;
87 -#ifndef RTLD_BOOTSTRAP
89 - *(char *) reloc_addr = value;
92 - *(short *) reloc_addr = value;
95 - *(unsigned int *) reloc_addr = value;
98 - *(char *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
100 - case R_SPARC_DISP16:
101 - *(short *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
103 - case R_SPARC_DISP32:
104 - *(unsigned int *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
106 - case R_SPARC_WDISP30:
107 - *(unsigned int *) reloc_addr =
108 - ((*(unsigned int *)reloc_addr & 0xc0000000) |
109 - ((value - (Elf64_Addr) reloc_addr) >> 2));
112 - /* MEDLOW code model relocs */
114 - *(unsigned int *) reloc_addr =
115 - ((*(unsigned int *)reloc_addr & ~0x3ff) |
119 - *(unsigned int *) reloc_addr =
120 - ((*(unsigned int *)reloc_addr & 0xffc00000) |
123 - case R_SPARC_OLO10:
124 - *(unsigned int *) reloc_addr =
125 - ((*(unsigned int *)reloc_addr & ~0x1fff) |
126 - (((value & 0x3ff) + ELF64_R_TYPE_DATA (reloc->r_info)) & 0x1fff));
129 - /* MEDMID code model relocs */
131 - *(unsigned int *) reloc_addr =
132 - ((*(unsigned int *)reloc_addr & 0xffc00000) |
136 - *(unsigned int *) reloc_addr =
137 - ((*(unsigned int *)reloc_addr & ~0x3ff) |
138 - ((value >> 12) & 0x3ff));
141 - *(unsigned int *) reloc_addr =
142 - ((*(unsigned int *)reloc_addr & ~0xfff) |
146 - /* MEDANY code model relocs */
148 - *(unsigned int *) reloc_addr =
149 - ((*(unsigned int *)reloc_addr & 0xffc00000) |
153 - *(unsigned int *) reloc_addr =
154 - ((*(unsigned int *)reloc_addr & ~0x3ff) |
155 - ((value >> 32) & 0x3ff));
158 - *(unsigned int *) reloc_addr =
159 - ((*(unsigned int *)reloc_addr & 0xffc00000) |
160 - ((value >> 10) & 0x003fffff));
163 - case R_SPARC_JMP_SLOT:
164 -#ifdef RESOLVE_CONFLICT_FIND_MAP
165 - /* R_SPARC_JMP_SLOT conflicts against .plt[32768+]
166 - relocs should be turned into R_SPARC_64 relocs
167 - in .gnu.conflict section.
168 - r_addend non-zero does not mean it is a .plt[32768+]
169 - reloc, instead it is the actual address of the function
171 - sparc64_fixup_plt (NULL, reloc, reloc_addr, value, 0, 0);
173 - sparc64_fixup_plt (map, reloc, reloc_addr, value,
174 - reloc->r_addend, 0);
177 -#ifndef RTLD_BOOTSTRAP
179 - ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
180 - ((unsigned char *) reloc_addr_arg) [1] = value;
183 - ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
184 - ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
185 - ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
186 - ((unsigned char *) reloc_addr_arg) [3] = value;
189 - if (! ((long) reloc_addr_arg & 3))
191 - /* Common in .eh_frame */
192 - ((unsigned int *) reloc_addr_arg) [0] = value >> 32;
193 - ((unsigned int *) reloc_addr_arg) [1] = value;
196 - ((unsigned char *) reloc_addr_arg) [0] = value >> 56;
197 - ((unsigned char *) reloc_addr_arg) [1] = value >> 48;
198 - ((unsigned char *) reloc_addr_arg) [2] = value >> 40;
199 - ((unsigned char *) reloc_addr_arg) [3] = value >> 32;
200 - ((unsigned char *) reloc_addr_arg) [4] = value >> 24;
201 - ((unsigned char *) reloc_addr_arg) [5] = value >> 16;
202 - ((unsigned char *) reloc_addr_arg) [6] = value >> 8;
203 - ((unsigned char *) reloc_addr_arg) [7] = value;
206 -#if !defined RTLD_BOOTSTRAP || defined _NDEBUG
208 - _dl_reloc_bad_type (map, r_type, 0);
216 -__attribute__ ((always_inline))
217 -elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
218 - void *const reloc_addr_arg)
220 - Elf64_Addr *const reloc_addr = reloc_addr_arg;
221 - *reloc_addr = l_addr + reloc->r_addend;
225 -__attribute__ ((always_inline))
226 -elf_machine_lazy_rel (struct link_map *map,
227 - Elf64_Addr l_addr, const Elf64_Rela *reloc)
229 - switch (ELF64_R_TYPE (reloc->r_info))
233 - case R_SPARC_JMP_SLOT:
236 - _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1);
241 -#endif /* RESOLVE */
243 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
244 PLT entries should not be allowed to define the value.
245 ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
246 @@ -766,3 +543,231 @@
247 " add %sp, 6*8, %sp\n" \
248 " .size _dl_start_user, . - _dl_start_user\n" \
251 +#endif /* dl_machine_h */
255 +/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
256 + MAP is the object containing the reloc. */
259 +__attribute__ ((always_inline))
260 +elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
261 + const Elf64_Sym *sym, const struct r_found_version *version,
262 + void *const reloc_addr_arg)
264 + Elf64_Addr *const reloc_addr = reloc_addr_arg;
265 + const unsigned long int r_type = ELF64_R_TYPE_ID (reloc->r_info);
267 +#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
268 + if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
269 + *reloc_addr = map->l_addr + reloc->r_addend;
270 +# ifndef RTLD_BOOTSTRAP
271 + else if (r_type == R_SPARC_NONE) /* Who is Wilbur? */
277 +#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
278 + const Elf64_Sym *const refsym = sym;
281 +#ifndef RESOLVE_CONFLICT_FIND_MAP
282 + if (sym->st_shndx != SHN_UNDEF &&
283 + ELF64_ST_BIND (sym->st_info) == STB_LOCAL)
284 + value = map->l_addr;
287 + value = RESOLVE (&sym, version, r_type);
289 + value += sym->st_value;
294 + value += reloc->r_addend; /* Assume copy relocs have zero addend. */
298 +#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
301 + /* This can happen in trace mode if an object could not be
304 + if (sym->st_size > refsym->st_size
305 + || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
307 + const char *strtab;
309 + strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
310 + _dl_error_printf ("\
311 +%s: Symbol `%s' has different size in shared object, consider re-linking\n",
312 + rtld_progname ?: "<program name unknown>",
313 + strtab + refsym->st_name);
315 + memcpy (reloc_addr_arg, (void *) value,
316 + MIN (sym->st_size, refsym->st_size));
320 + case R_SPARC_GLOB_DAT:
321 + *reloc_addr = value;
323 +#ifndef RTLD_BOOTSTRAP
325 + *(char *) reloc_addr = value;
328 + *(short *) reloc_addr = value;
331 + *(unsigned int *) reloc_addr = value;
333 + case R_SPARC_DISP8:
334 + *(char *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
336 + case R_SPARC_DISP16:
337 + *(short *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
339 + case R_SPARC_DISP32:
340 + *(unsigned int *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
342 + case R_SPARC_WDISP30:
343 + *(unsigned int *) reloc_addr =
344 + ((*(unsigned int *)reloc_addr & 0xc0000000) |
345 + ((value - (Elf64_Addr) reloc_addr) >> 2));
348 + /* MEDLOW code model relocs */
350 + *(unsigned int *) reloc_addr =
351 + ((*(unsigned int *)reloc_addr & ~0x3ff) |
355 + *(unsigned int *) reloc_addr =
356 + ((*(unsigned int *)reloc_addr & 0xffc00000) |
359 + case R_SPARC_OLO10:
360 + *(unsigned int *) reloc_addr =
361 + ((*(unsigned int *)reloc_addr & ~0x1fff) |
362 + (((value & 0x3ff) + ELF64_R_TYPE_DATA (reloc->r_info)) & 0x1fff));
365 + /* MEDMID code model relocs */
367 + *(unsigned int *) reloc_addr =
368 + ((*(unsigned int *)reloc_addr & 0xffc00000) |
372 + *(unsigned int *) reloc_addr =
373 + ((*(unsigned int *)reloc_addr & ~0x3ff) |
374 + ((value >> 12) & 0x3ff));
377 + *(unsigned int *) reloc_addr =
378 + ((*(unsigned int *)reloc_addr & ~0xfff) |
382 + /* MEDANY code model relocs */
384 + *(unsigned int *) reloc_addr =
385 + ((*(unsigned int *)reloc_addr & 0xffc00000) |
389 + *(unsigned int *) reloc_addr =
390 + ((*(unsigned int *)reloc_addr & ~0x3ff) |
391 + ((value >> 32) & 0x3ff));
394 + *(unsigned int *) reloc_addr =
395 + ((*(unsigned int *)reloc_addr & 0xffc00000) |
396 + ((value >> 10) & 0x003fffff));
399 + case R_SPARC_JMP_SLOT:
400 +#ifdef RESOLVE_CONFLICT_FIND_MAP
401 + /* R_SPARC_JMP_SLOT conflicts against .plt[32768+]
402 + relocs should be turned into R_SPARC_64 relocs
403 + in .gnu.conflict section.
404 + r_addend non-zero does not mean it is a .plt[32768+]
405 + reloc, instead it is the actual address of the function
407 + sparc64_fixup_plt (NULL, reloc, reloc_addr, value, 0, 0);
409 + sparc64_fixup_plt (map, reloc, reloc_addr, value,
410 + reloc->r_addend, 0);
413 +#ifndef RTLD_BOOTSTRAP
415 + ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
416 + ((unsigned char *) reloc_addr_arg) [1] = value;
419 + ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
420 + ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
421 + ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
422 + ((unsigned char *) reloc_addr_arg) [3] = value;
425 + if (! ((long) reloc_addr_arg & 3))
427 + /* Common in .eh_frame */
428 + ((unsigned int *) reloc_addr_arg) [0] = value >> 32;
429 + ((unsigned int *) reloc_addr_arg) [1] = value;
432 + ((unsigned char *) reloc_addr_arg) [0] = value >> 56;
433 + ((unsigned char *) reloc_addr_arg) [1] = value >> 48;
434 + ((unsigned char *) reloc_addr_arg) [2] = value >> 40;
435 + ((unsigned char *) reloc_addr_arg) [3] = value >> 32;
436 + ((unsigned char *) reloc_addr_arg) [4] = value >> 24;
437 + ((unsigned char *) reloc_addr_arg) [5] = value >> 16;
438 + ((unsigned char *) reloc_addr_arg) [6] = value >> 8;
439 + ((unsigned char *) reloc_addr_arg) [7] = value;
442 +#if !defined RTLD_BOOTSTRAP || defined _NDEBUG
444 + _dl_reloc_bad_type (map, r_type, 0);
452 +__attribute__ ((always_inline))
453 +elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
454 + void *const reloc_addr_arg)
456 + Elf64_Addr *const reloc_addr = reloc_addr_arg;
457 + *reloc_addr = l_addr + reloc->r_addend;
461 +__attribute__ ((always_inline))
462 +elf_machine_lazy_rel (struct link_map *map,
463 + Elf64_Addr l_addr, const Elf64_Rela *reloc)
465 + switch (ELF64_R_TYPE (reloc->r_info))
469 + case R_SPARC_JMP_SLOT:
472 + _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1);
477 +#endif /* RESOLVE */