(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / sparc / sparc32 / dl-machine.h
blob52fc6329ddcac48d374dbb2dc97049f3c03d35d6
1 /* Machine-dependent ELF dynamic relocation inline functions. SPARC version.
2 Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef dl_machine_h
21 #define dl_machine_h
23 #define ELF_MACHINE_NAME "sparc"
25 #include <string.h>
26 #include <sys/param.h>
27 #include <ldsodefs.h>
28 #include <tls.h>
30 #ifndef VALIDX
31 # define VALIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
32 + DT_EXTRANUM + DT_VALTAGIDX (tag))
33 #endif
35 /* Some SPARC opcodes we need to use for self-modifying code. */
36 #define OPCODE_NOP 0x01000000 /* nop */
37 #define OPCODE_CALL 0x40000000 /* call ?; add PC-rel word address */
38 #define OPCODE_SETHI_G1 0x03000000 /* sethi ?, %g1; add value>>10 */
39 #define OPCODE_JMP_G1 0x81c06000 /* jmp %g1+?; add lo 10 bits of value */
40 #define OPCODE_SAVE_SP 0x9de3bfa8 /* save %sp, -(16+6)*4, %sp */
41 #define OPCODE_BA 0x30800000 /* b,a ?; add PC-rel word address */
43 /* Use a different preload file when running in 32-bit emulation mode
44 on a 64-bit host. */
45 #define LD_SO_PRELOAD ((GLRO(dl_hwcap) & HWCAP_SPARC_V9) \
46 ? "/etc/ld.so.preload32" \
47 : "/etc/ld.so.preload")
50 /* Return nonzero iff ELF header is compatible with the running host. */
51 static inline int
52 elf_machine_matches_host (const Elf32_Ehdr *ehdr)
54 if (ehdr->e_machine == EM_SPARC)
55 return 1;
56 else if (ehdr->e_machine == EM_SPARC32PLUS)
58 /* XXX The following is wrong! Dave Miller rejected to implement it
59 correctly. If this causes problems shoot *him*! */
60 #ifdef SHARED
61 return GLRO(dl_hwcap) & GLRO(dl_hwcap_mask) & HWCAP_SPARC_V9;
62 #else
63 return GLRO(dl_hwcap) & HWCAP_SPARC_V9;
64 #endif
66 else
67 return 0;
70 /* We have to do this because elf_machine_{dynamic,load_address} can be
71 invoked from functions that have no GOT references, and thus the compiler
72 has no obligation to load the PIC register. */
73 #define LOAD_PIC_REG(PIC_REG) \
74 do { register Elf32_Addr pc __asm("o7"); \
75 __asm("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t" \
76 "call 1f\n\t" \
77 "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n" \
78 "1:\tadd %1, %0, %1" \
79 : "=r" (pc), "=r" (PIC_REG)); \
80 } while (0)
82 /* Return the link-time address of _DYNAMIC. Conveniently, this is the
83 first element of the GOT. This must be inlined in a function which
84 uses global data. */
85 static inline Elf32_Addr
86 elf_machine_dynamic (void)
88 register Elf32_Addr *got asm ("%l7");
90 LOAD_PIC_REG (got);
92 return *got;
95 /* Return the run-time load address of the shared object. */
96 static inline Elf32_Addr
97 elf_machine_load_address (void)
99 register Elf32_Addr *pc __asm ("%o7"), *got __asm ("%l7");
101 __asm ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t"
102 "call 1f\n\t"
103 " add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t"
104 "call _DYNAMIC\n\t"
105 "call _GLOBAL_OFFSET_TABLE_\n"
106 "1:\tadd %1, %0, %1\n\t" : "=r" (pc), "=r" (got));
108 /* got is now l_addr + _GLOBAL_OFFSET_TABLE_
109 *got is _DYNAMIC
110 pc[2]*4 is l_addr + _DYNAMIC - (long)pc - 8
111 pc[3]*4 is l_addr + _GLOBAL_OFFSET_TABLE_ - (long)pc - 12 */
112 return (Elf32_Addr) got - *got + (pc[2] - pc[3]) * 4 - 4;
115 /* Set up the loaded object described by L so its unrelocated PLT
116 entries will jump to the on-demand fixup code in dl-runtime.c. */
118 static inline int
119 elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
121 Elf32_Addr *plt;
122 extern void _dl_runtime_resolve (Elf32_Word);
123 extern void _dl_runtime_profile (Elf32_Word);
125 if (l->l_info[DT_JMPREL] && lazy)
127 Elf32_Addr rfunc;
129 /* The entries for functions in the PLT have not yet been filled in.
130 Their initial contents will arrange when called to set the high 22
131 bits of %g1 with an offset into the .rela.plt section and jump to
132 the beginning of the PLT. */
133 plt = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
134 if (! profile)
135 rfunc = (Elf32_Addr) &_dl_runtime_resolve;
136 else
138 rfunc = (Elf32_Addr) &_dl_runtime_profile;
140 if (_dl_name_match_p (GLRO(dl_profile), l))
141 GL(dl_profile_map) = l;
144 /* The beginning of the PLT does:
146 save %sp, -64, %sp
147 pltpc: call _dl_runtime_resolve
149 .word MAP
151 This saves the register window containing the arguments, and the
152 PC value (pltpc) implicitly saved in %o7 by the call points near the
153 location where we store the link_map pointer for this object. */
155 plt[0] = OPCODE_SAVE_SP;
156 /* Construct PC-relative word address. */
157 plt[1] = OPCODE_CALL | ((rfunc - (Elf32_Addr) &plt[1]) >> 2);
158 plt[2] = OPCODE_NOP; /* Fill call delay slot. */
159 plt[3] = (Elf32_Addr) l;
160 if (__builtin_expect (l->l_info[VALIDX(DT_GNU_PRELINKED)] != NULL, 0)
161 || __builtin_expect (l->l_info [VALIDX (DT_GNU_LIBLISTSZ)] != NULL, 0))
163 /* Need to reinitialize .plt to undo prelinking. */
164 int do_flush;
165 Elf32_Rela *rela = (Elf32_Rela *) D_PTR (l, l_info[DT_JMPREL]);
166 Elf32_Rela *relaend
167 = (Elf32_Rela *) ((char *) rela
168 + l->l_info[DT_PLTRELSZ]->d_un.d_val);
169 do_flush = GLRO(dl_hwcap) & HWCAP_SPARC_FLUSH;
171 /* prelink must ensure there are no R_SPARC_NONE relocs left
172 in .rela.plt. */
173 while (rela < relaend)
175 *(unsigned int *) rela->r_offset
176 = OPCODE_SETHI_G1 | (rela->r_offset - (Elf32_Addr) plt);
177 *(unsigned int *) (rela->r_offset + 4)
178 = OPCODE_BA | ((((Elf32_Addr) plt
179 - rela->r_offset - 4) >> 2) & 0x3fffff);
180 if (do_flush)
182 __asm __volatile ("flush %0" : : "r"(rela->r_offset));
183 __asm __volatile ("flush %0+4" : : "r"(rela->r_offset));
185 ++rela;
190 return lazy;
193 /* This code is used in dl-runtime.c to call the `fixup' function
194 and then redirect to the address it returns. */
195 #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
196 asm ( "\
197 .text\n\
198 .globl " #tramp_name "\n\
199 .type " #tramp_name ", @function\n\
200 .align 32\n\
201 " #tramp_name ":\n\
202 /* Set up the arguments to fixup --\n\
203 %o0 = link_map out of plt0\n\
204 %o1 = offset of reloc entry\n\
205 %o2 = return address */\n\
206 ld [%o7 + 8], %o0\n\
207 srl %g1, 10, %o1\n\
208 mov %i7, %o2\n\
209 call " #fixup_name "\n\
210 sub %o1, 4*12, %o1\n\
211 jmp %o0\n\
212 restore\n\
213 .size " #tramp_name ", . - " #tramp_name "\n\
214 .previous")
216 #ifndef PROF
217 #define ELF_MACHINE_RUNTIME_TRAMPOLINE \
218 TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup); \
219 TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
220 #else
221 #define ELF_MACHINE_RUNTIME_TRAMPOLINE \
222 TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup); \
223 TRAMPOLINE_TEMPLATE (_dl_runtime_profile, fixup);
224 #endif
226 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
227 PLT entries should not be allowed to define the value.
228 ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
229 of the main executable's symbols, as for a COPY reloc. */
230 #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
231 # define elf_machine_type_class(type) \
232 ((((type) == R_SPARC_JMP_SLOT \
233 || ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64)) \
234 * ELF_RTYPE_CLASS_PLT) \
235 | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
236 #else
237 # define elf_machine_type_class(type) \
238 ((((type) == R_SPARC_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
239 | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
240 #endif
242 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
243 #define ELF_MACHINE_JMP_SLOT R_SPARC_JMP_SLOT
245 /* The SPARC never uses Elf32_Rel relocations. */
246 #define ELF_MACHINE_NO_REL 1
248 /* The SPARC overlaps DT_RELA and DT_PLTREL. */
249 #define ELF_MACHINE_PLTREL_OVERLAP 1
251 /* Undo the sub %sp, 6*4, %sp; add %sp, 22*4, %o0 below to get at the
252 value we want in __libc_stack_end. */
253 #define DL_STACK_END(cookie) \
254 ((void *) (((long) (cookie)) - (22 - 6) * 4))
256 /* Initial entry point code for the dynamic linker.
257 The C function `_dl_start' is the real entry point;
258 its return value is the user program's entry point. */
260 #define RTLD_START __asm__ ("\
261 .text\n\
262 .globl _start\n\
263 .type _start, @function\n\
264 .align 32\n\
265 _start:\n\
266 /* Allocate space for functions to drop their arguments. */\n\
267 sub %sp, 6*4, %sp\n\
268 /* Pass pointer to argument block to _dl_start. */\n\
269 call _dl_start\n\
270 add %sp, 22*4, %o0\n\
271 /* FALTHRU */\n\
272 .globl _dl_start_user\n\
273 .type _dl_start_user, @function\n\
274 _dl_start_user:\n\
275 /* Load the PIC register. */\n\
276 1: call 2f\n\
277 sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n\
278 2: or %l7, %lo(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7\n\
279 add %l7, %o7, %l7\n\
280 /* Save the user entry point address in %l0 */\n\
281 mov %o0, %l0\n\
282 /* See if we were run as a command with the executable file name as an\n\
283 extra leading argument. If so, adjust the contents of the stack. */\n\
284 sethi %hi(_dl_skip_args), %g2\n\
285 or %g2, %lo(_dl_skip_args), %g2\n\
286 ld [%l7+%g2], %i0\n\
287 ld [%i0], %i0\n\
288 tst %i0\n\
289 beq 3f\n\
290 ld [%sp+22*4], %i5 /* load argc */\n\
291 /* Find out how far to shift. */\n\
292 sethi %hi(_dl_argv), %l3\n\
293 or %l3, %lo(_dl_argv), %l3\n\
294 ld [%l7+%l3], %l3\n\
295 sub %i5, %i0, %i5\n\
296 ld [%l3], %l4\n\
297 sll %i0, 2, %i2\n\
298 st %i5, [%sp+22*4]\n\
299 sub %l4, %i2, %l4\n\
300 add %sp, 23*4, %i1\n\
301 add %i1, %i2, %i2\n\
302 st %l4, [%l3]\n\
303 /* Copy down argv */\n\
304 21: ld [%i2], %i3\n\
305 add %i2, 4, %i2\n\
306 tst %i3\n\
307 st %i3, [%i1]\n\
308 bne 21b\n\
309 add %i1, 4, %i1\n\
310 /* Copy down env */\n\
311 22: ld [%i2], %i3\n\
312 add %i2, 4, %i2\n\
313 tst %i3\n\
314 st %i3, [%i1]\n\
315 bne 22b\n\
316 add %i1, 4, %i1\n\
317 /* Copy down auxiliary table. */\n\
318 23: ld [%i2], %i3\n\
319 ld [%i2+4], %i4\n\
320 add %i2, 8, %i2\n\
321 tst %i3\n\
322 st %i3, [%i1]\n\
323 st %i4, [%i1+4]\n\
324 bne 23b\n\
325 add %i1, 8, %i1\n\
326 /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp. */\n\
327 3: sethi %hi(_rtld_local), %o0\n\
328 add %sp, 23*4, %o2\n\
329 orcc %o0, %lo(_rtld_local), %o0\n\
330 sll %i5, 2, %o3\n\
331 ld [%l7+%o0], %o0\n\
332 add %o3, 4, %o3\n\
333 mov %i5, %o1\n\
334 add %o2, %o3, %o3\n\
335 call _dl_init_internal\n\
336 ld [%o0], %o0\n\
337 /* Pass our finalizer function to the user in %g1. */\n\
338 sethi %hi(_dl_fini), %g1\n\
339 or %g1, %lo(_dl_fini), %g1\n\
340 ld [%l7+%g1], %g1\n\
341 /* Jump to the user's entry point and deallocate the extra stack we got. */\n\
342 jmp %l0\n\
343 add %sp, 6*4, %sp\n\
344 .size _dl_start_user, . - _dl_start_user\n\
345 .previous");
347 static inline Elf32_Addr
348 sparc_fixup_plt (const Elf32_Rela *reloc, Elf32_Addr *reloc_addr,
349 Elf32_Addr value, int t)
351 Elf32_Sword disp = value - (Elf32_Addr) reloc_addr;
352 #ifndef RTLD_BOOTSTRAP
353 /* Note that we don't mask the hwcap here, as the flush is essential to
354 functionality on those cpu's that implement it. */
355 int do_flush = GLRO(dl_hwcap) & HWCAP_SPARC_FLUSH;
356 #else
357 /* Unfortunately, this is necessary, so that we can ensure
358 ld.so will not execute corrupt PLT entry instructions. */
359 const int do_flush = 1;
360 #endif
362 if (0 && disp >= -0x800000 && disp < 0x800000)
364 /* Don't need to worry about thread safety. We're writing just one
365 instruction. */
367 reloc_addr[0] = OPCODE_BA | ((disp >> 2) & 0x3fffff);
368 if (do_flush)
369 __asm __volatile ("flush %0" : : "r"(reloc_addr));
371 else
373 /* For thread safety, write the instructions from the bottom and
374 flush before we overwrite the critical "b,a". This of course
375 need not be done during bootstrapping, since there are no threads.
376 But we also can't tell if we _can_ use flush, so don't. */
378 reloc_addr += t;
379 reloc_addr[1] = OPCODE_JMP_G1 | (value & 0x3ff);
380 if (do_flush)
381 __asm __volatile ("flush %0+4" : : "r"(reloc_addr));
383 reloc_addr[0] = OPCODE_SETHI_G1 | (value >> 10);
384 if (do_flush)
385 __asm __volatile ("flush %0" : : "r"(reloc_addr));
388 return value;
391 static inline Elf32_Addr
392 elf_machine_fixup_plt (struct link_map *map, lookup_t t,
393 const Elf32_Rela *reloc,
394 Elf32_Addr *reloc_addr, Elf32_Addr value)
396 return sparc_fixup_plt (reloc, reloc_addr, value, 1);
399 /* Return the final value of a plt relocation. */
400 static inline Elf32_Addr
401 elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
402 Elf32_Addr value)
404 return value + reloc->r_addend;
407 #endif /* dl_machine_h */
409 #ifdef RESOLVE
411 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
412 MAP is the object containing the reloc. */
414 static inline void
415 elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
416 const Elf32_Sym *sym, const struct r_found_version *version,
417 void *const reloc_addr_arg)
419 Elf32_Addr *const reloc_addr = reloc_addr_arg;
420 const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
422 #if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
423 /* This is defined in rtld.c, but nowhere in the static libc.a; make the
424 reference weak so static programs can still link. This declaration
425 cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
426 because rtld.c contains the common defn for _dl_rtld_map, which is
427 incompatible with a weak decl in the same file. */
428 weak_extern (_dl_rtld_map);
429 #endif
431 #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
432 if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
434 # if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
435 if (map != &_dl_rtld_map) /* Already done in rtld itself. */
436 # endif
437 *reloc_addr += map->l_addr + reloc->r_addend;
439 else
440 #endif
442 #if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
443 const Elf32_Sym *const refsym = sym;
444 # ifdef USE_TLS
445 struct link_map *sym_map;
446 # endif
447 #endif
448 Elf32_Addr value;
449 #ifndef RESOLVE_CONFLICT_FIND_MAP
450 if (sym->st_shndx != SHN_UNDEF &&
451 ELF32_ST_BIND (sym->st_info) == STB_LOCAL)
453 value = map->l_addr;
454 # if defined USE_TLS && !defined RTLD_BOOTSTRAP
455 sym_map = map;
456 # endif
458 else
460 # if defined USE_TLS && !defined RTLD_BOOTSTRAP
461 sym_map = RESOLVE_MAP (&sym, version, r_type);
462 value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
463 # else
464 value = RESOLVE (&sym, version, r_type);
465 if (sym)
466 value += sym->st_value;
467 # endif
469 #else
470 value = 0;
471 #endif
472 value += reloc->r_addend; /* Assume copy relocs have zero addend. */
474 switch (r_type)
476 #if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
477 case R_SPARC_COPY:
478 if (sym == NULL)
479 /* This can happen in trace mode if an object could not be
480 found. */
481 break;
482 if (sym->st_size > refsym->st_size
483 || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
485 const char *strtab;
487 strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
488 _dl_error_printf ("\
489 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
490 rtld_progname ?: "<program name unknown>",
491 strtab + refsym->st_name);
493 memcpy (reloc_addr_arg, (void *) value,
494 MIN (sym->st_size, refsym->st_size));
495 break;
496 #endif
497 case R_SPARC_GLOB_DAT:
498 case R_SPARC_32:
499 *reloc_addr = value;
500 break;
501 case R_SPARC_JMP_SLOT:
502 /* At this point we don't need to bother with thread safety,
503 so we can optimize the first instruction of .plt out. */
504 sparc_fixup_plt (reloc, reloc_addr, value, 0);
505 break;
506 #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
507 && !defined RESOLVE_CONFLICT_FIND_MAP
508 case R_SPARC_TLS_DTPMOD32:
509 /* Get the information from the link map returned by the
510 resolv function. */
511 if (sym_map != NULL)
512 *reloc_addr = sym_map->l_tls_modid;
513 break;
514 case R_SPARC_TLS_DTPOFF32:
515 /* During relocation all TLS symbols are defined and used.
516 Therefore the offset is already correct. */
517 *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
518 break;
519 case R_SPARC_TLS_TPOFF32:
520 /* The offset is negative, forward from the thread pointer. */
521 /* We know the offset of object the symbol is contained in.
522 It is a negative value which will be added to the
523 thread pointer. */
524 if (sym != NULL)
526 CHECK_STATIC_TLS (map, sym_map);
527 *reloc_addr = sym->st_value - sym_map->l_tls_offset
528 + reloc->r_addend;
530 break;
531 # ifndef RTLD_BOOTSTRAP
532 case R_SPARC_TLS_LE_HIX22:
533 case R_SPARC_TLS_LE_LOX10:
534 if (sym != NULL)
536 CHECK_STATIC_TLS (map, sym_map);
537 value = sym->st_value - sym_map->l_tls_offset
538 + reloc->r_addend;
539 if (r_type == R_SPARC_TLS_LE_HIX22)
540 *reloc_addr = (*reloc_addr & 0xffc00000) | ((~value) >> 10);
541 else
542 *reloc_addr = (*reloc_addr & 0xffffe000) | (value & 0x3ff)
543 | 0x1c00;
545 break;
546 # endif
547 #endif
548 #ifndef RTLD_BOOTSTRAP
549 case R_SPARC_8:
550 *(char *) reloc_addr = value;
551 break;
552 case R_SPARC_16:
553 *(short *) reloc_addr = value;
554 break;
555 case R_SPARC_DISP8:
556 *(char *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
557 break;
558 case R_SPARC_DISP16:
559 *(short *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
560 break;
561 case R_SPARC_DISP32:
562 *reloc_addr = (value - (Elf32_Addr) reloc_addr);
563 break;
564 case R_SPARC_LO10:
565 *reloc_addr = (*reloc_addr & ~0x3ff) | (value & 0x3ff);
566 break;
567 case R_SPARC_WDISP30:
568 *reloc_addr = ((*reloc_addr & 0xc0000000)
569 | ((value - (unsigned int) reloc_addr) >> 2));
570 break;
571 case R_SPARC_HI22:
572 *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
573 break;
574 case R_SPARC_UA16:
575 ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
576 ((unsigned char *) reloc_addr_arg) [1] = value;
577 break;
578 case R_SPARC_UA32:
579 ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
580 ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
581 ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
582 ((unsigned char *) reloc_addr_arg) [3] = value;
583 break;
584 #endif
585 case R_SPARC_NONE: /* Alright, Wilbur. */
586 break;
587 #if !defined RTLD_BOOTSTRAP || defined _NDEBUG
588 default:
589 _dl_reloc_bad_type (map, r_type, 0);
590 break;
591 #endif
596 static inline void
597 elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
598 void *const reloc_addr_arg)
600 Elf32_Addr *const reloc_addr = reloc_addr_arg;
601 *reloc_addr += l_addr + reloc->r_addend;
604 static inline void
605 elf_machine_lazy_rel (struct link_map *map,
606 Elf32_Addr l_addr, const Elf32_Rela *reloc)
608 switch (ELF32_R_TYPE (reloc->r_info))
610 case R_SPARC_NONE:
611 break;
612 case R_SPARC_JMP_SLOT:
613 break;
614 default:
615 _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1);
616 break;
620 #endif /* RESOLVE */