import later fedora-branch tweaks
[glibc.git] / sysdeps / ia64 / dl-machine.h
blob310804786951acf3d8a251b2c3a5dfe75fef172b
1 /* Machine-dependent ELF dynamic relocation inline functions. IA-64 version.
2 Copyright (C) 1995-1997, 2000-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 1
23 #define ELF_MACHINE_NAME "ia64"
25 #include <assert.h>
26 #include <string.h>
27 #include <link.h>
28 #include <errno.h>
29 #include <dl-fptr.h>
30 #include <tls.h>
32 /* Translate a processor specific dynamic tag to the index
33 in l_info array. */
34 #define DT_IA_64(x) (DT_IA_64_##x - DT_LOPROC + DT_NUM)
36 static inline void __attribute__ ((always_inline))
37 __ia64_init_bootstrap_fdesc_table (struct link_map *map)
39 Elf64_Addr *boot_table;
41 /* careful: this will be called before got has been relocated... */
42 asm (";; addl %0 = @gprel (_dl_boot_fptr_table), gp" : "=r"(boot_table));
44 map->l_mach.fptr_table_len = ELF_MACHINE_BOOT_FPTR_TABLE_LEN;
45 map->l_mach.fptr_table = boot_table;
48 #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
49 __ia64_init_bootstrap_fdesc_table (&bootstrap_map);
51 /* Return nonzero iff ELF header is compatible with the running host. */
52 static inline int __attribute__ ((unused))
53 elf_machine_matches_host (const Elf64_Ehdr *ehdr)
55 return ehdr->e_machine == EM_IA_64;
59 /* Return the link-time address of _DYNAMIC. */
60 static inline Elf64_Addr __attribute__ ((unused, const))
61 elf_machine_dynamic (void)
63 Elf64_Addr *p;
65 __asm__ (
66 ".section .sdata\n"
67 " .type __dynamic_ltv#, @object\n"
68 " .size __dynamic_ltv#, 8\n"
69 "__dynamic_ltv:\n"
70 " data8 @ltv(_DYNAMIC#)\n"
71 ".previous\n"
72 " addl %0 = @gprel(__dynamic_ltv#), gp ;;"
73 : "=r" (p));
75 return *p;
79 /* Return the run-time load address of the shared object. */
80 static inline Elf64_Addr __attribute__ ((unused))
81 elf_machine_load_address (void)
83 Elf64_Addr ip;
84 int *p;
86 __asm__ (
87 "1: mov %0 = ip\n"
88 ".section .sdata\n"
89 "2: data4 @ltv(1b)\n"
90 " .align 8\n"
91 ".previous\n"
92 " addl %1 = @gprel(2b), gp ;;"
93 : "=r" (ip), "=r" (p));
95 return ip - (Elf64_Addr) *p;
98 /* Set up the loaded object described by L so its unrelocated PLT
99 entries will jump to the on-demand fixup code in dl-runtime.c. */
101 static inline int __attribute__ ((unused, always_inline))
102 elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
104 extern void _dl_runtime_resolve (void);
105 extern void _dl_runtime_profile (void);
107 if (lazy)
109 register Elf64_Addr gp __asm__ ("gp");
110 Elf64_Addr *reserve, doit;
113 * Careful with the typecast here or it will try to add l-l_addr
114 * pointer elements
116 reserve = ((Elf64_Addr *)
117 (l->l_info[DT_IA_64 (PLT_RESERVE)]->d_un.d_ptr + l->l_addr));
118 /* Identify this shared object. */
119 reserve[0] = (Elf64_Addr) l;
121 /* This function will be called to perform the relocation. */
122 if (!profile)
123 doit = (Elf64_Addr) ((struct fdesc *) &_dl_runtime_resolve)->ip;
124 else
126 if (_dl_name_match_p (GLRO(dl_profile), l))
128 /* This is the object we are looking for. Say that we really
129 want profiling and the timers are started. */
130 GL(dl_profile_map) = l;
132 doit = (Elf64_Addr) ((struct fdesc *) &_dl_runtime_profile)->ip;
135 reserve[1] = doit;
136 reserve[2] = gp;
139 return lazy;
144 This code is used in dl-runtime.c to call the `fixup' function
145 and then redirect to the address it returns. `fixup()' takes two
146 arguments, however profile_fixup() takes three.
148 The ABI specifies that we will never see more than 8 input
149 registers to a function call, thus it is safe to simply allocate
150 those, and simpler than playing stack games.
151 - 12/09/99 Jes
153 #define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
154 extern void tramp_name (void); \
155 asm ( \
156 " .global " #tramp_name "#\n" \
157 " .proc " #tramp_name "#\n" \
158 #tramp_name ":\n" \
159 " { .mmi\n" \
160 " .prologue\n" \
161 " .save ar.pfs, r40\n" \
162 " alloc loc0 = ar.pfs, 8, 6, 3, 0\n" \
163 " adds r2 = -144, r12\n" \
164 " adds r3 = -128, r12\n" \
165 " }\n" \
166 " { .mii\n" \
167 " .fframe 160\n" \
168 " adds r12 = -160, r12\n" \
169 " .save rp, r41\n" \
170 " mov loc1 = b0\n" \
171 " .body\n" \
172 " mov out2 = b0 /* needed by fixup_profile */\n" \
173 " ;;\n" \
174 " }\n" \
175 " { .mfb\n" \
176 " mov loc2 = r8 /* preserve struct value register */\n" \
177 " nop.f 0\n" \
178 " nop.b 0\n" \
179 " }\n" \
180 " { .mii\n" \
181 " mov loc3 = r9 /* preserve language specific register */\n" \
182 " mov loc4 = r10 /* preserve language specific register */\n" \
183 " mov loc5 = r11 /* preserve language specific register */\n" \
184 " }\n" \
185 " { .mmi\n" \
186 " stf.spill [r2] = f8, 32\n" \
187 " stf.spill [r3] = f9, 32\n" \
188 " mov out0 = r16\n" \
189 " ;;\n" \
190 " }\n" \
191 " { .mmi\n" \
192 " stf.spill [r2] = f10, 32\n" \
193 " stf.spill [r3] = f11, 32\n" \
194 " shl out1 = r15, 4\n" \
195 " ;;\n" \
196 " }\n" \
197 " { .mmi\n" \
198 " stf.spill [r2] = f12, 32\n" \
199 " stf.spill [r3] = f13, 32\n" \
200 " shladd out1 = r15, 3, out1\n" \
201 " ;;\n" \
202 " }\n" \
203 " { .mmb\n" \
204 " stf.spill [r2] = f14\n" \
205 " stf.spill [r3] = f15\n" \
206 " br.call.sptk.many b0 = " #fixup_name "#\n" \
207 " }\n" \
208 " { .mii\n" \
209 " ld8 r9 = [ret0], 8\n" \
210 " adds r2 = 16, r12\n" \
211 " adds r3 = 32, r12\n" \
212 " ;;\n" \
213 " }\n" \
214 " { .mmi\n" \
215 " ldf.fill f8 = [r2], 32\n" \
216 " ldf.fill f9 = [r3], 32\n" \
217 " mov b0 = loc1\n" \
218 " ;;\n" \
219 " }\n" \
220 " { .mmi\n" \
221 " ldf.fill f10 = [r2], 32\n" \
222 " ldf.fill f11 = [r3], 32\n" \
223 " mov b6 = r9\n" \
224 " ;;\n" \
225 " }\n" \
226 " { .mmi\n" \
227 " ldf.fill f12 = [r2], 32\n" \
228 " ldf.fill f13 = [r3], 32\n" \
229 " mov ar.pfs = loc0\n" \
230 " ;;\n" \
231 " }\n" \
232 " { .mmi\n" \
233 " ldf.fill f14 = [r2], 32\n" \
234 " ldf.fill f15 = [r3], 32\n" \
235 " .restore sp /* pop the unwind frame state */\n" \
236 " adds r12 = 160, r12\n" \
237 " ;;\n" \
238 " }\n" \
239 " { .mii\n" \
240 " mov r9 = loc3 /* restore language specific register */\n" \
241 " mov r10 = loc4 /* restore language specific register */\n" \
242 " mov r11 = loc5 /* restore language specific register */\n" \
243 " }\n" \
244 " { .mii\n" \
245 " ld8 gp = [ret0]\n" \
246 " mov r8 = loc2 /* restore struct value register */\n" \
247 " ;;\n" \
248 " }\n" \
249 " /* An alloc is needed for the break system call to work.\n" \
250 " We don't care about the old value of the pfs register. */\n" \
251 " { .mmb\n" \
252 " .prologue\n" \
253 " .body\n" \
254 " alloc r2 = ar.pfs, 0, 0, 8, 0\n" \
255 " br.sptk.many b6\n" \
256 " ;;\n" \
257 " }\n" \
258 " .endp " #tramp_name "#\n");
260 #ifndef PROF
261 #define ELF_MACHINE_RUNTIME_TRAMPOLINE \
262 TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup); \
263 TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
264 #else
265 #define ELF_MACHINE_RUNTIME_TRAMPOLINE \
266 TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup); \
267 strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
268 #endif
270 /* Undo the adds out0 = 16, sp below to get at the value we want in
271 __libc_stack_end. */
272 #define DL_STACK_END(cookie) \
273 ((void *) (((long) (cookie)) - 16))
275 /* Initial entry point code for the dynamic linker.
276 The C function `_dl_start' is the real entry point;
277 its return value is the user program's entry point. */
279 #define RTLD_START asm ( \
280 ".text\n" \
281 " .global _start#\n" \
282 " .proc _start#\n" \
283 "_start:\n" \
284 "0: { .mii\n" \
285 " .prologue\n" \
286 " .save rp, r0\n" \
287 " .body\n" \
288 " .prologue\n" \
289 " .save ar.pfs, r32\n" \
290 " alloc loc0 = ar.pfs, 0, 3, 4, 0\n" \
291 " .body\n" \
292 " mov r2 = ip\n" \
293 " addl r3 = @gprel(0b), r0\n" \
294 " ;;\n" \
295 " }\n" \
296 " { .mlx\n" \
297 " /* Calculate the GP, and save a copy in loc1. */\n" \
298 " sub gp = r2, r3\n" \
299 " movl r8 = 0x9804c0270033f\n" \
300 " ;;\n" \
301 " }\n" \
302 " { .mii\n" \
303 " mov ar.fpsr = r8\n" \
304 " sub loc1 = r2, r3\n" \
305 " /* _dl_start wants a pointer to the pointer to the arg block and\n" \
306 " the arg block starts with an integer, thus the magic 16. */\n" \
307 " adds out0 = 16, sp\n" \
308 " }\n" \
309 " { .bbb\n" \
310 " br.call.sptk.many b0 = _dl_start#\n" \
311 " ;;\n" \
312 " }\n" \
313 " .endp _start#\n" \
314 " /* FALLTHRU */\n" \
315 " .global _dl_start_user#\n" \
316 " .proc _dl_start_user#\n" \
317 "_dl_start_user:\n" \
318 " .prologue\n" \
319 " .save rp, r0\n" \
320 " .body\n" \
321 " .prologue\n" \
322 " .save ar.pfs, r32\n" \
323 " .body\n" \
324 " { .mii\n" \
325 " addl r3 = @gprel(_dl_skip_args), gp\n" \
326 " adds r11 = 24, sp /* Load the address of argv. */\n" \
327 " /* Save the pointer to the user entry point fptr in loc2. */\n" \
328 " mov loc2 = ret0\n" \
329 " ;;\n" \
330 " }\n" \
331 " { .mii\n" \
332 " ld4 r3 = [r3]\n" \
333 " adds r10 = 16, sp /* Load the address of argc. */\n" \
334 " mov out2 = r11\n" \
335 " ;;\n" \
336 " /* See if we were run as a command with the executable file\n" \
337 " name as an extra leading argument. If so, adjust the argv\n" \
338 " pointer to skip _dl_skip_args words.\n" \
339 " Note that _dl_skip_args is an integer, not a long - Jes\n" \
340 "\n" \
341 " The stack pointer has to be 16 byte aligned. We cannot simply\n" \
342 " addjust the stack pointer. We have to move the whole argv and\n" \
343 " envp and adjust _dl_argv by _dl_skip_args. H.J. */\n" \
344 " }\n" \
345 " { .mib\n" \
346 " ld8 out1 = [r10] /* is argc actually stored as a long\n" \
347 " or as an int? */\n" \
348 " addl r2 = @ltoff(_dl_argv), gp\n" \
349 " ;;\n" \
350 " }\n" \
351 " { .mmi\n" \
352 " ld8 r2 = [r2] /* Get the address of _dl_argv. */\n" \
353 " sub out1 = out1, r3 /* Get the new argc. */\n" \
354 " shladd r3 = r3, 3, r0\n" \
355 " ;;\n" \
356 " }\n" \
357 " {\n" \
358 " .mib\n" \
359 " ld8 r17 = [r2] /* Get _dl_argv. */\n" \
360 " add r15 = r11, r3 /* The address of the argv we move */\n" \
361 " ;;\n" \
362 " }\n" \
363 " /* ??? Could probably merge these two loops into 3 bundles.\n" \
364 " using predication to control which set of copies we're on. */\n" \
365 "1: /* Copy argv. */\n" \
366 " { .mfi\n" \
367 " ld8 r16 = [r15], 8 /* Load the value in the old argv. */\n" \
368 " ;;\n" \
369 " }\n" \
370 " { .mib\n" \
371 " st8 [r11] = r16, 8 /* Store it in the new argv. */\n" \
372 " cmp.ne p6, p7 = 0, r16\n" \
373 "(p6) br.cond.dptk.few 1b\n" \
374 " ;;\n" \
375 " }\n" \
376 " { .mmi\n" \
377 " mov out3 = r11\n" \
378 " sub r17 = r17, r3 /* Substract _dl_skip_args. */\n" \
379 " addl out0 = @gprel(_rtld_local), gp\n" \
380 " }\n" \
381 "1: /* Copy env. */\n" \
382 " { .mfi\n" \
383 " ld8 r16 = [r15], 8 /* Load the value in the old env. */\n" \
384 " ;;\n" \
385 " }\n" \
386 " { .mib\n" \
387 " st8 [r11] = r16, 8 /* Store it in the new env. */\n" \
388 " cmp.ne p6, p7 = 0, r16\n" \
389 "(p6) br.cond.dptk.few 1b\n" \
390 " ;;\n" \
391 " }\n" \
392 " { .mmb\n" \
393 " st8 [r10] = out1 /* Record the new argc. */\n" \
394 " ld8 out0 = [out0] /* get the linkmap */\n" \
395 " }\n" \
396 " { .mmb\n" \
397 " st8 [r2] = r17 /* Load the new _dl_argv. */\n" \
398 " br.call.sptk.many b0 = _dl_init_internal#\n" \
399 " ;;\n" \
400 " }\n" \
401 " /* Pass our finalizer function to the user,\n" \
402 " and jump to the user's entry point. */\n" \
403 " { .mmi\n" \
404 " ld8 r3 = [loc2], 8\n" \
405 " mov b0 = r0\n" \
406 " }\n" \
407 " { .mmi\n" \
408 " addl ret0 = @ltoff(@fptr(_dl_fini#)), gp\n" \
409 " ;;\n" \
410 " mov b6 = r3\n" \
411 " }\n" \
412 " { .mmi\n" \
413 " ld8 ret0 = [ret0]\n" \
414 " ld8 gp = [loc2]\n" \
415 " mov ar.pfs = loc0\n" \
416 " ;;\n" \
417 " }\n" \
418 " { .mfb\n" \
419 " br.sptk.many b6\n" \
420 " ;;\n" \
421 " }\n" \
422 " .endp _dl_start_user#\n" \
423 ".previous\n");
426 #ifndef RTLD_START_SPECIAL_INIT
427 #define RTLD_START_SPECIAL_INIT /* nothing */
428 #endif
430 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or TLS
431 variable, so undefined references should not be allowed to define the
432 value.
433 ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
434 of the main executable's symbols, as for a COPY reloc, which we don't
435 use. */
436 /* ??? Ignore *MSB for now. */
437 #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
438 #define elf_machine_type_class(type) \
439 (((type) == R_IA64_IPLTLSB || (type) == R_IA64_DTPMOD64LSB \
440 || (type) == R_IA64_DTPREL64LSB || (type) == R_IA64_TPREL64LSB) \
441 * ELF_RTYPE_CLASS_PLT)
442 #else
443 #define elf_machine_type_class(type) \
444 (((type) == R_IA64_IPLTLSB) * ELF_RTYPE_CLASS_PLT)
445 #endif
447 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
448 #define ELF_MACHINE_JMP_SLOT R_IA64_IPLTLSB
450 /* According to the IA-64 specific documentation, Rela is always used. */
451 #define ELF_MACHINE_NO_REL 1
453 /* Return the address of the entry point. */
454 #define ELF_MACHINE_START_ADDRESS(map, start) \
455 DL_STATIC_FUNCTION_ADDRESS (map, start)
457 #define elf_machine_profile_fixup_plt(l, reloc, rel_addr, value) \
458 elf_machine_fixup_plt (l, reloc, rel_addr, value)
460 #define elf_machine_profile_plt(reloc_addr) ((Elf64_Addr) (reloc_addr))
462 /* Fixup a PLT entry to bounce directly to the function at VALUE. */
463 static inline Elf64_Addr __attribute__ ((always_inline))
464 elf_machine_fixup_plt (struct link_map *l, lookup_t t,
465 const Elf64_Rela *reloc,
466 Elf64_Addr *reloc_addr, Elf64_Addr value)
468 /* l is the link_map for the caller, t is the link_map for the object
469 * being called */
470 /* got has already been relocated in elf_get_dynamic_info() */
471 reloc_addr[1] = t->l_info[DT_PLTGOT]->d_un.d_ptr;
472 /* we need a "release" here to ensure that the gp is visible before
473 the code entry point is updated: */
474 ((volatile Elf64_Addr *) reloc_addr)[0] = value;
475 return (Elf64_Addr) reloc_addr;
478 /* Return the final value of a plt relocation. */
479 static inline Elf64_Addr
480 elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
481 Elf64_Addr value)
483 /* No need to handle rel vs rela since IA64 is rela only */
484 return value + reloc->r_addend;
487 #endif /* !dl_machine_h */
489 #ifdef RESOLVE_MAP
491 #define R_IA64_TYPE(R) ((R) & -8)
492 #define R_IA64_FORMAT(R) ((R) & 7)
494 #define R_IA64_FORMAT_32MSB 4
495 #define R_IA64_FORMAT_32LSB 5
496 #define R_IA64_FORMAT_64MSB 6
497 #define R_IA64_FORMAT_64LSB 7
500 /* Perform the relocation specified by RELOC and SYM (which is fully
501 resolved). MAP is the object containing the reloc. */
502 auto inline void
503 __attribute ((always_inline))
504 elf_machine_rela (struct link_map *map,
505 const Elf64_Rela *reloc,
506 const Elf64_Sym *sym,
507 const struct r_found_version *version,
508 void *const reloc_addr_arg)
510 Elf64_Addr *const reloc_addr = reloc_addr_arg;
511 const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
512 Elf64_Addr value;
514 #if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED
515 /* This is defined in rtld.c, but nowhere in the static libc.a; make the
516 reference weak so static programs can still link. This declaration
517 cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
518 because rtld.c contains the common defn for _dl_rtld_map, which is
519 incompatible with a weak decl in the same file. */
520 weak_extern (_dl_rtld_map);
521 #endif
523 /* We cannot use a switch here because we cannot locate the switch
524 jump table until we've self-relocated. */
526 #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
527 if (__builtin_expect (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_REL64LSB),
530 assert (ELF64_R_TYPE (reloc->r_info) == R_IA64_REL64LSB);
531 value = *reloc_addr;
532 # if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
533 /* Already done in dynamic linker. */
534 if (map != &GL(dl_rtld_map))
535 # endif
536 value += map->l_addr;
538 else
539 #endif
540 if (__builtin_expect (r_type == R_IA64_NONE, 0))
541 return;
542 else
544 struct link_map *sym_map;
546 /* RESOLVE_MAP() will return NULL if it fail to locate the symbol. */
547 if ((sym_map = RESOLVE_MAP (&sym, version, r_type)))
549 value = sym_map->l_addr + sym->st_value + reloc->r_addend;
551 if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DIR64LSB))
552 ;/* No adjustment. */
553 else if (r_type == R_IA64_IPLTLSB)
555 elf_machine_fixup_plt (NULL, sym_map, reloc, reloc_addr, value);
556 return;
558 else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_FPTR64LSB))
559 value = _dl_make_fptr (sym_map, sym, value);
560 else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_PCREL64LSB))
561 value -= (Elf64_Addr) reloc_addr & -16;
562 #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || defined USE___THREAD)
563 else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DTPMOD64LSB))
564 # ifdef RTLD_BOOTSTRAP
565 /* During startup the dynamic linker is always index 1. */
566 value = 1;
567 # else
568 /* Get the information from the link map returned by the
569 resolv function. */
570 value = sym_map->l_tls_modid;
571 else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_DTPREL64LSB))
572 value -= sym_map->l_addr;
573 # endif
574 else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_TPREL64LSB))
576 # ifndef RTLD_BOOTSTRAP
577 CHECK_STATIC_TLS (map, sym_map);
578 # endif
579 value += sym_map->l_tls_offset - sym_map->l_addr;
581 #endif
582 else
583 _dl_reloc_bad_type (map, r_type, 0);
585 else
586 value = 0;
589 /* ??? Ignore MSB and Instruction format for now. */
590 if (R_IA64_FORMAT (r_type) == R_IA64_FORMAT_64LSB)
591 *reloc_addr = value;
592 else if (R_IA64_FORMAT (r_type) == R_IA64_FORMAT_32LSB)
593 *(int *) reloc_addr = value;
594 else if (r_type == R_IA64_IPLTLSB)
596 reloc_addr[0] = 0;
597 reloc_addr[1] = 0;
599 else
600 _dl_reloc_bad_type (map, r_type, 0);
603 /* Let do-rel.h know that on IA-64 if l_addr is 0, all RELATIVE relocs
604 can be skipped. */
605 #define ELF_MACHINE_REL_RELATIVE 1
607 auto inline void
608 __attribute ((always_inline))
609 elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
610 void *const reloc_addr_arg)
612 Elf64_Addr *const reloc_addr = reloc_addr_arg;
613 /* ??? Ignore MSB and Instruction format for now. */
614 assert (ELF64_R_TYPE (reloc->r_info) == R_IA64_REL64LSB);
616 *reloc_addr += l_addr;
619 /* Perform a RELATIVE reloc on the .got entry that transfers to the .plt. */
620 auto inline void
621 __attribute ((always_inline))
622 elf_machine_lazy_rel (struct link_map *map,
623 Elf64_Addr l_addr, const Elf64_Rela *reloc)
625 Elf64_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
626 const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
628 if (r_type == R_IA64_IPLTLSB)
630 reloc_addr[0] += l_addr;
631 reloc_addr[1] += l_addr;
633 else if (r_type == R_IA64_NONE)
634 return;
635 else
636 _dl_reloc_bad_type (map, r_type, 1);
639 #endif /* RESOLVE_MAP */